es.udc.gii.common.eaf.algorithm.fitness.comparator
Class LessMOPTournamentComparator<T extends NSGA2Individual>

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.LessMOPTournamentComparator<T>
All Implemented Interfaces:
java.util.Comparator<T>

public class LessMOPTournamentComparator<T extends NSGA2Individual>
extends FitnessComparator<T>

This class implements a comparator for comparing two instances i1 and i2 of Individual based on their dominance and crowding distance.

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

Constructor Summary
LessMOPTournamentComparator()
          Creates a new instance of MOPTournamentComparator
 
Method Summary
 int compare(T o1, T o2)
          Compares two individuals based on their dominance and crowding distance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

LessMOPTournamentComparator

public LessMOPTournamentComparator()
Creates a new instance of MOPTournamentComparator

Method Detail

compare

public int compare(T o1,
                   T o2)
Compares two individuals based on their dominance and crowding distance. This method relies on MOUtil.checkDominance(es.udc.gii.common.eaf.algorithm.population.Individual, es.udc.gii.common.eaf.algorithm.population.Individual), so check this method first. *

Specified by:
compare in interface java.util.Comparator<T extends NSGA2Individual>
Specified by:
compare in class FitnessComparator<T extends NSGA2Individual>
Parameters:
o1 - First individual to compare.
o2 - Second individual to compare.
Returns:
If o1 dominates o2 returns -1, else if o2 dominates o1 returns 1. If o1 non-dominates o2, if o1 has more crowding distance than o2 returns -1, if o2 has more crowding distance than o2 returns 1, else if the two individuals has the same crowding distance returns 1 with a probability of 0.5 and -1 with the same probability.
See Also:
MOUtil.checkDominance(es.udc.gii.common.eaf.algorithm.population.Individual, es.udc.gii.common.eaf.algorithm.population.Individual)