es.udc.gii.common.eaf.algorithm.fitness.comparator
Class MaximizingFitnessComparator<T extends Individual>
java.lang.Object
es.udc.gii.common.eaf.algorithm.fitness.comparator.FitnessComparator<T>
es.udc.gii.common.eaf.algorithm.fitness.comparator.MaximizingFitnessComparator<T>
- All Implemented Interfaces:
- java.util.Comparator<T>
public class MaximizingFitnessComparator<T extends Individual>
- extends FitnessComparator<T>
This class implements a comparator for comparing two instances i1 and i2 of
Individual based on their fitness value. This class is used in maximizing problems.
- Since:
- 1.0
- Author:
- Grupo Integrado de IngenierĂa (www.gii.udc.es)
Method Summary |
int |
compare(T o1,
T o2)
Compares two individuals based on their fitness value. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Comparator |
equals |
MaximizingFitnessComparator
public MaximizingFitnessComparator()
compare
public int compare(T o1,
T o2)
- Compares two individuals based on their fitness value.
- Specified by:
compare
in interface java.util.Comparator<T extends Individual>
- Specified by:
compare
in class FitnessComparator<T extends Individual>
- Parameters:
o1
- First individual to compare.o2
- Second individual to compare.
- Returns:
- If the fitness value of o1 is greater than the fitness value of o2 returns -1. If
the fitness value of o2 is greater than the fitness value of o1 returns 1. If the fitness value
of o1 is equals than the fitness value of o2 returns 0.
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object