Package net.sf.tweety.math.opt.solver
Class ApacheCommonsCMAESOptimizer
- java.lang.Object
-
- net.sf.tweety.math.opt.Solver
-
- net.sf.tweety.math.opt.solver.ApacheCommonsCMAESOptimizer
-
public class ApacheCommonsCMAESOptimizer extends Solver
This class is a wrapper for the Apache Commons Math3 CMAES optimizer (https://commons.apache.org/proper/commons-math/).- Author:
- Matthias Thimm
-
-
Field Summary
Fields Modifier and Type Field Description private int
checkFeasableCount
Determines how often new random objective variables are generated in case they are out of bounds.private int
diagonalOnly
Number of initial iterations, where the covariance matrix remains diagonal.private boolean
isActiveCMA
Chooses the covariance matrix update method.private int
maxIterations
Maximal number of iterations.private int
populationSize
Population sizeprivate double
precision
The precision of the optimizationprivate double
stopFitness
Whether to stop if objective function value is smaller than stopFitness.
-
Constructor Summary
Constructors Constructor Description ApacheCommonsCMAESOptimizer(int populationSize, int maxIterations, double stopFitness, boolean isActiveCMA, int diagonalOnly, int checkFeasableCount, double precision)
Parameters from org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer:
-
Method Summary
Modifier and Type Method Description static boolean
isInstalled()
java.util.Map<Variable,Term>
solve(ConstraintSatisfactionProblem problem)
Computes a solution to the given constraint satisfaction or optimization problem, i.e.java.util.Map<Variable,Term>
solve(Term t, int optimization_type)
Returns the variable assignment that maximizes/minimizes the given term (which only contains variables with defined upper and lower bounds).-
Methods inherited from class net.sf.tweety.math.opt.Solver
getDefaultGeneralSolver, getDefaultIntegerLinearSolver, getDefaultLinearSolver, hasDefaultGeneralSolver, hasDefaultIntegerLinearSolver, hasDefaultLinearSolver, setDefaultGeneralSolver, setDefaultIntegerLinearSolver, setDefaultLinearSolver
-
-
-
-
Field Detail
-
populationSize
private int populationSize
Population size
-
maxIterations
private int maxIterations
Maximal number of iterations.
-
stopFitness
private double stopFitness
Whether to stop if objective function value is smaller than stopFitness.
-
isActiveCMA
private boolean isActiveCMA
Chooses the covariance matrix update method.
-
diagonalOnly
private int diagonalOnly
Number of initial iterations, where the covariance matrix remains diagonal.
-
checkFeasableCount
private int checkFeasableCount
Determines how often new random objective variables are generated in case they are out of bounds.
-
precision
private double precision
The precision of the optimization
-
-
Constructor Detail
-
ApacheCommonsCMAESOptimizer
public ApacheCommonsCMAESOptimizer(int populationSize, int maxIterations, double stopFitness, boolean isActiveCMA, int diagonalOnly, int checkFeasableCount, double precision)
Parameters from org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer:- Parameters:
populationSize
- the population sizemaxIterations
- Maximal number of iterations.stopFitness
- Whether to stop if objective function value is smaller than stopFitness.isActiveCMA
- Chooses the covariance matrix update method.diagonalOnly
- Number of initial iterations, where the covariance matrix remains diagonal.checkFeasableCount
- Determines how often new random objective variables are generated in case they are out of bounds.precision
- the precision of the optimization
-
-
Method Detail
-
solve
public java.util.Map<Variable,Term> solve(ConstraintSatisfactionProblem problem) throws GeneralMathException
Description copied from class:Solver
Computes a solution to the given constraint satisfaction or optimization problem, i.e. a mapping from variables of the problem to terms.- Specified by:
solve
in classSolver
- Parameters:
problem
- the actual problem- Returns:
- a mapping from variables of the problem to terms.
- Throws:
GeneralMathException
- if something went wrong.
-
solve
public java.util.Map<Variable,Term> solve(Term t, int optimization_type) throws GeneralMathException
Returns the variable assignment that maximizes/minimizes the given term (which only contains variables with defined upper and lower bounds).- Parameters:
t
- the term to be evaluatedoptimization_type
- one of OptimizationProblem.MAXIMIZE, OptimizationProblem.MINIMIZE- Returns:
- the optimal variable assignment
- Throws:
GeneralMathException
- if there is some issue in the computation
-
isInstalled
public static boolean isInstalled() throws java.lang.UnsupportedOperationException
- Throws:
java.lang.UnsupportedOperationException
-
-