7#include "storm-config.h"
18template<
typename ValueType,
bool RawMode = false>
63 std::optional<ValueType>
const& upperBound = std::nullopt, ValueType objectiveFunctionCoefficient = 0)
override;
66 virtual void update()
const override;
73 virtual void optimize()
const override;
87 virtual void push()
override;
88 virtual void pop()
override;
91 virtual ValueType
getMILPGap(
bool relative)
const override;
100 std::conditional_t<RawMode, std::vector<int>, std::map<storm::expressions::Variable, int>> variableToIndexMap;
103 bool modelContainsIntegerVariables;
106 mutable bool isInfeasibleFlag;
107 mutable bool isUnboundedFlag;
109 mutable double maxMILPGap;
110 mutable bool maxMILPGapRelative;
111 mutable double actualRelativeMILPGap;
113 struct IncrementalLevel {
114 std::vector<Variable> variables;
115 int firstConstraintIndex;
117 std::vector<IncrementalLevel> incrementalData;
A class that implements the LpSolver interface using glpk as the background solver.
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.
GlpkLpSolver()
Constructs a solver without a 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
Registers a variable of the given type.
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.
typename LpSolver< ValueType, RawMode >::Variable Variable
An interface that captures the functionality of an LP solver.
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.