Class GurobiOptimizer
java.lang.Object
org.tweetyproject.math.opt.solver.Solver
org.tweetyproject.math.opt.solver.GurobiOptimizer
This class is a wrapper for the Gurobi optimizer 
 (https://www.gurobi.com). Works with Gurobi 9.1.0
- Author:
 - Sebastian Franke, Matthias Thimm
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionvoidparses a statement into a gurobi constrant and adds it to the modelstatic booleangurobi.GRBExprparses a term from tweety to GRB the input term needs to be linear or quadraticvoidparseVars(OptimizationProblem prob) takes all Variables from a tweety problem and maps them to GRB VaraiblesComputes a solution to the given constraint satisfaction or optimization problem, i.e.Returns the variable assignment that maximizes/minimizes the given term (which only contains variables with defined upper and lower bounds).Methods inherited from class org.tweetyproject.math.opt.solver.Solver
getDefaultGeneralSolver, getDefaultIntegerLinearSolver, getDefaultLinearSolver, hasDefaultGeneralSolver, hasDefaultIntegerLinearSolver, hasDefaultLinearSolver, setDefaultGeneralSolver, setDefaultIntegerLinearSolver, setDefaultLinearSolver 
- 
Constructor Details
- 
GurobiOptimizer
public GurobiOptimizer() throws gurobi.GRBException- Throws:
 gurobi.GRBException- GRBException
 
 - 
 - 
Method Details
- 
parseVars
takes all Variables from a tweety problem and maps them to GRB Varaibles- Parameters:
 prob- problem- Throws:
 gurobi.GRBException- GRBException
 - 
parseTerm
parses a term from tweety to GRB the input term needs to be linear or quadratic- Parameters:
 term- term- Returns:
 - gurobi expression
 
 - 
addStatementToGurobi
parses a statement into a gurobi constrant and adds it to the model- Parameters:
 s- statement to be addedi- running number of the constraint to be put into the Gurobi name of the constraint- Throws:
 gurobi.GRBException- GRBException
 - 
solve
public Map<Variable,Term> solve(GeneralConstraintSatisfactionProblem 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.
 - 
solve
public Map<Variable,Term> solve(Term t, int optimization_type) throws GeneralMathException, gurobi.GRBException 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 computationgurobi.GRBException- GRBException
 - 
toQuadraticFormHelper
- Parameters:
 sum- a quadratic term in normal form- Returns:
 - a list of products from a quadratic term in normal form
 
 - 
isInstalled
- Returns:
 - if solver is installed
 - Throws:
 UnsupportedOperationException- UnsupportedOperationException
 
 -