7#include "storm-config.h"
21template<
typename ValueType,
bool RawMode = false>
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;
94 virtual ValueType
getMILPGap(
bool relative)
const override;
103 std::conditional_t<RawMode, std::vector<int>, std::map<storm::expressions::Variable, int>> variableToIndexMap;
106 bool modelContainsIntegerVariables;
109 double integerTolerance;
112 bool milpPresolverEnabled;
115 mutable bool isInfeasibleFlag;
116 mutable bool isUnboundedFlag;
118 mutable double maxMILPGap;
119 mutable bool maxMILPGapRelative;
120 mutable double actualRelativeMILPGap;
122 struct IncrementalLevel {
123 std::vector<Variable> variables;
124 int firstConstraintIndex;
126 std::vector<IncrementalLevel> incrementalData;
virtual bool getBinaryValue(Variable const &name) const override
Retrieves the value of the binary variable with the given name.
virtual void setMaximalMILPGap(ValueType const &gap, bool relative) override
Specifies the maximum difference between lower- and upper objective bounds that triggers termination.
virtual void push() override
Pushes a backtracking point on the solver's stack.
virtual ValueType getContinuousValue(Variable const &name) const override
Retrieves the value of the continuous variable with the given name.
virtual int_fast64_t getIntegerValue(Variable const &name) const override
Retrieves the value of the integer variable with the given name.
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) override
virtual bool isOptimal() const override
Retrieves whether the model was found to be optimal, i.e.
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 void pop() override
Pops a backtracking point from the solver's stack.
typename LpSolver< ValueType, RawMode >::Constraint Constraint
virtual ValueType getObjectiveValue() const override
Retrieves the value of the objective function.
virtual void addIndicatorConstraint(std::string const &name, Variable indicatorVariable, bool indicatorValue, Constraint const &constraint) override
Adds the given indicator constraint to the LP problem: "If indicatorVariable == indicatorValue,...
virtual void addConstraint(std::string const &name, Constraint const &constraint) override
Adds a the given constraint to the LP problem.
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 getMILPGap(bool relative) const override
Returns the obtained gap after a call to optimize().
virtual ~GlpkLpSolver()
Destructs a solver by freeing the pointers to glpk's structures.
typename LpSolver< ValueType, RawMode >::VariableType VariableType
typename LpSolver< ValueType, RawMode >::Constant Constant
virtual bool isUnbounded() const override
Retrieves whether the model was found to be infeasible.
virtual void optimize() const override
Optimizes the LP problem previously constructed.
GlpkLpSolver(storm::GlpkSolverEnvironment const &glpkSettings, bool debug, std::string const &name, OptimizationDirection const &optDir)
Constructs a solver with the given name and model sense.
typename LpSolver< ValueType, RawMode >::Variable Variable
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
VariableType
Enumerates the different types of variables.