ec.multiobjective.spea2
Class SPEA2MultiObjectiveFitness

java.lang.Object
  extended by ec.Fitness
      extended by ec.multiobjective.MultiObjectiveFitness
          extended by ec.multiobjective.spea2.SPEA2MultiObjectiveFitness
All Implemented Interfaces:
Prototype, Setup, java.io.Serializable, java.lang.Cloneable

public class SPEA2MultiObjectiveFitness
extends MultiObjectiveFitness

SPEA2MultiObjectiveFitness is a subclass of Fitness which implements basic multiobjective fitness functions along with support for the ECJ SPEA2 (Strength Pareto Evolutionary Algorithm) extensions.

The object contains two items: an array of floating point values representing the various multiple fitnesses (ranging from 0.0 (worst) to infinity (best)), and a single SPEA2 fitness value which represents the individual's overall fitness ( a function of the number of individuals it dominates and it's raw score where 0.0 is the best).

Parameters

base.numobjectives
(else)multi.numobjectives
int >= 1
(the number of fitnesses in the multifitness array)

Version:
1.0
Author:
Robert Hubley (based on MultiObjectiveFitness by Sean Luke)
See Also:
Serialized Form

Field Summary
static java.lang.String SPEA2FIT_PREAMBLE
           
 double SPEA2Fitness
          SPEA2 overall fitness
 double SPEA2kthNNDistance
          SPEA2 NN distance
 double SPEA2RawFitness
          SPEA2 RAW fitness
 double SPEA2Strength
          SPEA2 strength (# of nodes it dominates)
 
Fields inherited from class ec.multiobjective.MultiObjectiveFitness
FITNESS_POSTAMBLE, multifitness, P_NUMFITNESSES
 
Fields inherited from class ec.Fitness
FITNESS_PREAMBLE, P_FITNESS
 
Constructor Summary
SPEA2MultiObjectiveFitness()
           
 
Method Summary
 float calcDistance(SPEA2MultiObjectiveFitness otherFit)
          Returns the sum of the squared differences between the vector fitness values.
 java.lang.String fitnessToString()
          Print to a string the fitness in a fashion intended to be parsed in again via readFitness(...).
 java.lang.String fitnessToStringForHumans()
          Print to a string the fitness in a fashion readable by humans, and not intended to be parsed in again.
 void readFitness(EvolutionState state, java.io.DataInput dataInput)
          Reads the binary form of an individual from a DataInput.
 void readFitness(EvolutionState state, java.io.LineNumberReader reader)
          Reads in the fitness from a form outputted by fitnessToString() and thus printFitnessForHumans(...).
 void writeFitness(EvolutionState state, java.io.DataOutput dataOutput)
          Writes the binary form of an individual out to a DataOutput.
 
Methods inherited from class ec.multiobjective.MultiObjectiveFitness
betterThan, clone, defaultBase, equivalentTo, fitness, isIdealFitness, setup
 
Methods inherited from class ec.Fitness
printFitness, printFitness, printFitnessForHumans
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPEA2FIT_PREAMBLE

public static final java.lang.String SPEA2FIT_PREAMBLE
See Also:
Constant Field Values

SPEA2Fitness

public double SPEA2Fitness
SPEA2 overall fitness


SPEA2Strength

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


SPEA2RawFitness

public double SPEA2RawFitness
SPEA2 RAW fitness


SPEA2kthNNDistance

public double SPEA2kthNNDistance
SPEA2 NN distance

Constructor Detail

SPEA2MultiObjectiveFitness

public SPEA2MultiObjectiveFitness()
Method Detail

calcDistance

public float calcDistance(SPEA2MultiObjectiveFitness otherFit)
Returns the sum of the squared differences between the vector fitness values.


fitnessToString

public java.lang.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.

Overrides:
fitnessToString in class MultiObjectiveFitness

fitnessToStringForHumans

public java.lang.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,
                        java.io.LineNumberReader reader)
                 throws java.io.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:
java.io.IOException

writeFitness

public void writeFitness(EvolutionState state,
                         java.io.DataOutput dataOutput)
                  throws java.io.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.

Overrides:
writeFitness in class MultiObjectiveFitness
Throws:
java.io.IOException

readFitness

public void readFitness(EvolutionState state,
                        java.io.DataInput dataInput)
                 throws java.io.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.

Overrides:
readFitness in class MultiObjectiveFitness
Throws:
java.io.IOException