org.dbe.eve.opt.alg.ga
Class FitnessComparer

java.lang.Object
  extended by org.dbe.eve.opt.alg.ga.FitnessComparer
All Implemented Interfaces:
java.util.Comparator

public class FitnessComparer
extends java.lang.Object
implements java.util.Comparator

Author:
tkurz Comparator for comparing Fitness of Individuums and Abstract Services as well as asigning the fitness values to the fitness attribute First parameter for the comparison should be the Request and the second the Object to compare

Field Summary
(package private) static org.apache.log4j.Logger logger
           
 
Constructor Summary
FitnessComparer()
           
 
Method Summary
static double calculateFitness(java.util.Vector reqAttributes, java.util.Vector toCompAttributes)
           
 int compare(java.lang.Object o1, java.lang.Object o2)
           
 
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
 

Field Detail

logger

static org.apache.log4j.Logger logger
Constructor Detail

FitnessComparer

public FitnessComparer()
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Specified by:
compare in interface java.util.Comparator

calculateFitness

public static double calculateFitness(java.util.Vector reqAttributes,
                                      java.util.Vector toCompAttributes)
Parameters:
requestedAttributes -
toCompareAttributes -
Returns:
fitness Compares two Vectors of Attributes. If the first parameter (requestedAttributes) is of type DemandedAttribute the fitness is calculated as the sum of the weights of the matching attributes. If both parameters are Attributes the fitness is the sum of the matching attribtues