Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::solver::GlpkLpSolver Class Reference

#include <GlpkLpSolver.h>

Inheritance diagram for storm::solver::GlpkLpSolver:
Collaboration diagram for storm::solver::GlpkLpSolver:

Public Member Functions

 GlpkLpSolver (std::string const &name, OptimizationDirection const &modelSense)
 
 GlpkLpSolver (std::string const &name)
 
 GlpkLpSolver (OptimizationDirection const &modelSense)
 
 GlpkLpSolver ()
 
virtual ~GlpkLpSolver ()
 
virtual void update () const override
 Updates the model to make the variables that have been declared since the last call to update usable.
 
virtual void addConstraint (std::string const &name, storm::expressions::Expression const &constraint) override
 
virtual void optimize () const override
 Optimizes the LP problem previously constructed.
 
virtual bool isInfeasible () const override
 Retrieves whether the model was found to be infeasible.
 
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.
 
virtual ValueType getContinuousValue (storm::expressions::Variable const &variable) const override
 
virtual int_fast64_t getIntegerValue (storm::expressions::Variable const &variable) const override
 
virtual bool getBinaryValue (storm::expressions::Variable const &variable) const override
 
virtual ValueType getObjectiveValue () const override
 Retrieves the value of the objective function.
 
virtual void writeModelToFile (std::string const &filename) const override
 Writes the current LP problem to the given file.
 
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 getMILPGap (bool relative) const override
 Returns the obtained gap after a call to optimize()
 
virtual ValueType getMILPGap (bool relative) const override
 Returns the obtained gap after a call to optimize()
 
- Public Member Functions inherited from storm::solver::LpSolver< ValueType, RawMode >
 LpSolver ()
 Creates an empty LP solver.
 
 LpSolver (OptimizationDirection const &optDir)
 Creates an empty LP solver with the given model sense.
 
virtual ~LpSolver ()=default
 
Variable addBoundedContinuousVariable (std::string const &name, ValueType lowerBound, ValueType upperBound, ValueType objectiveFunctionCoefficient=0)
 Registers an upper- and lower-bounded continuous variable, i.e.
 
Variable addLowerBoundedContinuousVariable (std::string const &name, ValueType lowerBound, ValueType objectiveFunctionCoefficient=0)
 Registers a lower-bounded continuous variable, i.e.
 
Variable addUpperBoundedContinuousVariable (std::string const &name, ValueType upperBound, ValueType objectiveFunctionCoefficient=0)
 Registers an upper-bounded continuous variable, i.e.
 
Variable addUnboundedContinuousVariable (std::string const &name, ValueType objectiveFunctionCoefficient=0)
 Registers a unbounded continuous variable, i.e.
 
Variable addContinuousVariable (std::string const &name, std::optional< ValueType > const &lowerBound=std::nullopt, std::optional< ValueType > const &upperBound=std::nullopt, ValueType objectiveFunctionCoefficient=0)
 Registers a continuous variable, i.e.
 
Variable addBoundedIntegerVariable (std::string const &name, ValueType lowerBound, ValueType upperBound, ValueType objectiveFunctionCoefficient=0)
 Registers an upper- and lower-bounded integer variable, i.e.
 
Variable addLowerBoundedIntegerVariable (std::string const &name, ValueType lowerBound, ValueType objectiveFunctionCoefficient=0)
 Registers a lower-bounded integer variable, i.e.
 
Variable addUpperBoundedIntegerVariable (std::string const &name, ValueType upperBound, ValueType objectiveFunctionCoefficient=0)
 Registers an upper-bounded integer variable, i.e.
 
Variable addUnboundedIntegerVariable (std::string const &name, ValueType objectiveFunctionCoefficient=0)
 Registers an unbounded integer variable, i.e.
 
Variable addIntegerVariable (std::string const &name, std::optional< ValueType > const &lowerBound=std::nullopt, std::optional< ValueType > const &upperBound=std::nullopt, ValueType objectiveFunctionCoefficient=0)
 Registers an integer variable, i.e.
 
