SolutionType - solution type of the tabu memory, required to extend
Solution; should match with the solution type
of the tabu search that uses this memorypublic class FullTabuMemory<SolutionType extends Solution> extends Object implements TabuMemory<SolutionType>
| Constructor and Description |
|---|
FullTabuMemory(int size)
Creates a full tabu memory with specified size.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear the tabu memory.
|
boolean |
isTabu(Move<? super SolutionType> move,
SolutionType currentSolution)
Verifies whether the given move is tabu by applying it to the current solution and checking if the obtained
neighbour is currently contained in the tabu memory.
|
void |
registerVisitedSolution(SolutionType visitedSolution,
Move<? super SolutionType> appliedMove)
A newly visited solution is registered by storing a deep copy of this solution in the full tabu memory.
|
public FullTabuMemory(int size)
size - memory size (strictly positive)IllegalArgumentException - if size is not strictly positivepublic boolean isTabu(Move<? super SolutionType> move, SolutionType currentSolution)
isTabu in interface TabuMemory<SolutionType extends Solution>move - move to be applied to the current solutioncurrentSolution - current solutiontrue if the neighbour obtained by applying the given move to the current solution is
currently already contained in the tabu memorypublic void registerVisitedSolution(SolutionType visitedSolution, Move<? super SolutionType> appliedMove)
registerVisitedSolution in interface TabuMemory<SolutionType extends Solution>visitedSolution - newly visited solution (copied to memory)appliedMove - applied move (not used here, allowed to be null)public void clear()
clear in interface TabuMemory<SolutionType extends Solution>Copyright © 2016. All rights reserved.