DistributedEvolutionaryAlgorithmsFramework
Class FitnessFunction

java.lang.Object
  extended by DistributedEvolutionaryAlgorithmsFramework.FitnessFunction

public abstract class FitnessFunction
extends java.lang.Object

Abstract class for user-defined fitness function


Field Summary
protected  double[] maxRestrictions
          Array of upper restrictions for all dimensions
protected  double[] minRestrictions
          Array of lower restrictions for all dimensions
protected  int specimenLength
          Length of genotype / number of dimensions.
 
Constructor Summary
FitnessFunction(int length)
          Contructor, takes length of genotype/number of dimensions and initializes restriction arrays
 
Method Summary
abstract  double evaluate(double[] genotype)
           
abstract  double evaluate(org.apache.hadoop.io.DoubleWritable[] s)
           
 int getDimensions()
           
 double getMaxRestriction(int i)
           
 double getMinRestriction(int i)
           
 double getRandomValueInDomains(int index)
           
 void setMaxRestriction(double[] m)
          Set maximal constraints for each dimension of specimen
 void setMinRestriction(double[] m)
          Set minimal constraints for each dimension of specimen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

specimenLength

protected int specimenLength
Length of genotype / number of dimensions.


minRestrictions

protected double[] minRestrictions
Array of lower restrictions for all dimensions


maxRestrictions

protected double[] maxRestrictions
Array of upper restrictions for all dimensions

Constructor Detail

FitnessFunction

public FitnessFunction(int length)
Contructor, takes length of genotype/number of dimensions and initializes restriction arrays

Parameters:
length - Length of genotype / number of dimensions.
Method Detail

evaluate

public abstract double evaluate(org.apache.hadoop.io.DoubleWritable[] s)
Parameters:
s - Array of DoubleWritables representing genotype
Returns:
value of fitness function for given genotype

evaluate

public abstract double evaluate(double[] genotype)
Parameters:
genotype - Array of doubles representing genotype
Returns:
value of fitness function for given genotype

getMinRestriction

public double getMinRestriction(int i)
Parameters:
i - Number of requested dimension
Returns:
lower restriction for requested dimension

getMaxRestriction

public double getMaxRestriction(int i)
Parameters:
i - Number of requested dimension
Returns:
upper restriction for requested dimension

getDimensions

public int getDimensions()
Returns:
genotype length / number of dimensions

setMinRestriction

public void setMinRestriction(double[] m)
Set minimal constraints for each dimension of specimen

Parameters:
m - Constraints

setMaxRestriction

public void setMaxRestriction(double[] m)
Set maximal constraints for each dimension of specimen

Parameters:
m - Constraints

getRandomValueInDomains

public double getRandomValueInDomains(int index)
Parameters:
index - dimension number
Returns:
random value between restrictions