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:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordContext object containing all dependencies needed to create a ruin strategy. -
Method Summary
Modifier and TypeMethodDescriptioncreate(RuinOperatorFactory.Context context) Creates a ruin strategy with the given dependencies.default StringgetName()Returns the default name for this operator factory.static RuinOperatorFactorynamed(String name, RuinOperatorFactory factory) Creates a named factory wrapper.
-
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
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
Creates a named factory wrapper.- Parameters:
name- the operator namefactory- the factory to wrap- Returns:
- a factory that returns the given name from
getName()
-