org.encog.ml.ea.sort
Class AbstractGenomeComparator
- java.lang.Object
-
- org.encog.ml.ea.sort.AbstractGenomeComparator
-
- All Implemented Interfaces:
- java.io.Serializable, java.util.Comparator<Genome>, GenomeComparator
- Direct Known Subclasses:
- MaximizeAdjustedScoreComp, MaximizeScoreComp, MinimizeAdjustedScoreComp, MinimizeScoreComp
public abstract class AbstractGenomeComparator extends java.lang.Object implements GenomeComparator, java.io.Serializable
Provides base functionality for comparing genomes. Specifically the ability to add bonuses and penalties.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description AbstractGenomeComparator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubleapplyBonus(double value, double bonus)Apply a bonus, this is a simple percent that is applied in the direction specified by the "should minimize" property of the score function.doubleapplyPenalty(double value, double bonus)Apply a penalty, this is a simple percent that is applied in the direction specified by the "should minimize" property of the score function.booleanisBetterThan(double d1, double d2)Determine if one score is better than the other.-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.encog.ml.ea.sort.GenomeComparator
isBetterThan, shouldMinimize
-
Methods inherited from interface java.util.Comparator
compare, comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
applyBonus
public double applyBonus(double value, double bonus)Apply a bonus, this is a simple percent that is applied in the direction specified by the "should minimize" property of the score function.- Specified by:
applyBonusin interfaceGenomeComparator- Parameters:
value- The current value.bonus- The bonus.- Returns:
- The resulting value.
-
applyPenalty
public double applyPenalty(double value, double bonus)Apply a penalty, this is a simple percent that is applied in the direction specified by the "should minimize" property of the score function.- Specified by:
applyPenaltyin interfaceGenomeComparator- Parameters:
value- The current value.bonus- The penalty.- Returns:
- The resulting value.
-
isBetterThan
public boolean isBetterThan(double d1, double d2)Determine if one score is better than the other.- Specified by:
isBetterThanin interfaceGenomeComparator- Parameters:
d1- The first score to compare.d2- The second score to compare.- Returns:
- True if d1 is better than d2.
-
-
DMelt 3.0 © DataMelt by jWork.ORG