Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)

org.uncommons.watchmaker.framework
Class EvaluatedCandidate<T>

java.lang.Object
  extended by org.uncommons.watchmaker.framework.EvaluatedCandidate<T>
Type Parameters:
T - The candidate type.
All Implemented Interfaces:
Comparable<EvaluatedCandidate<T>>

public final class EvaluatedCandidate<T>
extends Object
implements Comparable<EvaluatedCandidate<T>>

Immutable wrapper class for associating a candidate solution with its fitness score.

Author:
Daniel Dyer.

Constructor Summary
EvaluatedCandidate(T candidate, double fitness)
           
 
Method Summary
 int compareTo(EvaluatedCandidate<T> evaluatedCandidate)
          Compares this candidate's fitness score with that of the specified candidate.
 boolean equals(Object o)
          Over-ridden to be consistent with compareTo(EvaluatedCandidate).
 T getCandidate()
           
 double getFitness()
           
 int hashCode()
          Over-ridden to be consistent with equals(Object).
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EvaluatedCandidate

public EvaluatedCandidate(T candidate,
                          double fitness)
Parameters:
candidate - The evolved candidate.
fitness - The candidates fitness score.
Method Detail

getCandidate

public T getCandidate()
Returns:
The evolved candidate solution.

getFitness

public double getFitness()
Returns:
The fitness score for the associated candidate.

compareTo

public int compareTo(EvaluatedCandidate<T> evaluatedCandidate)
Compares this candidate's fitness score with that of the specified candidate.

Specified by:
compareTo in interface Comparable<EvaluatedCandidate<T>>
Parameters:
evaluatedCandidate - The candidate to compare scores with.
Returns:
-1, 0 or 1 if this candidate's score is less than, equal to, or greater than that of the specified candidate. The comparison applies to the raw numerical score and does not consider whether that score is a natural fitness score or not.

equals

public boolean equals(Object o)
Over-ridden to be consistent with compareTo(EvaluatedCandidate).

Overrides:
equals in class Object
Parameters:
o - The object to check for equality.
Returns:
true If this object is logically equivalent to {code o}.

hashCode

public int hashCode()
Over-ridden to be consistent with equals(Object).

Overrides:
hashCode in class Object
Returns:
This object's hash code.

Watchmaker Framework for Evolutionary Computation API
(Version 0.7.1)