public final class LabsCrossStepSawSearch extends AbstractLabsSawSearch
This is a variant of SelfAvoidingWalk improvement operator for LABS problem, which uses a single walkList shared with all agents in the population. Each iteration adds an entry to the list, which can influence improvement computation for future agents, by eliminating repetitions of already processed solutions.
The implementation uses a limited size cache mechanism with entry eviction. Thus, it has a high memory usage. For LABS of length 201, a single cache entry takes around 1000 bytes of memory. If you intent to use this improvement operator in AgE computation, make sure that cacheSize is set to the value that will not cause exceeding current Java maximum heapsize value.
Modifier and Type | Field and Description |
---|---|
private Cache<java.util.List<java.lang.Boolean>,java.lang.Double> |
walkList |
evaluator
Constructor and Description |
---|
LabsCrossStepSawSearch(LabsEvaluator evaluator,
int iterations,
long cacheSize,
boolean useFastFlipAlgorithm) |
Modifier and Type | Method and Description |
---|---|
protected void |
addToWalkList(LabsSolution solution) |
protected void |
clearWalkList() |
protected boolean |
isInWalkList(LabsSolution solution) |
improve
getFlippedSolution
private final Cache<java.util.List<java.lang.Boolean>,java.lang.Double> walkList
public LabsCrossStepSawSearch(LabsEvaluator evaluator, int iterations, long cacheSize, boolean useFastFlipAlgorithm)
protected void clearWalkList()
clearWalkList
in class AbstractLabsSawSearch
protected void addToWalkList(LabsSolution solution)
addToWalkList
in class AbstractLabsSawSearch
protected boolean isInWalkList(LabsSolution solution)
isInWalkList
in class AbstractLabsSawSearch