Variable addBinaryVariable (std::string const &name, ValueType objectiveFunctionCoefficient=0)
 Registers a boolean variable, i.e.
 
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.
 
Constant getConstant (ValueType value) const
 Retrieves an expression that characterizes the given constant value.
 
virtual void addConstraint (std::string const &name, Constraint const &constraint)=0
 Adds a the given constraint to the LP problem.
 
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, then constraint".
 
virtual int_fast64_t getIntegerValue (Variable const &variable) const =0
 Retrieves the value of the integer variable with the given name.
 
virtual bool getBinaryValue (Variable const &variable) const =0
 Retrieves the value of the binary variable with the given name.
 
virtual ValueType getContinuousValue (Variable const &variable) const =0
 Retrieves the value of the continuous variable with the given name.
 
void setOptimizationDirection (OptimizationDirection const &optimizationDirection)
 Sets whether the objective function of this model is to be minimized or maximized.
 
OptimizationDirection getOptimizationDirection () const
 Retrieves whether the objective function of this model is to be minimized or maximized.
 
storm::expressions::ExpressionManager const & getManager () const
 Retrieves the manager for the variables created for this solver.
 
virtual void setMaximalMILPGap (ValueType const &gap, bool relative)=0
 Specifies the maximum difference between lower- and upper objective bounds that triggers termination.
 

Additional Inherited Members

- Public Types inherited from storm::solver::LpSolver< ValueType, RawMode >
enum class  VariableType { Continuous , Integer , Binary }
 Enumerates the different types of variables. More...
 
using Variable = std::conditional_t< RawMode, typename RawLpConstraint< ValueType >::VariableIndexType, storm::expressions::Variable >
 
using Constant = std::conditional_t< RawMode, ValueType, storm::expressions::Expression >
 
using Constraint = std::conditional_t< RawMode, RawLpConstraint< ValueType >, storm::expressions::Expression >
 
- Protected Member Functions inherited from storm::solver::LpSolver< ValueType, RawMode >
storm::expressions::Variable declareOrGetExpressionVariable (std::string const &name, VariableType const &type)
 
- Protected Attributes inherited from storm::solver::LpSolver< ValueType, RawMode >
std::shared_ptr< storm::expressions::ExpressionManagermanager
 
bool currentModelHasBeenOptimized
 

Detailed Description

Definition at line 122 of file GlpkLpSolver.h.

Constructor & Destructor Documentation

◆ GlpkLpSolver() [1/4]

storm::solver::GlpkLpSolver::GlpkLpSolver ( std::string const &  name,
OptimizationDirection const &  modelSense 
)
inline

Definition at line 124 of file GlpkLpSolver.h.

◆ GlpkLpSolver() [2/4]

storm::solver::GlpkLpSolver::GlpkLpSolver ( std::string const &  name)
inline

Definition at line 129 of file GlpkLpSolver.h.

◆ GlpkLpSolver() [3/4]

storm::solver::GlpkLpSolver::GlpkLpSolver ( OptimizationDirection const &  modelSense)
inline

Definition at line 134 of file GlpkLpSolver.h.

◆ GlpkLpSolver() [4/4]

storm::solver::GlpkLpSolver::GlpkLpSolver ( )
inline

Definition at line 139 of file GlpkLpSolver.h.

◆ ~GlpkLpSolver()

virtual storm::solver::GlpkLpSolver::~GlpkLpSolver ( )
inlinevirtual

Definition at line 144 of file GlpkLpSolver.h.

Member Function Documentation

◆ addConstraint()

virtual void storm::solver::GlpkLpSolver::addConstraint ( std::string const &  name,
storm::expressions::Expression const &  constraint 
)
inlineoverridevirtual

Definition at line 154 of file GlpkLpSolver.h.

◆ getBinaryValue()

virtual bool storm::solver::GlpkLpSolver::getBinaryValue ( storm::expressions::Variable const &  variable) const
inlineoverridevirtual

Definition at line 189 of file GlpkLpSolver.h.

◆ getContinuousValue()

