mpardi
mpardi

Reputation: 1

Anylogic Empty collection error (java.util.NoSuchElementException)

To start on i will discribe my model. I'm working on a simulation based on a last mile fleet delivery and I am using collections inside a population (vans) of agents called Van. In this collections (route) I am storing agents called orders that they have the parameters latitude and longitude of the final destination. I'm taking all the data from a DB and introducig it on a source block. On the exit of the source block the following code is implemented for adding the agents to the collection by an unique ID:

findFirst(vans, v -> v.Key == agent.VanKey).route.addLast(agent);

Before the last mile delivery the orders are processed by a crossdock.

For the pickup i am using a pickup block as i have a specific timestamp for the vans. When I want to assing the first delivert taking the first agent from the collection i have the following error:

java.util.NoSuchElementException

I notice that anylogic dont found any element in the collection but when I look inside the population of all the vans I see that the elements are in the collection.

How can i access to this elements? How can i fix this error?

I'm leaving some prints for better understanding of the problem.

Order Entry

Last Mile Delivery

Error

van agent from simulation

Van Source

PickupFromOffice

vans Population

I read library of collection in anylogic and lots of posts of stackoverflow

Upvotes: 0

Views: 152

Answers (1)

mpardi
mpardi

Reputation: 1

Solved, the agents from the source of the last mile delivery where not the same agents as the population which have the collections fullfield inside.

Upvotes: 0

Related Questions