Class RegretInsertion
java.lang.Object
com.graphhopper.jsprit.core.algorithm.recreate.AbstractInsertionStrategy
com.graphhopper.jsprit.core.algorithm.recreate.RegretInsertion
- All Implemented Interfaces:
InsertionStrategy
Insertion based on regret approach.
Basically calculates the insertion cost of the firstBest and the secondBest alternative. The score is then calculated as difference between secondBest and firstBest, plus additional scoring variables that can defined in this.ScoringFunction. The idea is that if the cost of the secondBest alternative is way higher than the first best, it seems to be important to insert this customer immediatedly. If difference is not that high, it might not impact solution if this customer is inserted later.
- Author:
- stefan schroeder
-
Nested Class Summary
Nested classes/interfaces inherited from class com.graphhopper.jsprit.core.algorithm.recreate.AbstractInsertionStrategy
AbstractInsertionStrategy.Insertion -
Field Summary
Fields inherited from class com.graphhopper.jsprit.core.algorithm.recreate.AbstractInsertionStrategy
NO_NEW_DEPARTURE_TIME_YET, NO_NEW_DRIVER_YET, NO_NEW_VEHICLE_YET, random, vrp -
Constructor Summary
ConstructorsConstructorDescriptionRegretInsertion(JobInsertionCostsCalculator jobInsertionCalculator, VehicleRoutingProblem vehicleRoutingProblem) -
Method Summary
Modifier and TypeMethodDescriptioninsertUnassignedJobs(Collection<VehicleRoute> routes, Collection<Job> unassignedJobs) Runs insertion.voidsetRegretK(int k) voidsetRegretKScoringFunction(RegretKScoringFunction regretKScoringFunction) voidsetRegretScoringFunction(RegretScoringFunction regretScoringFunction) voidsetScoringFunction(ScoringFunction scoringFunction) Sets the scoring function.toString()Methods inherited from class com.graphhopper.jsprit.core.algorithm.recreate.AbstractInsertionStrategy
addListener, getListeners, insertJob, insertJobs, markUnassigned, removeListener, setRandom
-
Constructor Details
-
RegretInsertion
public RegretInsertion(JobInsertionCostsCalculator jobInsertionCalculator, VehicleRoutingProblem vehicleRoutingProblem)
-
-
Method Details
-
setRegretScoringFunction
-
setRegretKScoringFunction
-
setRegretK
public void setRegretK(int k) -
setScoringFunction
Sets the scoring function.By default, the this.TimeWindowScorer is used.
- Parameters:
scoringFunction- to score
-
toString
-
insertUnassignedJobs
public Collection<Job> insertUnassignedJobs(Collection<VehicleRoute> routes, Collection<Job> unassignedJobs) Runs insertion.Before inserting a job, all unassigned jobs are scored according to its best- and secondBest-insertion plus additional scoring variables.
- Specified by:
insertUnassignedJobsin classAbstractInsertionStrategy
-