Using a python based Genetic Algorithm i am able to get routes for a vehicle routing problem with a heterogeneous fleet. These have to be evaluated in anylogic using discrete event simulation. I used the following blocks:
In the main, I call the python communicator and store the routes in a parameter of the type "List", then I add these routes to the agent 'Order' (of population type) such that each order agent contains a unique route and vehicle.
However, after seizing, each separate stop embedded within the parameter route from the order agent needs to be visited by the vehicle. Currently I have the moveTo block where I defined to agent with an agent 'main.Stops'. But this gives me the error that I cannot convert from int to agent.
The idea I had is to count the routes and count the elements in the routes via the parameter 'routeID' and variable 'OrderCount' respectively. These are updated after each visit and are initialized at zero. Does anybody know how I can ensure that each integer element in the route can be visited via a moveTo block (or other solution).
I would implement something as follows: This is an example from a previous similar project
Create a Java class for every stop that contains at least two fields, latitude longitude, or some other way of identifying the location. (In the example below called Order)
Create a collection of Order
inside your agent that does the movement (E.g. Truck)
Inside the MoveTo
block you make the Truck agent move to the first location in the list and then you remove that order from the list when it finished moving.
There is a SelectOutput
block at the end of each delivery to check if there are more stops/orders. If there are the process continues, if not then you can stop or do something else.