Millisecond Forums

constrained randomization help

https://forums.millisecond.com/Topic9600.aspx

By tcarpenter216 - 2/3/2013

Hi all,


I have an experiment in which I have three blocks (chips, peanut, cereal) that I need presented in a random order. Typically, I would just use the following command:


/blocks = [1,2,3=noreplace(chips, peanut, cereal)]


However, there is a catch. In between each of the three blocks (chips, peanut, cereal) I need them to do some other things.


In other words, I want them to do one of the three at random, then do some other procedures, then do one of the remaining two blocks  at random, then do some other procedures, then do the last of the three remaining blocks. 


Here is how I attempted to solve it, but the problem here is that this allows you to repeat an earlier block (which I don't want:



<expt ALL>


/ blocks = [1=noreplace(chips, peanut, cereal); 2=interim; 3=noreplace(chips, peanut, cereal); 4=interim; 5=noreplace(chips, peanut, cereal)]


</expt>



I also attempted to solve the problem by using a counter. The problem is, apparently, elements can't be invoked this way. This summarizes the idea of what I want to do. Does anybody know how to pull this off?



<counter chooser>

/ items = (block.chips, block.peanut, block.cereal)

/ select = noreplace

/ selectionrate = always

</counter>



<expt ALL>

/ blocks = [1=counter.chooser.selectedvalue; 2=interim; 3=counter.chooser.selectedvalue; 4=interim; 5=counter.chooser.selectedvalue]

</expt>



As you can see, this code is clearly invalid because you can't "store" blocks in a counter that way. Does anyone know how to correctly implement this randomization procedure?



By Dave - 2/3/2013

The solution is simple (see the documentation for the /blocks attribute)


/ blocks = [1,3,5=noreplace(chips,peanut,cereal); 2,4=interim]


Regards,


~Dave

By tcarpenter216 - 2/3/2013

Thanks Dave!


Yes, seems obvious, doesn't it. 



Incidentally, if I ever did want to manipulate blocks through more complex code architecture, is it usually advisable to do it within the experiment tag, or can I use other things (like counters, although apparently not counters) to perform complex logic and have the experiment tag to invoke those blocks? 


Does my question make sense? Obviously in this case, the solution was simple, but I have a sneaking suspicion some other elements of some of the designs I am programming are not all that simple. 


PS, I'm new to inquisit, so pardon my learning curve. If there is a good resource for implementing complex randomization (or conditional randomization), that would be great. 

By Dave - 2/3/2013

Incidentally, if I ever did want to manipulate blocks through more complex code architecture, is it usually advisable to do it within the experiment tag, or can I use other things (like counters, although apparently not counters) to perform complex logic and have the experiment tag to invoke those blocks? 


In Inquisit 4, you can do this with the <list> element (see e.g. http://www.millisecond.com/forums/Topic9304.aspx#9304). This is not available in Inquisit 3, i.e., you'd have to resort to other means (conditional logic, /branch and /skip patterns).


Regarding complex / constrained randomization, I have posted some general thoughts at http://www.millisecond.com/forums/Topic6419.aspx but don't go into implementation details. Some concrete examples can be found by browsing or searching the forum.


Regards,


~Dave