#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# Constrain Loop Randomization

Hi all,
I am programming an experiment in which i need to applied 2 different constrains to Loop randomization.
Specifically I want

1) Make repetitions of the same Condition(Joint or Solo) are separated by at least 5 cycles. I did it following the instructions here http://osdoc.cogsci.nl/3.1/manual/structure/loop/ and it works.
2) At the same time, I want make that the loop always start with a Condition = Joint cycle.

How do I implement the second constrain?

Thank you!

• Hi Eris,

The easiest way to accomplish this would be to simply start with loop of length 1 in which Condition is 'joint'. And then you have a second loop in which you have more trials, and in which you use pseudorandomization. Does that work?

Cheers!
Sebastiaan

There's much bigger issues in the world, I know. But I first have to take care of the world I know.
cogsci.nl/smathot

• Hi Sebastian,
Let's say that yes in general it works, but not in my specific case.

I am looking for a solution in python. I f I find it i will post it

• Hi Sebastian,

I've tried to use the contrain comand with mindist

constrain Condition mindist=5.

But it doesn't work. It could be to the fact that i am using phyton 3?

Cheers

• Hi Eris,

The constrain command is not Python code, but OpenSesame script, which you need to add to the script of the loop item. You can see how this works (but with another command) in this screencast:

Does that clear things up?

Cheers!
Sebastiaan

There's much bigger issues in the world, I know. But I first have to take care of the world I know.
cogsci.nl/smathot

• Hi Sebastian,
Thanks for the video. But This is not what I need.
I need the constrain command, which are explain in the manual

I've tried both commands, here is what happens:
1) with constrain Condition mindist=5 -> the experiment run, but it get stucked at the first item of the sequence. Note that it doesn't crush but it stucks

2) with constrain Condition maxrep=5 -> the experiment run well but it doesn't constrain the randomization.So basically it's like the command is ignored.

Here is a copy of my loop script. I can't upload the program 'cause there is an external device integrated.

Thanks,
Francesca

• Hi Francesca,

With two conditions (joint and solo) it is not logically possible to have a minimum distance of 5 between repetitions! That's why OpenSesame hangs: it's trying to figure out a solution, which doesn't exist, and it takes a while before a timeout occurs. (So it won't crash indefinitely.)

So I would take a step back and formulate clearly for yourself what you're trying to accomplish exactly. Can you give an example of a loop table that meets your criteria?

Cheers!
Sebastiaan

There's much bigger issues in the world, I know. But I first have to take care of the world I know.
cogsci.nl/smathot