es.udc.gii.common.eaf.algorithm.fitness.comparator
Class MinimizingFitnessComparator<T extends Individual>

java.lang.Object
  extended by es.udc.gii.common.eaf.algorithm.fitness.comparator.FitnessComparator<T>
      extended by es.udc.gii.common.eaf.algorithm.fitness.comparator.MinimizingFitnessComparator<T>
All Implemented Interfaces:
java.util.Comparator<T>

public class MinimizingFitnessComparator<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 minimizing problems.

Since:
1.0
Author:
Grupo Integrado de IngenierĂ­a (www.gii.udc.es)

Constructor Summary
MinimizingFitnessComparator()
           
 
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
 

Constructor Detail

MinimizingFitnessComparator

public MinimizingFitnessComparator()
Method Detail

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 lower than the fitness value of o2 returns -1. If the fitness value of o2 is lower 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