Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.encog.ml.genetic.genome
Class GenomeComparator

    java.lang.Object
      org.encog.ml.genetic.genome.GenomeComparator

All Implemented Interfaces:
  Comparator<Genome>

    public class GenomeComparator

extends Object
implements Comparator<Genome>

Used to compare two genomes, a score object is used.

Constructor Summary
`GenomeComparator(CalculateGenomeScore theCalculateScore)` Construct the genome comparator.

Method Summary
`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.
`double` | `bestScore(double d1, double d2)` Determine the best score from two scores, uses the "should minimize" property of the score function.
`int` | `compare(Genome genome1, Genome genome2)` Compare two genomes.
`CalculateGenomeScore` | `getCalculateScore()`
`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 java.util.Comparator
`equals`

Constructor Detail

### GenomeComparator

    public GenomeComparator(CalculateGenomeScore theCalculateScore)

  Construct the genome comparator.

  Parameters:
    `theCalculateScore` - The score calculation object to use.

Method Detail

### applyBonus

    public final 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.

  Parameters:
    `value` - The current value.
    `bonus` - The bonus.
  Returns:
    The resulting value.

### applyPenalty

    public final 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.

  Parameters:
    `value` - The current value.
    `bonus` - The penalty.
  Returns:
    The resulting value.

### bestScore

    public final double bestScore(double d1,
                                  double d2)

  Determine the best score from two scores, uses the "should minimize" property of the score function.

  Parameters:
    `d1` - The first score.
    `d2` - The second score.
  Returns:
    The best score.

### compare

    public final int compare(Genome genome1,
                             Genome genome2)

  Compare two genomes.

  Specified by:
    `compare` in interface `Comparator<Genome>`
  Parameters:
    `genome1` - The first genome.
    `genome2` - The second genome.
  Returns:
    Zero if equal, or less than or greater than zero to indicate order.

### getCalculateScore

    public final CalculateGenomeScore getCalculateScore()

  Returns:
    The score calculation object.

### isBetterThan

    public final boolean isBetterThan(double d1,
                                      double d2)

  Determine if one score is better than the other.

  Parameters:
    `d1` - The first score to compare.
    `d2` - The second score to compare.
  Returns:
    True if d1 is better than d2.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2011. All Rights Reserved.