Interface RuinOperatorFactory


public interface RuinOperatorFactory
Factory interface for creating ruin strategies.

This allows registering ruin operators with the algorithm builder without needing to pre-create all dependencies. The factory will be called during algorithm construction when all dependencies are available.

Example usage:

 Jsprit.Builder.newInstance(vrp)
     .addRuinOperator(0.3, Ruin.random(0.3))
     .addRuinOperator(0.3, Ruin.radial(0.3))
     .addRuinOperator(0.2, Ruin.cluster())
     .addRuinOperator(0.2, Ruin.kruskalCluster())
     .buildAlgorithm();
 
See Also:
  • Method Details

    • create

      Creates a ruin strategy with the given dependencies.
      Parameters:
      context - the context containing all required dependencies
      Returns:
      the configured ruin strategy
    • getName

      default String getName()
      Returns the default name for this operator factory.

      This name is used in strategy IDs when no explicit name is provided to addRuinOperator().

      Returns:
      the default name, or null if not specified
    • named

      static RuinOperatorFactory named(String name, RuinOperatorFactory factory)
      Creates a named factory wrapper.
      Parameters:
      name - the operator name
      factory - the factory to wrap
      Returns:
      a factory that returns the given name from getName()