Class CMAESOptimizer.FitnessFunction
- java.lang.Object
-
- org.apache.commons.math3.optimization.direct.CMAESOptimizer.FitnessFunction
-
- Enclosing class:
- CMAESOptimizer
private class CMAESOptimizer.FitnessFunction extends java.lang.ObjectNormalizes fitness values to the range [0,1]. Adds a penalty to the fitness value if out of range. The penalty is adjusted by calling setValueRange().
-
-
Field Summary
Fields Modifier and Type Field Description private booleanisRepairModeFlag indicating whether the objective variables are forced into their bounds if definedprivate doublevalueRangeDetermines the penalty for boundary violations
-
Constructor Summary
Constructors Constructor Description FitnessFunction()Simple constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanisFeasible(double[] x)private doublepenalty(double[] x, double[] repaired)private double[]repair(double[] x)voidsetValueRange(double valueRange)doublevalue(double[] point)
-
-
-
Method Detail
-
value
public double value(double[] point)
- Parameters:
point- Normalized objective variables.- Returns:
- the objective value + penalty for violated bounds.
-
isFeasible
public boolean isFeasible(double[] x)
- Parameters:
x- Normalized objective variables.- Returns:
trueif in bounds.
-
setValueRange
public void setValueRange(double valueRange)
- Parameters:
valueRange- Adjusts the penalty computation.
-
repair
private double[] repair(double[] x)
- Parameters:
x- Normalized objective variables.- Returns:
- the repaired (i.e. all in bounds) objective variables.
-
penalty
private double penalty(double[] x, double[] repaired)- Parameters:
x- Normalized objective variables.repaired- Repaired objective variables.- Returns:
- Penalty value according to the violation of the bounds.
-
-