Class RegretInsertionFast

java.lang.Object
com.graphhopper.jsprit.core.algorithm.recreate.AbstractInsertionStrategy
com.graphhopper.jsprit.core.algorithm.recreate.RegretInsertionFast
All Implemented Interfaces:
InsertionStrategy

public class RegretInsertionFast extends AbstractInsertionStrategy
Insertion based on regret approach with affected-job tracking optimization.

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.

Affected-Job Tracking Optimization: After inserting a job into route R, only jobs that had R in their top-2 (best or second-best) routes need full recalculation. Other jobs use cheap lower-bound checks to determine if R became competitive. Combined with spatial filtering, this provides significant speedup for large instances (5-10x typical).

Author:
stefan schroeder
  • Constructor Details

  • Method Details

    • setScoringFunction

      public void setScoringFunction(ScoringFunction scoringFunction)
      Sets the scoring function.

      By default, the this.TimeWindowScorer is used.

      Parameters:
      scoringFunction - to score
    • setRegretScoringFunction

      public void setRegretScoringFunction(RegretScoringFunction regretScoringFunction)
    • setRegretKScoringFunction

      public void setRegretKScoringFunction(RegretKScoringFunction regretKScoringFunction)
    • setRegretK

      public void setRegretK(int k)
    • setSwitchAllowed

      public void setSwitchAllowed(boolean switchAllowed)
    • setDependencyTypes

      public void setDependencyTypes(DependencyType[] dependencyTypes)
    • setSpatialFilter

      public void setSpatialFilter(AdaptiveSpatialFilter spatialFilter)
    • getSpatialFilter

      public AdaptiveSpatialFilter getSpatialFilter()
    • setAffectedJobTrackingEnabled

      public void setAffectedJobTrackingEnabled(boolean enabled)
      Enables or disables affected-job tracking optimization. When enabled, only jobs affected by a route modification are recalculated. Default is enabled.
      Parameters:
      enabled - true to enable (default), false to disable
    • isAffectedJobTrackingEnabled

      public boolean isAffectedJobTrackingEnabled()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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:
      insertUnassignedJobs in class AbstractInsertionStrategy