Search code examples
anylogic

Removing agent when resourcepool capacity reduced


If I add a slider to control a resourcepool capacity, increasing the slider adds the resource to the population. However, how do I delete resources from the population when i decrease the slider? And what will be the delete order be? (From last added agent?)


Solution

  • To destroy them, simply the the property "when capacity decreases" as below: enter image description here

    To test the sequence of destruction, run a few tests by addinga traceln command in the "on destroy unit" code box in the resource pool properties. It probably first destroys idle units but maybe simply destroys the oldest.