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 double
contol
private double
ftol
private double
gtol
private java.util.Map<java.lang.Integer,Variable>
idx2newVars
A map mapping indices to new variables.protected boolean
ignoreNotFeasibleError
private org.slf4j.Logger
log
Logger.private double
maxFunEvals
private double
maxIter
private java.util.Map<Variable,Variable>
newVars2oldVars
A map mapping old variables to new variables.private java.util.Map<Variable,Variable>
oldVars2newVars
A map mapping old variables to new variables.private java.lang.String
solver
private java.util.Map<Variable,Term>
startingPoint
A starting point for the optimization.private double
xtol
-
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 double
getContol()
double
getFtol()
double
getGtol()
double
getMaxFunEvals()
double
getMaxIter()
java.lang.String
getOpenOptCode(OptimizationProblem problem)
Builds the OpenOpt code for the given problem which can be interpreted by a python.java.lang.String
getSolver()
double
getXtol()
boolean
isIgnoreNotFeasibleError()
static boolean
isInstalled()
protected java.util.Map<Variable,Term>
parseOutput(java.lang.String output)
This method parses the output data of an OpenOpt runvoid
setContol(double contol)
void
setFtol(double ftol)
void
setGtol(double gtol)
void
setIgnoreNotFeasibleError(boolean ignoreNotFeasibleError)
void
setMaxFunEvals(double maxFunEvals)
void
setMaxIter(double maxIter)
void
setSolver(java.lang.String solver)
void
setXtol(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: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.
-
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)
-
-