Read jsprit solution from a file with VrpXMLReader

I am solving VRP with jsprit. I read solution from a file with VrpXmlReader

VehicleRoutingProblem.Builder problemBuilder = VehicleRoutingProblem.Builder.newInstance();

VrpXMLReader vrpXMLReader = new VrpXMLReader(problemBuilder, solutions);
vrpXMLReader.setSchemaValidation(false);
vrpXMLReader.read(initialSolutionStream);
VehicleRoutingProblem solutionProblem = problemBuilder.build();

but when the solution contains vehicle Breaks, I get an error

java.lang.IllegalArgumentException: The vehicle routing roblem already contains a vehicle break with id null. Please choose unique ids for each vehicle break.

How can I fix this?

Check the break IDs you are using. Ensure there are none that are set as null and all IDs are unique

The problem is I don’t set breaks manually, I am trying to read an old solution generated by jsprit from a file, in that file breaks have no ID’s because they are a TourActivity

Powered by Discourse