Mworks selection object not reset

Hi Chris,
Just wanted to let you know that I’ve observed that a selection variable where the autoreset field is set to YES does not automatically reset when the selections are all made. Instead it seems to sample the same last value a bunch of times (probably exactly the same as the number of entries in the selection variable) before resetting. This seems either wrong or counter-intuitive. Do you have any suggestions?
Thanks,
Rishi

Hi Rishi,

Can you send me an example experiment that demonstrates this behavior?

Thanks,
Chris

At the moment, I am explicitly calling “reset_selections” when I expect the
selection variable to be expired.

Can you at least send me the definition of the selection variable that isn’t auto-resetting? In my tests, autoreset is working as expected, so I’m trying to understand what’s different in your experiment.

Thanks,
Chris

Yes, it’s in the file I attached above… Pasted here as well

selection trial_index (
values = 0:199
selection = random_with_replacement
advance_on_accept = YES
autoreset = YES
)

Sorry, I didn’t get the attached file. (MWEL files seems to get caught in spam filters, probably due to the unknown extension. You can avoid this by appending .txt to the filename or zip-compressing the file.)

Anyway, the problem is that advance_on_accept and autoreset don’t work together. A selection variable with advance_on_accept set to YES will automatically advance only when there are unused selections remaining. If there are no selections left, then it won’t attempt to advance, and the variable will never get the chance to automatically reset itself.

Addressing this issue is on my to-do list. In the meantime, you can work around it by omitting advance_on_accept and manually calling next_selection after accepting.

Cheers,
Chris

Got it – thanks, Chris!