Package net.sf.tweety.math.opt.solver
Class OpenOptSolver
- java.lang.Object
-
- net.sf.tweety.math.opt.Solver
-
- net.sf.tweety.math.opt.solver.OpenOptSolver
-
- Direct Known Subclasses:
OpenOptWebSolver
public class OpenOptSolver extends Solver
This class implements a wrapper for the OpenOpt optimization library.- Author:
- Matthias Thimm
-
-
Field Summary
Fields Modifier and Type Field Description private doublecontolprivate doubleftolprivate doublegtolprivate java.util.Map<java.lang.Integer,Variable>idx2newVarsA map mapping indices to new variables.protected booleanignoreNotFeasibleErrorprivate org.slf4j.LoggerlogLogger.private doublemaxFunEvalsprivate doublemaxIterprivate java.util.Map<Variable,Variable>newVars2oldVarsA map mapping old variables to new variables.private java.util.Map<Variable,Variable>oldVars2newVarsA map mapping old variables to new variables.private java.lang.Stringsolverprivate java.util.Map<Variable,Term>startingPointA starting point for the optimization.private doublextol
-
Constructor Summary
Constructors Constructor Description OpenOptSolver()Creates a new solver.OpenOptSolver(java.util.Map<Variable,Term> startingPoint)Creates a new solver for the given problem.
-
Method Summary
Modifier and Type Method Description doublegetContol()doublegetFtol()doublegetGtol()doublegetMaxFunEvals()doublegetMaxIter()java.lang.StringgetOpenOptCode(OptimizationProblem problem)Builds the OpenOpt code for the given problem which can be interpreted by a python.java.lang.StringgetSolver()doublegetXtol()booleanisIgnoreNotFeasibleError()static booleanisInstalled()protected java.util.Map<Variable,Term>parseOutput(java.lang.String output)This method parses the output data of an OpenOpt runvoidsetContol(double contol)voidsetFtol(double ftol)voidsetGtol(double gtol)voidsetIgnoreNotFeasibleError(boolean ignoreNotFeasibleError)voidsetMaxFunEvals(double maxFunEvals)voidsetMaxIter(double maxIter)voidsetSolver(java.lang.String solver)voidsetXtol(double xtol)java.util.Map<Variable,Term>solve(ConstraintSatisfactionProblem problem)Computes a solution to the given constraint satisfaction or optimization problem, i.e.-
Methods inherited from class net.sf.tweety.math.opt.Solver
getDefaultGeneralSolver, getDefaultIntegerLinearSolver, getDefaultLinearSolver, hasDefaultGeneralSolver, hasDefaultIntegerLinearSolver, hasDefaultLinearSolver, setDefaultGeneralSolver, setDefaultIntegerLinearSolver, setDefaultLinearSolver
-
-
-
-
Field Detail
-
log
private org.slf4j.Logger log
Logger.
-
contol
private double contol
-
ftol
private double ftol
-
gtol
private double gtol
-
xtol
private double xtol
-
maxIter
private double maxIter
-
maxFunEvals
private double maxFunEvals
-
solver
private java.lang.String solver
-
ignoreNotFeasibleError
protected boolean ignoreNotFeasibleError
-
startingPoint
private java.util.Map<Variable,Term> startingPoint
A starting point for the optimization.
-
oldVars2newVars
private java.util.Map<Variable,Variable> oldVars2newVars
A map mapping old variables to new variables.
-
newVars2oldVars
private java.util.Map<Variable,Variable> newVars2oldVars
A map mapping old variables to new variables.
-
idx2newVars
private java.util.Map<java.lang.Integer,Variable> idx2newVars
A map mapping indices to new variables.
-
-
Method Detail
-
solve
public java.util.Map<Variable,Term> solve(ConstraintSatisfactionProblem problem) throws GeneralMathException
Description copied from class:SolverComputes a solution to the given constraint satisfaction or optimization problem, i.e. a mapping from variables of the problem to terms.- Specified by:
solvein classSolver- Parameters:
problem- the actual problem- Returns:
- a mapping from variables of the problem to terms.
- Throws:
GeneralMathException- if something went wrong.
-
getOpenOptCode
public java.lang.String getOpenOptCode(OptimizationProblem problem)
Builds the OpenOpt code for the given problem which can be interpreted by a python.- Parameters:
problem- the optimisation problem- Returns:
- the python code for the given problem
-
parseOutput
protected java.util.Map<Variable,Term> parseOutput(java.lang.String output)
This method parses the output data of an OpenOpt run- Parameters:
output- a string.- Returns:
- a map from variable to terms
-
isInstalled
public static boolean isInstalled() throws java.lang.UnsupportedOperationException- Throws:
java.lang.UnsupportedOperationException
-
getContol
public double getContol()
-
setContol
public void setContol(double contol)
-
getFtol
public double getFtol()
-
setFtol
public void setFtol(double ftol)
-
getGtol
public double getGtol()
-
setGtol
public void setGtol(double gtol)
-
getXtol
public double getXtol()
-
setXtol
public void setXtol(double xtol)
-
getMaxIter
public double getMaxIter()
-
setMaxIter
public void setMaxIter(double maxIter)
-
getMaxFunEvals
public double getMaxFunEvals()
-
setMaxFunEvals
public void setMaxFunEvals(double maxFunEvals)
-
getSolver
public java.lang.String getSolver()
-
setSolver
public void setSolver(java.lang.String solver)
-
isIgnoreNotFeasibleError
public boolean isIgnoreNotFeasibleError()
-
setIgnoreNotFeasibleError
public void setIgnoreNotFeasibleError(boolean ignoreNotFeasibleError)
-
-