How can I set the drop-off block to unload a certain percentage of people at one train station and a different percentage at the next train station?
问题:
回答1:
You can find out how many agents are contained in the container by doing container.contents().size()
Let's imagine you want to dropoff 50% in the first and 10% in the second.
In the first dropoff, assuming that you want to dropoff 50% you can choose the option dropoff "given quantity if available" and set the quantity as (int)round((container.contents().size())*0.5)
Of course you can change 0.5 to 0.3 if you want to dropoff 30%.
In the next dropoff you want to dropoff 10% of the initial population (but only 50% is remaining, so you want to dropoff 20% of the current population
(int)round((container.contents().size())*0.2)
Let's imagine that you have 100 in the initial population and you want to dropoff 50% on the first and 10% on the second (50 passengers in the first and 10 passengers in the second)
(int)round((container.contents().size())*0.5)
will dropoff those 50 passengers, so you will have only 50 passengers left and on the second you want to dropoff 10 passengers. 10, is 20% of 50... that's why I use 0.2 in the second dropoff