CVRP outputing and Saving variables in array

Hello everyone,

I’m new to java programming and jsrit lib please bear with me,

I’m trying to create a simple CVRP using jsprit inside Anylogic. So far I have managed to construct the model inside Anylogic following the examples found online. However Is there a way to obtain the output/store results in variables other than outputting solutions to an xml file using vrpxmlwriter?

in my particular case, I need the solutions to be in a HashMap of a string representing the vehicle ID and an array of its locations to visit (String vehicle ID, Array of locations to visit)

any tips?

thanks

Read this jsprit/Simple-Example.md at master · graphhopper/jsprit · GitHub

This is some pseudo code how to obtain vehicle ID and locations

var routes = solution.getRoutes(); // each route has vechile and activities
for(var route: routes){
    var vehicleId = route.getVeicle().getId();
    for(var activity : route.getActivities()){ // each activity has location
        var location = activity.getLocation();
    }
}

this is pretty much RTFM case :slight_smile:

Powered by Discourse