virtual ValueType storm::solver::GlpkLpSolver::getContinuousValue ( storm::expressions::Variable const &  variable) const
inlineoverridevirtual

Definition at line 179 of file GlpkLpSolver.h.

◆ getIntegerValue()

virtual int_fast64_t storm::solver::GlpkLpSolver::getIntegerValue ( storm::expressions::Variable const &  variable) const
inlineoverridevirtual

Definition at line 184 of file GlpkLpSolver.h.

◆ getMILPGap() [1/2]

virtual ValueType storm::solver::GlpkLpSolver::getMILPGap ( bool  relative) const
inlineoverridevirtual

Returns the obtained gap after a call to optimize()

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 214 of file GlpkLpSolver.h.

◆ getMILPGap() [2/2]

virtual ValueType storm::solver::GlpkLpSolver::getMILPGap ( bool  relative) const
inlineoverridevirtual

Returns the obtained gap after a call to optimize()

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 219 of file GlpkLpSolver.h.

◆ getObjectiveValue()

virtual ValueType storm::solver::GlpkLpSolver::getObjectiveValue ( ) const
inlineoverridevirtual

Retrieves the value of the objective function.

Note that this may only be called, if the model was found to be optimal, i.e. iff isOptimal() returns true.

Returns
The value of the objective function in the optimal solution.

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 194 of file GlpkLpSolver.h.

◆ isInfeasible()

virtual bool storm::solver::GlpkLpSolver::isInfeasible ( ) const
inlineoverridevirtual

Retrieves whether the model was found to be infeasible.

This can only be called after the model has been optimized and not modified afterwards. Otherwise, an exception is thrown.

Returns
True if the model was optimized and found to be infeasible.

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 164 of file GlpkLpSolver.h.

◆ isOptimal()

virtual bool storm::solver::GlpkLpSolver::isOptimal ( ) const
inlineoverridevirtual

Retrieves whether the model was found to be optimal, i.e.

neither infeasible nor unbounded. This can only be called after the model has been optimized and not modified afterwards. Otherwise, an exception is thrown.

Returns
True if the model was optimized and found to be neither infeasible nor unbounded.

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 174 of file GlpkLpSolver.h.

◆ isUnbounded()

virtual bool storm::solver::GlpkLpSolver::isUnbounded ( ) const
inlineoverridevirtual

Retrieves whether the model was found to be infeasible.

This can only be called after the model has been optimized and not modified afterwards. Otherwise, an exception is thrown.

Returns
True if the model was optimized and found to be unbounded.

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 169 of file GlpkLpSolver.h.

◆ optimize()

virtual void storm::solver::GlpkLpSolver::optimize ( ) const
inlineoverridevirtual

Optimizes the LP problem previously constructed.

Afterwards, the methods isInfeasible, isUnbounded and isOptimal can be used to query the optimality status.

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 159 of file GlpkLpSolver.h.

◆ pop()

virtual void storm::solver::GlpkLpSolver::pop ( )
inlineoverridevirtual

Pops a backtracking point from the solver's stack.

This deletes all assertions from the solver's stack that were added after the last call to push().

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 209 of file GlpkLpSolver.h.

◆ push()

virtual void storm::solver::GlpkLpSolver::push ( )
inlineoverridevirtual

Pushes a backtracking point on the solver's stack.

A following call to pop() deletes exactly those assertions from the solver's stack that were added after this call.

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 204 of file GlpkLpSolver.h.

◆ update()

virtual void storm::solver::GlpkLpSolver::update ( ) const
inlineoverridevirtual

Updates the model to make the variables that have been declared since the last call to update usable.

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 149 of file GlpkLpSolver.h.

◆ writeModelToFile()

virtual void storm::solver::GlpkLpSolver::writeModelToFile ( std::string const &  filename) const
inlineoverridevirtual

Writes the current LP problem to the given file.

Parameters
filenameThe file to which to write the string representation of the LP.

Implements storm::solver::LpSolver< ValueType, RawMode >.

Definition at line 199 of file GlpkLpSolver.h.


The documentation for this class was generated from the following file: