1#ifndef STORM_SOLVER_GLPKLPSOLVER_H_
2#define STORM_SOLVER_GLPKLPSOLVER_H_
9#include "storm-config.h"
21template<
typename ValueType,
bool RawMode = false>
22class GlpkLpSolver :
public LpSolver<ValueType, RawMode> {
66 std::optional<ValueType>
const& upperBound = std::nullopt, ValueType objectiveFunctionCoefficient = 0)
override;
69 virtual void update()
const override;
76 virtual void optimize()
const override;
90 virtual void push()
override;
91 virtual void pop()
override;
101 std::conditional_t<RawMode, std::vector<int>, std::map<storm::expressions::Variable, int>> variableToIndexMap;
104 bool modelContainsIntegerVariables;
107 mutable bool isInfeasibleFlag;
108 mutable bool isUnboundedFlag;
110 mutable double maxMILPGap;
111 mutable bool maxMILPGapRelative;
112 mutable double actualRelativeMILPGap;
114 struct IncrementalLevel {
115 std::vector<Variable> variables;
116 int firstConstraintIndex;
118 std::vector<IncrementalLevel> incrementalData;
125 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
126 "requires this support. Please choose a version of support with glpk support.";
130 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
131 "requires this support. Please choose a version of support with glpk support.";
135 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
136 "requires this support. Please choose a version of support with glpk support.";
140 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
141 "requires this support. Please choose a version of support with glpk support.";
145 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
146 "requires this support. Please choose a version of support with glpk support.";
150 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
151 "requires this support. Please choose a version of support with glpk support.";
155 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
156 "requires this support. Please choose a version of support with glpk support.";
160 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
161 "requires this support. Please choose a version of support with glpk support.";
165 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
166 "requires this support. Please choose a version of support with glpk support.";
170 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
171 "requires this support. Please choose a version of support with glpk support.";
175 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
176 "requires this support. Please choose a version of support with glpk support.";
180 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
181 "requires this support. Please choose a version of support with glpk support.";
185 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
186 "requires this support. Please choose a version of support with glpk support.";
190 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
191 "requires this support. Please choose a version of support with glpk support.";
195 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
196 "requires this support. Please choose a version of support with glpk support.";
200 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
201 "requires this support. Please choose a version of support with glpk support.";
205 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
206 "requires this support. Please choose a version of support with glpk support.";
209 virtual void pop()
override {
210 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
211 "requires this support. Please choose a version of support with glpk support.";
215 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
216 "requires this support. Please choose a version of support with glpk support.";
220 throw storm::exceptions::NotImplementedException() <<
"This version of storm was compiled without support for glpk. Yet, a method was called that "
221 "requires this support. Please choose a version of support with glpk support.";
GlpkLpSolver(OptimizationDirection const &modelSense)
virtual void push() override
Pushes a backtracking point on the solver's stack.
virtual void pop() override
Pops a backtracking point from the solver's stack.
virtual ValueType getContinuousValue(storm::expressions::Variable const &variable) const override
virtual bool getBinaryValue(storm::expressions::Variable const &variable) const override
virtual void writeModelToFile(std::string const &filename) const override
Writes the current LP problem to the given file.
virtual bool isInfeasible() const override
Retrieves whether the model was found to be infeasible.
virtual ValueType getMILPGap(bool relative) const override
Returns the obtained gap after a call to optimize()
virtual void addConstraint(std::string const &name, storm::expressions::Expression const &constraint) override
virtual bool isUnbounded() const override
Retrieves whether the model was found to be infeasible.
virtual bool isOptimal() const override
Retrieves whether the model was found to be optimal, i.e.
GlpkLpSolver(std::string const &name)
virtual void optimize() const override
Optimizes the LP problem previously constructed.
virtual void update() const override
Updates the model to make the variables that have been declared since the last call to update usable.
virtual ValueType getObjectiveValue() const override
Retrieves the value of the objective function.
GlpkLpSolver(std::string const &name, OptimizationDirection const &modelSense)
virtual int_fast64_t getIntegerValue(storm::expressions::Variable const &variable) const override
An interface that captures the functionality of an LP solver.
virtual void setMaximalMILPGap(ValueType const &gap, bool relative)=0
Specifies the maximum difference between lower- and upper objective bounds that triggers termination.
virtual Variable addVariable(std::string const &name, VariableType const &type, std::optional< ValueType > const &lowerBound=std::nullopt, std::optional< ValueType > const &upperBound=std::nullopt, ValueType objectiveFunctionCoefficient=0)=0
Registers a variable of the given type.
std::conditional_t< RawMode, RawLpConstraint< ValueType >, storm::expressions::Expression > Constraint
std::conditional_t< RawMode, ValueType, storm::expressions::Expression > Constant
std::conditional_t< RawMode, typename RawLpConstraint< ValueType >::VariableIndexType, storm::expressions::Variable > Variable
virtual void addIndicatorConstraint(std::string const &name, Variable indicatorVariable, bool indicatorValue, Constraint const &constraint)=0
Adds the given indicator constraint to the LP problem: "If indicatorVariable == indicatorValue,...
VariableType
Enumerates the different types of variables.
SFTBDDChecker::ValueType ValueType