Reputation: 15
I am simulating an evacuation and would like to pick up people with busses. I would like to select "exact quantity(wait for)" because partially empty busses would be highly inefficient. However, the problem Im running into is that some people may be left behind if the last group is smaller than the specified bus capacity. The bus will then not leave, because it's not filled up.
Does anybody know a way of using conditioning to get around the problem? I can't just modify the total amount of waiting people to fill all the busses. This is because I have different groups of people entering different types of vehicles.
something like
exact quantity (wait for) - IF "waiting area" contains > 12 agents
quantity (if available) - IF "waiting area" contains ≤ 12 agents
Thanks
Upvotes: 0
Views: 512
Reputation: 2517
Keep your Pickup blocks with "exact quantity (wait for)"; the quantity is a dynamic property (re-evaluated every time an agent enters the Pickup block), so you can track the number remaining to pickup in a variable (set once you know how many are to pickup in total, and decremented for every pickup) and use a conditional statement (Java ternary expression) in your Pickup block quantity.
If your buses take 12 passengers as in your question, and your left-to-pickup is an int
variable called leftToPickup
, the expression would be
leftToPickup < 12 ? leftToPickup : 12
(read as 'if leftToPickup is less than 12, the quantity expression evaluates to leftToPickup, otherwise it evaluates to 12').
Screenshots of a 'minimal example' model to do this below.
Upvotes: 1