org.drools.planner.api.domain.solution.cloner
Interface SolutionCloner<SolutionG extends Solution>
- All Known Subinterfaces:
- PlanningSolution.NullSolutionCloner
- All Known Implementing Classes:
- FieldAccessingSolutionCloner, PlanningCloneableSolutionCloner
public interface SolutionCloner<SolutionG extends Solution>
Clones a Solution
during planning.
Used to remember the state of a good Solution
so it can be recalled at a later then
when the original Solution
is already modified.
Also used in population based heuristics to increase or repopulate the population.
Planning cloning is hard: avoid doing it yourself.
cloneSolution
SolutionG cloneSolution(SolutionG original)
- Does a planning clone. The returned
Solution
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 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
Solution
,
the original Solution
must remain unchanged.
Note that a class might support more than 1 clone method: planning clone is just one of them.
- Parameters:
original
- never null, the original Solution
- Returns:
- never null, the cloned
Solution
Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.