I have a need to sequentially select randomly from a collection of entities where subsequent selections can no longer select entities that were previously selected (like pulling objects from a bag, the objects no longer exist for future selection). I recognize that the process list action can be used to randomly select from a collection (thanks to Tom), but am not sure how to ensure future selections no longer select past selections.
I think it would be possible to keep the items selected in a separate collection that you build up, and then make sure your current selection is not in that collection. I have not tried this, but seems like it should work if a bit awkward/inefficient. I thought I'd see if anyone had any other ideas on how to do this, before trying my hand at it.
Thanks!
--Andy
bags in Ventity?
Re: bags in Ventity?
Does this selection happen at a single point in time, or does the state have to be remembered across time steps?
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: bags in Ventity?
If I am understanding your question correctly, I believe that it has to be remembered across time steps. Going back to the model that you sent me in a previous post, which I've attached, it would be as if you wanted to never pick the same vendor twice (via the PickVendor action)
. This does not make so much sense for this model, but for the bigger model I'm developing it does.Re: bags in Ventity?
Is this right?
You have
- firms
- vendors
- firm x vendor relationships
A firm iterates (process list) over the vendors for which there is not an existing firm x vendor relationship, picks n new vendors, and creates relationships with them.
You have
- firms
- vendors
- firm x vendor relationships
A firm iterates (process list) over the vendors for which there is not an existing firm x vendor relationship, picks n new vendors, and creates relationships with them.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: bags in Ventity?
Yes, that is right.
Re: bags in Ventity?
OK. So, the hard part is that firm is iterating over vendor[], but the check needed is for an instance of relationship[firm,vendor] where firm = the invoker and vendor = refVendor in the process list.
I think it might be possible to construct a reference to the relationship populated that way, and use the IsNull() function to test it.
Another option is to ignore the redundancy and attempt to create the relationship - the create will fail due to duplicate keys. However, the invoker probably can't detect the failure and proceed to another vendor if needed.
Bit of a head-scratcher, but this is actually a fairly common requirement for this kind of situation. Will ponder and attempt a test model.
I think it might be possible to construct a reference to the relationship populated that way, and use the IsNull() function to test it.
Another option is to ignore the redundancy and attempt to create the relationship - the create will fail due to duplicate keys. However, the invoker probably can't detect the failure and proceed to another vendor if needed.
Bit of a head-scratcher, but this is actually a fairly common requirement for this kind of situation. Will ponder and attempt a test model.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: bags in Ventity?
This can be done, as long as you don't need to delete relationships but reestablish them later. (There are probably workarounds if you do need that.)
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: bags in Ventity?
Great to hear! I don't think I need to delete relationships. Do you have a test model or a structure for how it can work?
Re: bags in Ventity?
You can delete relationships, but then you can't subsequently resurrect one with the same key. This is something we're considering. There might be a workaround, but it'll be a little complicated.
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Re: bags in Ventity?
This worked brilliantly. Thanks Tom. I think I finally understand the full value of the IsNull built-in function for this purpose.
Re: bags in Ventity?
It'll get better, too, when we make it possible to reanimate a deleted relationship. Glad it works for you!
/*
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/
Advice to posters (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Blog: http://blog.metasd.com
Model library: http://models.metasd.com
Bookmarks: http://delicious.com/tomfid/SystemDynamics
*/