java.lang.Object
com.graphhopper.jsprit.core.algorithm.recreate.Insertion

public final class Insertion extends Object
Factory methods for creating common insertion operator configurations.

Provides pre-configured insertion operators for use with independent operator selection:

 Jsprit.Builder.newInstance(vrp)
     .addInsertionOperator(0.5, Insertion.regretFast())      // Fast with filtering
     .addInsertionOperator(0.3, Insertion.regret())          // Standard regret
     .addInsertionOperator(0.2, Insertion.best())            // Best insertion
     .buildAlgorithm();
 

All factories return InsertionOperatorFactory instances that will be instantiated during algorithm construction with proper dependencies.

See Also:
  • Method Details

    • regretFast

      public static InsertionOperatorFactory regretFast()
      Fast regret insertion (regret-2).

      Default configuration with no experimental optimizations. For experimental spatial filtering and affected-job tracking, use regretFast(int, int, boolean).

      Returns:
      factory for fast regret insertion
    • regretFast

      public static InsertionOperatorFactory regretFast(int k, int spatialFilterK, boolean affectedJobTracking)
      Fast regret-k insertion with configurable parameters.

      Experimental: Spatial filtering and affected-job tracking are experimental optimizations that may change in future releases.

      Parameters:
      k - regret-k parameter (2 for regret-2, 3 for regret-3, etc.)
      spatialFilterK - number of nearest routes to consider (0 to disable filtering)
      affectedJobTracking - whether to use affected-job tracking (experimental)
      Returns:
      factory for fast regret insertion
    • regret

      public static InsertionOperatorFactory regret()
      Standard regret insertion without filtering (thorough but slower).

      Evaluates all routes for all jobs. Use as a complement to regretFast() to ensure no good insertions are missed.

      Returns:
      factory for standard regret insertion
    • regret

      public static InsertionOperatorFactory regret(int k)
      Standard regret-k insertion.
      Parameters:
      k - regret-k parameter (2 for regret-2, 3 for regret-3, etc.)
      Returns:
      factory for regret-k insertion
    • best

      public static InsertionOperatorFactory best()
      Best insertion (greedy, inserts cheapest job first).

      Simple greedy insertion that always picks the job with lowest insertion cost. Fast but may produce suboptimal solutions.

      Returns:
      factory for best insertion
    • cheapest

      public static InsertionOperatorFactory cheapest()
      Cheapest insertion (true best insertion from VRP literature).

      Inserts jobs one at a time in cheapest-first order, always selecting the globally cheapest insertion across all jobs and routes.

      Returns:
      factory for cheapest insertion
    • positionRegret

      public static InsertionOperatorFactory positionRegret()
      Position-based regret insertion (fast version).

      Experimental: This insertion strategy is experimental and may change in future releases.

      Considers all insertion positions across routes, not just the best position per route. More accurate regret calculation but slower.

      Returns:
      factory for position-based regret insertion
    • positionRegret

      public static InsertionOperatorFactory positionRegret(int k, int topRoutesToExpand)
      Position-based regret insertion with configurable parameters.

      Experimental: This insertion strategy is experimental and may change in future releases.

      Parameters:
      k - regret-k parameter
      topRoutesToExpand - number of top routes to expand to position level
      Returns:
      factory for position-based regret insertion