Package ec.multiobjective.spea2

# Class SPEA2MultiObjectiveFitness

java.lang.Object
ec.Fitness
ec.multiobjective.MultiObjectiveFitness
ec.multiobjective.spea2.SPEA2MultiObjectiveFitness

All Implemented Interfaces:
  `Prototype`, `Setup`, `Serializable`, `Cloneable`, `Comparable<Object>`

public class SPEA2MultiObjectiveFitness extends MultiObjectiveFitness
SPEA2MultiObjectiveFitness is a subclass of MultiObjectiveFitness which adds three auxiliary fitness measures used in SPEA2: strength S(i), kthNNDistance D(i), and a final fitness value R(i) + D(i). Note that so-called "raw fitness" (what Sean calls "Wimpiness" in Essentials of Metaheuristics) is not retained.

The fitness comparison operators solely use the 'fitness' value R(i) + D(i).

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `double`
  `fitness`
  Final SPEA2 fitness.
  `double`
  `kthNNDistance`
  SPEA2 NN distance
  `static final String`
  `SPEA2_DISTANCE_PREAMBLE`
  `static final String`
  `SPEA2_FITNESS_PREAMBLE`
  `static final String`
  `SPEA2_STRENGTH_PREAMBLE`
  `double`
  `strength`
  SPEA2 strength (# of nodes it dominates)

  ### Fields inherited from class ec.multiobjective.MultiObjectiveFitness

  `FITNESS_POSTAMBLE, maximize, maxObjective, minObjective, MULTI_FITNESS_POSTAMBLE, objectives, P_MAXIMIZE, P_MAXOBJECTIVE, P_MINOBJECTIVE, P_NUMOBJECTIVES`

  ### Fields inherited from class ec.Fitness

  `context, FITNESS_PREAMBLE, P_FITNESS, trials`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SPEA2MultiObjectiveFitness()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `betterThan(Fitness _fitness)`
  The selection criteria in SPEA2 uses the computed fitness, and not pareto dominance.
  `boolean`
  `equivalentTo(Fitness _fitness)`
  The selection criteria in SPEA2 uses the computed fitness, and not pareto dominance.
  `String`
  `fitnessToString()`
  Print to a string the fitness in a fashion intended to be parsed in again via readFitness(...).
  `String`
  `fitnessToStringForHumans()`
  Print to a string the fitness in a fashion readable by humans, and not intended to be parsed in again.
  `String[]`
  `getAuxilliaryFitnessNames()`
  Returns auxilliary fitness value names to be printed by the statistics object.
  `double[]`
  `getAuxilliaryFitnessValues()`
  Returns auxilliary fitness values to be printed by the statistics object.
  `void`
  `readFitness(EvolutionState state, DataInput dataInput)`
  Reads the binary form of an individual from a DataInput.
  `void`
  `readFitness(EvolutionState state, LineNumberReader reader)`
  Reads in the fitness from a form outputted by fitnessToString() and thus printFitnessForHumans(...).
  `void`
  `writeFitness(EvolutionState state, DataOutput dataOutput)`
  Writes the binary form of an individual out to a DataOutput.

  ### Methods inherited from class ec.multiobjective.MultiObjectiveFitness

  `clone, defaultBase, fitness, getNumObjectives, getObjective, getObjectives, getRankings, getSortedParetoFront, isIdealFitness, isMaximizing, isMaximizing, manhattanObjectiveDistance, paretoDominates, partitionIntoParetoFront, partitionIntoRanks, setObjectives, setToBestOf, setToMeanOf, setToMedianOf, setup, sumSquaredObjectiveDistance`

  ### Methods inherited from class ec.Fitness

  `compareTo, contextIsBetterThan, getContext, merge, printFitness, printFitness, printFitness, printFitnessForHumans, printFitnessForHumans, readTrials, setContext, setContext, writeTrials`

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

  `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### SPEA2_FITNESS_PREAMBLE

    public static final String SPEA2_FITNESS_PREAMBLE
    See Also:
      - Constant Field Values

  - ### SPEA2_STRENGTH_PREAMBLE

    public static final String SPEA2_STRENGTH_PREAMBLE
    See Also:
      - Constant Field Values

  - ### SPEA2_DISTANCE_PREAMBLE

    public static final String SPEA2_DISTANCE_PREAMBLE
    See Also:
      - Constant Field Values

  - ### strength

    public double strength
    SPEA2 strength (# of nodes it dominates)

  - ### kthNNDistance

    public double kthNNDistance
    SPEA2 NN distance

  - ### fitness

    public double fitness
    Final SPEA2 fitness. Equals the raw fitness R(i) plus the kthNNDistance D(i).

- ## Constructor Details

  - ### SPEA2MultiObjectiveFitness

    public SPEA2MultiObjectiveFitness()

- ## Method Details

  - ### getAuxilliaryFitnessNames

    public String[] getAuxilliaryFitnessNames()
    Description copied from class: `MultiObjectiveFitness`
    Returns auxilliary fitness value names to be printed by the statistics object. By default, an empty array is returned, but various algorithms may override this to provide additional columns.
    Overrides:
      `getAuxilliaryFitnessNames` in class `MultiObjectiveFitness`

  - ### getAuxilliaryFitnessValues

    public double[] getAuxilliaryFitnessValues()
    Description copied from class: `MultiObjectiveFitness`
    Returns auxilliary fitness values to be printed by the statistics object. By default, an empty array is returned, but various algorithms may override this to provide additional columns.
    Overrides:
      `getAuxilliaryFitnessValues` in class `MultiObjectiveFitness`

  - ### fitnessToString

    public String fitnessToString()
    Description copied from class: `Fitness`
    Print to a string the fitness in a fashion intended to be parsed in again via readFitness(...). The fitness and evaluated flag should not be included. The default form simply calls toString(), which is almost certainly wrong, and you'll probably want to override this to something else. When overriding, you may wish to check to see if the 'trials' variable is non-null, and issue an error if so.
    Overrides:
      `fitnessToString` in class `MultiObjectiveFitness`

  - ### fitnessToStringForHumans

    public String fitnessToStringForHumans()
    Description copied from class: `Fitness`
    Print to a string the fitness in a fashion readable by humans, and not intended to be parsed in again. The default form simply calls toString(), but you'll probably want to override this to something else.
    Overrides:
      `fitnessToStringForHumans` in class `MultiObjectiveFitness`

  - ### readFitness

    public void readFitness(EvolutionState state, LineNumberReader reader) throws IOException
    Description copied from class: `Fitness`
    Reads in the fitness from a form outputted by fitnessToString() and thus printFitnessForHumans(...). The default version of this method exits the program with an "unimplemented" error.
    Overrides:
      `readFitness` in class `MultiObjectiveFitness`
    Throws:
      `IOException`

  - ### writeFitness

    public void writeFitness(EvolutionState state, DataOutput dataOutput) throws IOException
    Description copied from class: `Fitness`
    Writes the binary form of an individual out to a DataOutput. This is not for serialization: the object should only write out the data relevant to the object sufficient to rebuild it from a DataInput. The default version exits the program with an "unimplemented" error; you should override this, and be certain to also write the 'trials' variable as well.
    Overrides:
      `writeFitness` in class `MultiObjectiveFitness`
    Throws:
      `IOException`

  - ### readFitness

    public void readFitness(EvolutionState state, DataInput dataInput) throws IOException
    Description copied from class: `Fitness`
    Reads the binary form of an individual from a DataInput. This is not for serialization: the object should only read in the data written out via printIndividual(state,dataInput). The default version exits the program with an "unimplemented" error; you should override this, and be certain to also write the 'trials' variable as well.
    Overrides:
      `readFitness` in class `MultiObjectiveFitness`
    Throws:
      `IOException`

  - ### equivalentTo

    public boolean equivalentTo(Fitness _fitness)
    The selection criteria in SPEA2 uses the computed fitness, and not pareto dominance.
    Overrides:
      `equivalentTo` in class `MultiObjectiveFitness`

  - ### betterThan

    public boolean betterThan(Fitness _fitness)
    The selection criteria in SPEA2 uses the computed fitness, and not pareto dominance.
    Overrides:
      `betterThan` in class `MultiObjectiveFitness`