How to add a constraints in OptaPlanner for vehicle routing -
i working on vehicle routing problem have implement constraint ensures specific location/s shouldn't 1st or last location traversed. idea how can addressed ?
there couple of ways can this:
the easy way:
if (customer.getpreviousstandstill instanceof vehicle) // first visit if (customer.getnextcustomer == null) // last visit the hard way (in case need single out 37th visit etc):
in planning entity customer, add shadow variable visitnumber, in vehicle, add shadow variable visitnumbertotal. use variablelisteners keep in sync.
Comments
Post a Comment