Cannot Lock Vehicle Twice

Dear Team Jsprit,

I attempted to modify the MultipleDepotExample.java to add depots from a csv. However, after running the project, I got the following exception:

"Exception in thread “main” java.lang.IllegalStateException: cannot lock vehicle twice ***@ezhome.com

at jsprit.core.problem.vehicle.VehicleFleetManagerImpl.lock(VehicleFleetManagerImpl.java:166)

at jsprit.core.algorithm.ResetAndIniFleetManager.informInsertionStarts(ResetAndIniFleetManager.java:42)

at jsprit.core.algorithm.recreate.listener.InsertionListeners.informInsertionStarts(InsertionListeners.java:63)

at jsprit.core.algorithm.recreate.AbstractInsertionStrategy.insertJobs(AbstractInsertionStrategy.java:84)

at jsprit.core.algorithm.module.RuinAndRecreateModule.runAndGetSolution(RuinAndRecreateModule.java:54)

at jsprit.core.algorithm.SearchStrategy.run(SearchStrategy.java:140)

at jsprit.core.algorithm.VehicleRoutingAlgorithm.searchSolutions(VehicleRoutingAlgorithm.java:206)

at test.MultipleDepotExample.main(MultipleDepotExample.java:129)
Are there resources available for me to better understand what it means when it says that I cannot lock a vehicle twice?

Please advise. I would greatly appreciate your support.

Can you provide a simple example to reproduce this?

For anyone who encounters this problem in the future, I found the problem.

If you have multiple vehicles at each “depot” you need to name the vehicles uniquely. Vehicles sharing the same depot cannot have the same name… Pretty dumb bug on my end… should have been intuitive, but it wasnt.

2 Likes

Irr … this should not be. This must be avoided. Actually, the vrp
builder should have control over this. I am going to check this.

Am 02/02/16 um 20:33 schrieb kevin1:

Same ids for vehicles should not be possible anymore. See: https://github.com/jsprit/jsprit/issues/213

Thanks, Kevin for detecting this.