Bas Lindeboom
Bas Lindeboom

Reputation: 91

anylogic selectblock on 'true' returns same agent

I am simulating last-mile delivery and I want to iteratively evaluate the co2 emissions between stops. The numbers of the first route evaluation add up i.e. it correctly counts/removes each stop embedded within the route. The problem is that when the first route is finished, the model should consider the next route embedded in a new agent of type 'Order', in 'toConsumer' but it does not. From what I can see, is that the order agent is not updated after the condition in the select block has been met. I am not sure however, why it does this. When the condition is satisfied the agent does continue to the sink. Does anybody know how i can ensure this updating of the agent?

The anylogic model looks as follows: enter image description here

In the source block I create agents following optimization results via:

int r = 0;
agent.routeVeh = (int) parVehicle.get(r);
agent.route = (List) parRoute.get(r);
agent.routeDep = (int) parDepot.get(r); 
r++;

And in the select block i have:

enter image description here

enter image description here

The to consumer block:

Upvotes: 1

Views: 83

Answers (1)

Yashar Ahmadov
Yashar Ahmadov

Reputation: 1636

If you are doing this operation in the Main agent, you need to define routeCount and consumerCount inside your Order agent (or if you have a Vehicle agent defined, inside that). Because they are defined for each order. Then in the routeFinished you need update the variable as agent.consumerCount++;

Upvotes: 1

Related Questions