org.encog.ml.ea.sort

## Class AbstractGenomeComparator

- java.lang.Object
- - org.encog.ml.ea.sort.AbstractGenomeComparator

- All Implemented Interfaces:
    Serializable, Comparator<Genome>, GenomeComparator
  Direct Known Subclasses:
    MaximizeAdjustedScoreComp, MaximizeScoreComp, MinimizeAdjustedScoreComp, MinimizeScoreComp

      public abstract class AbstractGenomeComparator
      extends Object
      implements GenomeComparator, 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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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.
    `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.
    `boolean` | `isBetterThan(double d1, double d2)` Determine if one score is better than the other.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, 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, equals`

- - ### Constructor Detail

    - #### AbstractGenomeComparator

          public AbstractGenomeComparator()

  - ### 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:
        `applyBonus` in interface `GenomeComparator`
      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:
        `applyPenalty` in interface `GenomeComparator`
      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:
        `isBetterThan` in interface `GenomeComparator`
      Parameters:
        `d1` - The first score to compare.
        `d2` - The second score to compare.
      Returns:
        True if d1 is better than d2.

Copyright © 2014. All Rights Reserved.