eaLib API Docs
Last Modified : January 7 2002

mss.ea.eval
Class DefaultFitness

java.lang.Object
  |
  +--mss.ea.eval.DefaultFitness
All Implemented Interfaces:
java.lang.Comparable, Fitness, java.io.Serializable

public class DefaultFitness
extends java.lang.Object
implements Fitness

Base class for fitness values. The fitness of an individual is represented by a float number. A bigger float number is a better fitness. The smallest possible fitness should be 0.0 (but need not).

Since:
0.1
Version:
$Revision: 1.3 $ $Date: 2001/12/10 13:01:18 $
Author:
Andreas Rummler
See Also:
Serialized Form

Field Summary
protected  float fitness
          Float field, holding the current fitness value.
 
Fields inherited from interface mss.ea.core.Fitness
serialVersionUID
 
Constructor Summary
DefaultFitness()
          Constructor.
DefaultFitness(float value)
          Constructor with float value.
DefaultFitness(java.lang.Float value)
          Constructor with Float object.
 
Method Summary
 int compareTo(java.lang.Object o)
          Comparison of two fitness values.
 float getValue()
          Deprecated. replaced by value()
 boolean isBetter(Fitness fn)
          Test, if fitness is better than other fitness.
 boolean isEqual(Fitness fn)
          Test, if fitness equals with other fitness.
 boolean isWorse(Fitness fn)
          Test, if fitness is worse than other fitness.
 void setValue(float value)
          Sets the fitness value.
 java.lang.String toString()
          String representation of fitness value.
 float value()
          Gets the fitness value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fitness

protected float fitness
Float field, holding the current fitness value.
Constructor Detail

DefaultFitness

public DefaultFitness()
Constructor. This will set the fitness to 0.0.

DefaultFitness

public DefaultFitness(float value)
Constructor with float value.
Parameters:
value - fitness value

DefaultFitness

public DefaultFitness(java.lang.Float value)
Constructor with Float object.
Parameters:
value - fitness value
Method Detail

setValue

public void setValue(float value)
Sets the fitness value.
Specified by:
setValue in interface Fitness
Parameters:
value - new fitness value

getValue

public float getValue()
Deprecated. replaced by value()

Gets the fitness value.
Specified by:
getValue in interface Fitness
Returns:
current fitness value

value

public float value()
Gets the fitness value.
Specified by:
value in interface Fitness
Returns:
current fitness value

isBetter

public boolean isBetter(Fitness fn)
Test, if fitness is better than other fitness.
Specified by:
isBetter in interface Fitness
Parameters:
fn - fitness, to be compared with
Returns:
result of test

isWorse

public boolean isWorse(Fitness fn)
Test, if fitness is worse than other fitness.
Specified by:
isWorse in interface Fitness
Parameters:
fn - other fitness, to be compared with
Returns:
result of test

isEqual

public boolean isEqual(Fitness fn)
Test, if fitness equals with other fitness.
Specified by:
isEqual in interface Fitness
Parameters:
fn - other fitness, to be compared with
Returns:
result of test

compareTo

public int compareTo(java.lang.Object o)
Comparison of two fitness values. Necessary to implement the interface Comparable.
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - other fitness, to be compared with
Returns:
result of comparison

toString

public java.lang.String toString()
String representation of fitness value.
Overrides:
toString in class java.lang.Object
Returns:
string representation

eaLib API Docs
Last Modified : January 7 2002

Copyright © 2000-2001 Technical University of Ilmenau, Department ESS