org.jgap.impl.fitness
Class TruthTableFitnessFunction
- java.lang.Object
-
- org.jgap.FitnessFunction
-
- org.jgap.impl.fitness.TruthTableFitnessFunction
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, ICloneable
public abstract class TruthTableFitnessFunction extends FitnessFunction
Fitness Function relying on a truth table. To use this class, just implement a subclass of it, register the current truth table and implement the evaluate method in a way that you can call calcFitness with the required (parameter (given values: encoded with the chromosome). If the truth table is dynamic just register it in evaluate, otherwise do it after construction of this fitness function.- Since:
- 2.4
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intMAX_FITNESSstatic intWORST-
Fields inherited from class org.jgap.FitnessFunction
DELTA, NO_FITNESS_VALUE
-
-
Constructor Summary
Constructors Constructor and Description TruthTableFitnessFunction()Only use for dynamic instantiation as configuration retrieved from static setting.TruthTableFitnessFunction(Configuration a_conf)Constructor without registering a truth table.TruthTableFitnessFunction(Configuration a_conf, java.util.Map a_truthTable)Constructor for registering a truth table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecalcFitness(java.util.Map a_actualInputOutput)Fitness value calculation for a given table of input/output tupels and a truth-table (also given as list of input/output tupels)ConfigurationgetConfiguration()java.util.MapgetTruthTable()voidsetTruthTable(java.util.Map a_truthTable)-
Methods inherited from class org.jgap.FitnessFunction
clone, getFitnessValue, getLastComputedFitnessValue
-
-
-
-
Field Detail
-
MAX_FITNESS
public static final int MAX_FITNESS
- See Also:
- Constant Field Values
-
WORST
public static final int WORST
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TruthTableFitnessFunction
public TruthTableFitnessFunction()
Only use for dynamic instantiation as configuration retrieved from static setting.- Since:
- 2.4
-
TruthTableFitnessFunction
public TruthTableFitnessFunction(Configuration a_conf)
Constructor without registering a truth table. Use this constructor if the truth table is not fix over generations and needs to be set in method evaluate.- Parameters:
a_conf- the configuration to use- Since:
- 3.01
-
TruthTableFitnessFunction
public TruthTableFitnessFunction(Configuration a_conf, java.util.Map a_truthTable)
Constructor for registering a truth table. Use this constructor if the truth table is fix over generations.- Parameters:
a_conf- the configuration to usea_truthTable- table of input/output pairs for feeding the formula and determining the fitness value thru delta computation- Since:
- 3.1
-
-
Method Detail
-
setTruthTable
public void setTruthTable(java.util.Map a_truthTable)
-
getTruthTable
public java.util.Map getTruthTable()
-
calcFitness
public double calcFitness(java.util.Map a_actualInputOutput)
Fitness value calculation for a given table of input/output tupels and a truth-table (also given as list of input/output tupels)- Parameters:
a_actualInputOutput- table of actual input/output pairs- Returns:
- delta between current values and given truth table
- Since:
- 2.4
-
getConfiguration
public Configuration getConfiguration()
- Returns:
- the Configuration object set
- Since:
- 3.1
-
-
DMelt 3.0 © DataMelt by jWork.ORG