Clear all Jobs and Vehicles added to VehicleRoutingProblem.Builder & Cost Matrix

Hi there, I am new to Java, so perhaps there is something I am missing, but I am wondering how to clear the jobs & vehicle of the VehicleRoutingProblem.Builder ?

I have tried using a conditional check:
if(vrpBuilder.getAddedJobs().size()>0) vrpBuilder.getAddedJobs().clear()

Using the same style of conditional when checking for added Vehicles. Seem to be having the same problem with resetting the cost Matrix as well. Any suggestions or links to resources? Searching on Google/StackOverFlow, I haven’t come across any questions with a similar problem yet.

Thanks!

I solved this issue, which turned out to be pretty simple. For anybody interested, I had a Class built around my solution and was setting attributes of that class like the fleet and costmatrix and wasn’t clearing those attributes after execution.

1 Like
Powered by Discourse