问题
Rather than statically defining the resources (or resource pools) to be seized within the definition of a seize block, I would like the agent entering the seize block to be able to specify the resources that it requires.
For example, I may have say 100 resource pools each one representing a different type of resource (like tools in a tool room). Each agent in my model needs a different combination and quantity of the resources (in my example this would be tools). When my agent enters the seize block to seize its list of resources, I want the agent to be able to specify which resources (tools or resource sets) it requires.
Is it possible to achieve this using the "Customize resource choice" and "Resource choice condition" options? Or is there another way this can be achieved?
回答1:
You can use the "custom resource choice" setting, assuming all required resources are in one resource pool.
Assume your resources have a String parameter "myType". Now an incoming agent can choose to only seize resources where unit.myType.equals("Mechanics")
.
Obviously, you can make that as flexible as you like.
In your "Seize" object, you can also change the static assignment of which pools to seize from by switching to the dynamic setup. Now you are extremely flexible by which pools to use and (within a pool) which units to seize...
来源:https://stackoverflow.com/questions/58533181/anylogic-dynamic-specification-of-resources-to-seize