ec.multiobjective.nsga2
Class NSGA2MultiObjectiveFitness

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

public class NSGA2MultiObjectiveFitness
extends MultiObjectiveFitness

NSGA2MultiObjectiveFitness is a subclass of MultiObjeciveFitness which adds auxiliary fitness measures (sparsity, rank) largely used by MultiObjectiveStatistics. It also redefines the comparison measures to compare based on rank, and break ties based on sparsity.

See Also:
Serialized Form

Field Summary
static java.lang.String NSGA2_RANK_PREAMBLE
           
static java.lang.String NSGA2_SPARSITY_PREAMBLE
           
 int rank
          Pareto front rank measure (lower ranks are better)
 double sparsity
          Sparsity along front rank measure (higher sparsity is better)
 
Fields inherited from class ec.multiobjective.MultiObjectiveFitness
FITNESS_POSTAMBLE, maximize, maxObjective, minObjective, MULTI_FITNESS_POSTAMBLE, objectives, P_MAXIMIZE, P_MAXOBJECTIVES, P_MINOBJECTIVES, P_NUMOBJECTIVES
 
Fields inherited from class ec.Fitness
FITNESS_PREAMBLE, P_FITNESS, trials
 
Constructor Summary
NSGA2MultiObjectiveFitness()
           
 
Method Summary
 boolean betterThan(Fitness _fitness)
          We specify the tournament selection criteria, Rank (lower values are better) and Sparsity (higher values are better)
 boolean equivalentTo(Fitness _fitness)
          Returns true if I'm equivalent in fitness (neither better nor worse) to _fitness.
 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.
 java.lang.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, 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
clone, defaultBase, fitness, getNumObjectives, getObjective, getObjectives, isIdealFitness, isMaximizing, manhattanObjectiveDistance, paretoDominates, partitionIntoParetoFront, partitionIntoRanks, setObjectives, setup, sumSquaredObjectiveDistance
 
Methods inherited from class ec.Fitness
compareTo, printFitness, printFitness, printFitness, printFitnessForHumans, printFitnessForHumans, setToMeanOf
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NSGA2_RANK_PREAMBLE

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

NSGA2_SPARSITY_PREAMBLE

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

rank

public int rank
Pareto front rank measure (lower ranks are better)


sparsity

public double sparsity
Sparsity along front rank measure (higher sparsity is better)

Constructor Detail

NSGA2MultiObjectiveFitness

public NSGA2MultiObjectiveFitness()
Method Detail

getAuxilliaryFitnessNames

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

equivalentTo

public boolean equivalentTo(Fitness _fitness)
Description copied from class: MultiObjectiveFitness
Returns true if I'm equivalent in fitness (neither better nor worse) to _fitness. The rule I'm using is this: If one of us is better in one or more criteria, and we are equal in the others, then equivalentTo is false. If each of us is better in one or more criteria each, or we are equal in all criteria, then equivalentTo is true. Multiobjective optimization algorithms may choose to override this to do something else.

Overrides:
equivalentTo in class MultiObjectiveFitness

betterThan

public boolean betterThan(Fitness _fitness)
We specify the tournament selection criteria, Rank (lower values are better) and Sparsity (higher values are better)

Overrides:
betterThan in class MultiObjectiveFitness