Class IndependentRuinAndRecreateModule
java.lang.Object
com.graphhopper.jsprit.core.algorithm.module.IndependentRuinAndRecreateModule
- All Implemented Interfaces:
DynamicStrategyIdProvider,SearchStrategyModule
public class IndependentRuinAndRecreateModule
extends Object
implements SearchStrategyModule, DynamicStrategyIdProvider
A ruin-and-recreate module that selects ruin and insertion operators independently.
Unlike the standard RuinAndRecreateModule which has fixed operators,
this module maintains weighted selectors for both ruin and insertion operators
and selects them independently at each iteration.
This enables more flexible search strategies where the ruin and insertion choices are decoupled, allowing more combinations to be explored.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionIndependentRuinAndRecreateModule(String moduleName, WeightedOperatorSelector<InsertionStrategy> insertionSelector, WeightedOperatorSelector<RuinStrategy> ruinSelector) Creates a new independent ruin-and-recreate module. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModuleListener(SearchStrategyModuleListener moduleListener) Returns the insertion selector.Returns the strategy ID for the last execution, reflecting which operators were selected.getName()Returns the ruin selector.runAndGetSolution(VehicleRoutingProblemSolution previousVrpSolution) voidsetMinUnassignedJobsToBeReinserted(int minUnassignedJobsToBeReinserted) Sets the minimum number of unassigned jobs to be reinserted in each iteration.voidsetProportionOfUnassignedJobsToBeReinserted(double proportionOfUnassignedJobsToBeReinserted) Sets the proportion of unassigned jobs to be reinserted in each iteration.voidSets the random number generator for reproducibility.toString()
-
Constructor Details
-
IndependentRuinAndRecreateModule
public IndependentRuinAndRecreateModule(String moduleName, WeightedOperatorSelector<InsertionStrategy> insertionSelector, WeightedOperatorSelector<RuinStrategy> ruinSelector) Creates a new independent ruin-and-recreate module.- Parameters:
moduleName- the name of this moduleinsertionSelector- the weighted selector for insertion strategiesruinSelector- the weighted selector for ruin strategies
-
-
Method Details
-
setRandom
Sets the random number generator for reproducibility.- Parameters:
random- the random number generator
-
setMinUnassignedJobsToBeReinserted
public void setMinUnassignedJobsToBeReinserted(int minUnassignedJobsToBeReinserted) Sets the minimum number of unassigned jobs to be reinserted in each iteration.- Parameters:
minUnassignedJobsToBeReinserted- minimum jobs to reinsert
-
setProportionOfUnassignedJobsToBeReinserted
public void setProportionOfUnassignedJobsToBeReinserted(double proportionOfUnassignedJobsToBeReinserted) Sets the proportion of unassigned jobs to be reinserted in each iteration.- Parameters:
proportionOfUnassignedJobsToBeReinserted- proportion (0.0-1.0)
-
runAndGetSolution
public VehicleRoutingProblemSolution runAndGetSolution(VehicleRoutingProblemSolution previousVrpSolution) - Specified by:
runAndGetSolutionin interfaceSearchStrategyModule
-
getName
- Specified by:
getNamein interfaceSearchStrategyModule
-
addModuleListener
- Specified by:
addModuleListenerin interfaceSearchStrategyModule
-
getInsertionSelector
Returns the insertion selector. -
getRuinSelector
Returns the ruin selector. -
getLastExecutionStrategyId
Returns the strategy ID for the last execution, reflecting which operators were selected.Format: "{ruinName}+{insertionName}"
- Specified by:
getLastExecutionStrategyIdin interfaceDynamicStrategyIdProvider- Returns:
- the dynamic strategy ID, e.g., "radial+regretFast"
-
toString
-