There is my scenario :
I am building a dynamic routing system.If there are 3 pickup points A,B,C and one depot D.At start,I can solve a routing plan like [D->A->C->B->D].After some time,perhaps this vehicle is between A and C.I want to reuse last time route [D->A->C->B->D] as InitialRoute and re-optimise a route when some new pickup requests in.However,at this time pickup A is completed.
My question is how can I get rid of completed service [D->A] and fix route [C->B->D] as InitialRoute that could accept or not accept new service requests [E,F,G…].
The only way I can figure out is to form a VehicleRoute by myself:
VehicleRoutingProblemSolution solution = Solutions.bestOf(solutions);
Collection routes = solution.getRoutes();
VehicleRoute newRoute = new VehicleRoute();
for (VehicleRoute route:routes){
for (Service service:route.getActivities()){
if(!service.isFinished()) newRoute.getActivities().add(service);
}}
Is there better way to achieve this goal? Thanks