public final class LabsEvaluatorWithCache extends LabsEvaluator
Labs Evaluator class with cache.
Think at least twice before deciding to use it. Since LABS problem has 2^L different sequence representations, the cache grows quickly consuming enormous amount of memory. For instance, a single cache entry for LABS of a length 50 takes 328 bytes of RAM, meaning that 1 million entries will take more than 300 MB.
Also, the bigger the problem size is, the less probable is that the cache will prove to be useful. For instance, when LABS of a length 50 was computed for 300 seconds with 10 million cache capacity set, the total count of successful cache queries was 0!
Summing up, treat this class rather like an experiment than something useful at all...
Modifier and Type | Field and Description |
---|---|
private Cache<java.util.List<java.lang.Boolean>,java.lang.Double> |
evaluationMap |
counter
Constructor and Description |
---|
LabsEvaluatorWithCache(EvaluatorCounter counter,
long cacheCapacity) |
Modifier and Type | Method and Description |
---|---|
double |
evaluate(LabsSolution sequence) |
meritFactorOf
private final Cache<java.util.List<java.lang.Boolean>,java.lang.Double> evaluationMap
public LabsEvaluatorWithCache(EvaluatorCounter counter, long cacheCapacity)
public double evaluate(LabsSolution sequence)
evaluate
in interface Evaluator<LabsSolution>
evaluate
in class LabsEvaluator