Interface SolutionCloner<Solution_>
-
- Type Parameters:
Solution_
- the solution type, the class with thePlanningSolution
annotation
- All Known Subinterfaces:
PlanningSolution.NullSolutionCloner
- All Known Implementing Classes:
FieldAccessingSolutionCloner
public interface SolutionCloner<Solution_>
Clones aPlanningSolution
during planning. Used to remember the state of a goodPlanningSolution
so it can be recalled at a later time when the originalPlanningSolution
is already modified. Also used in population based heuristics to increase or repopulate the population.Planning cloning is hard: avoid doing it yourself.
An implementing class must be thread-safe after initialization.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Solution_
cloneSolution(Solution_ original)
Does a planning clone.
-
-
-
Method Detail
-
cloneSolution
Solution_ cloneSolution(Solution_ original)
Does a planning clone. The returnedPlanningSolution
clone must fulfill these requirements:- The clone must represent the same planning problem.
Usually it reuses the same instances of the problem facts and problem fact collections as the
original
. - The clone must have the same (equal) score as the
original
. - The clone must use different, cloned instances of the entities and entity collections.
If a cloned entity changes, the original must remain unchanged.
If an entity is added or removed in a cloned
PlanningSolution
, the originalPlanningSolution
must remain unchanged.
This method is thread-safe.
- Parameters:
original
- never null, the originalPlanningSolution
- Returns:
- never null, the cloned
PlanningSolution
- The clone must represent the same planning problem.
Usually it reuses the same instances of the problem facts and problem fact collections as the
-
-