Is it possible to have two or multiple shipment in same route by hard Contraint.
If not, do you know other java libraries that can handle such kind of restrictions?
Thank you!
Is it possible to have two or multiple shipment in same route by hard Contraint.
If not, do you know other java libraries that can handle such kind of restrictions?
Thank you!
Copyright © 2021 Jogjafile Inc.
The easiest way do make sure that shipments are in the same route is to tag these shipment with a skill
but then you need to tag a particular vehicle as well:
And make sure you make the algorithm consider skills/these tags (see https://github.com/jsprit/jsprit/blob/master/WHATS_NEW.md - you need to use 1.3.2-SNAPSHOT).
If you do not want to assign a particular vehicle with a tag, you need to implement a core.problem.constraint.HardRouteStateLevelConstraint which is basically this method
Make sure that insertionContext.getJob() [which is the job to be inserted] can be inserted into insertionContext.getRoute(). At this point you need to know two things:
For latter information you need to define states that provides you with a job-route assignment. I would define a problemState and its according updater like this:
Add your state updater and your constraint to your State/ConstraintManager and you are done.