|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Fitness
This interface is an abstraction for the fitness of a solution to an optimisation problem.
The actual fitness value (as determined by the OptimisationProblem in question)
can be obtained by calling getValue() while fitnesses can be compared using the
standard Java Comparable interface.
Fitness a = ...;
Fitness b = ...;
int result = a.compareTo(b);
if (result > 0) {
// a is a superior fitness to b
}
else if (result < 0) {
// b is a superior fitness to a
}
else {
// a and b are equally fit
}
| Method Summary | |
|---|---|
int |
compareTo(Fitness o)
Compare the current fitness instance to the provided instance. |
Fitness |
getClone()
Create a cloned copy of the current object and return it. |
Double |
getValue()
Returns the underlying fitness value. |
Fitness |
newInstance(Double value)
Creation method that maintains Fitness object immutability by returning a new instance of the current class type. |
| Methods inherited from interface net.sourceforge.cilib.type.types.Type |
|---|
equals, hashCode |
| Method Detail |
|---|
Fitness getClone()
getClone in interface CloneablegetClone in interface TypeObject.clone()Double getValue()
int compareTo(Fitness o)
compareTo in interface Comparable<Fitness>o - The fitness to be compared.
ComparableFitness newInstance(Double value)
value - The desired value of the Fitness object.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||