Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::solver::LinearEquationSolver< ValueType > Class Template Referenceabstract

An interface that represents an abstract linear equation solver. More...

#include <LinearEquationSolver.h>

Inheritance diagram for storm::solver::LinearEquationSolver< ValueType >:
Collaboration diagram for storm::solver::LinearEquationSolver< ValueType >:

Public Member Functions

 LinearEquationSolver ()
virtual ~LinearEquationSolver ()
virtual void setMatrix (storm::storage::SparseMatrix< ValueType > const &A)=0
virtual void setMatrix (storm::storage::SparseMatrix< ValueType > &&A)=0
bool solveEquations (Environment const &env, std::vector< ValueType > &x, std::vector< ValueType > const &b) const
 If the solver expects the equation system format, it solves Ax = b.
virtual LinearEquationSolverProblemFormat getEquationProblemFormat (Environment const &env) const =0
 Retrieves the format in which this solver expects to solve equations.
virtual LinearEquationSolverRequirements getRequirements (Environment const &env) const
 Retrieves the requirements of the solver under the current settings.
void setCachingEnabled (bool value) const
 Sets whether some of the generated data during solver calls should be cached.
bool isCachingEnabled () const
 Retrieves whether some of the generated data during solver calls should be cached.
virtual void clearCache () const
Public Member Functions inherited from storm::solver::AbstractEquationSolver< ValueType >
 AbstractEquationSolver ()
void setShowProgress (bool verbose, uint64_t delay=5)
 Configures whether this solver should show progress during iterative solving.
void setTerminationCondition (std::unique_ptr< TerminationCondition< ValueType > > terminationCondition)
 Sets a custom termination condition that is used together with the regular termination condition of the solver.
void resetTerminationCondition ()
 Removes a previously set custom termination condition.
bool hasCustomTerminationCondition () const
 Retrieves whether a custom termination condition has been set.
bool terminateNow (std::vector< ValueType > const &values, SolverGuarantee const &guarantee) const
 Checks whether the solver can terminate wrt.
bool hasRelevantValues () const
 Retrieves whether this solver has particularly relevant values.
storm::storage::BitVector const & getRelevantValues () const
 Retrieves the relevant values (if there are any).
boost::optional< storm::storage::BitVector > const & getOptionalRelevantValues () const
void setRelevantValues (storm::storage::BitVector &&valuesOfInterest)
 Sets the relevant values.
void clearRelevantValues ()
 Removes the values of interest (if there were any).
bool hasLowerBound (BoundType const &type=BoundType::Any) const
 Retrieves whether this solver has a lower bound.
bool hasUpperBound (BoundType const &type=BoundType::Any) const
 Retrieves whether this solver has an upper bound.
void setLowerBound (ValueType const &value)
 Sets a lower bound for the solution that can potentially be used by the solver.
void setUpperBound (ValueType const &value)
 Sets an upper bound for the solution that can potentially be used by the solver.
void setBounds (ValueType const &lower, ValueType const &upper)
 Sets bounds for the solution that can potentially be used by the solver.
ValueType const & getLowerBound () const
 Retrieves the lower bound (if there is any).
ValueType const & getUpperBound () const
 Retrieves the upper bound (if there is any).
std::vector< ValueType > const & getLowerBounds () const
 Retrieves a vector containing the lower bounds (if there are any).
std::vector< ValueType > const & getUpperBounds () const
 Retrieves a vector containing the upper bounds (if there are any).
void setLowerBounds (std::vector< ValueType > const &values)
 Sets lower bounds for the solution that can potentially be used by the solver.
void setUpperBounds (std::vector< ValueType > const &values)
 Sets upper bounds for the solution that can potentially be used by the solver.
void setBoundsFromOtherSolver (AbstractEquationSolver< ValueType > const &other)
void clearBounds ()
 Removes all specified solution bounds.
bool hasSolutionLowerBounds () const
 Retrieves whether the last call to this solver computed a sound lower resp.
bool hasSolutionUpperBounds () const
bool hasExactSolutionBounds () const
 Retrieves whether the bounds computed by the last call to this solver coincide.
std::vector< ValueType > const & getSolutionLowerBounds () const
 Retrieves sound bounds on the solution that the last call to this solver computed.
std::vector< ValueType > const & getSolutionUpperBounds () const
SolutionBounds< ValueType > const & getSolutionBounds () const
 Retrieves both bounds at once, either of which may be unset.
bool isShowProgressSet () const
 Retrieves whether progress is to be shown.
uint64_t getShowProgressDelay () const
 Retrieves the delay between progress emissions.
void startMeasureProgress (uint64_t startingIteration=0) const
 Starts to measure progress.
void showProgressIterative (uint64_t iterations, boost::optional< uint64_t > const &bound=boost::none) const
 Shows progress if this solver is asked to do so.

Protected Member Functions

virtual bool internalSolveEquations (Environment const &env, std::vector< ValueType > &x, std::vector< ValueType > const &b) const =0
Protected Member Functions inherited from storm::solver::AbstractEquationSolver< ValueType >
TerminationCondition< ValueType > const & getTerminationCondition () const
 Retrieves the custom termination condition (if any was set).
std::unique_ptr< TerminationCondition< ValueType > > const & getTerminationConditionPointer () const
void setSolutionBounds (SolutionBounds< ValueType > bounds) const
 Stores sound bounds on the solution that were obtained while solving.
void setSolutionBoundsExact (std::vector< ValueType > const &x) const
 Reports the given solution as an exact one, i.e.
void finalizeSolutionBounds (std::vector< ValueType > const &x) const
 Settles the bounds to report once solving is over: the ones handed to this solver beforehand are folded into the ones it computed itself, and both are widened until they enclose the solution that is handed back.
void clearSolutionBounds () const
 Discards any bounds on the solution obtained by a previous call.
void setSolutionBoundsFromPrecision (std::vector< ValueType > const &x, ValueType const &precision, bool relative) const
 Turns a precision that the solving procedure is known to have achieved into sound bounds on the solution, i.e.
void createUpperBoundsVector (std::vector< ValueType > &upperBoundsVector) const
void createLowerBoundsVector (std::vector< ValueType > &lowerBoundsVector) const
void reportStatus (SolverStatus status, boost::optional< uint64_t > const &iterations=boost::none) const
 Report the current status of the solver.
SolverStatus updateStatus (SolverStatus status, std::vector< ValueType > const &x, SolverGuarantee const &guarantee, uint64_t iterations, uint64_t maximalNumberOfIterations) const
 Update the status of the solver with respect to convergence, early termination, abortion, etc.

Protected Attributes

std::unique_ptr< std::vector< ValueType > > cachedRowVector
Protected Attributes inherited from storm::solver::AbstractEquationSolver< ValueType >
std::unique_ptr< TerminationCondition< ValueType > > terminationCondition
boost::optional< storm::storage::BitVector > relevantValues
boost::optional< ValueType > lowerBound
boost::optional< ValueType > upperBound
boost::optional< std::vector< ValueType > > lowerBounds
boost::optional< std::vector< ValueType > > upperBounds

Additional Inherited Members

Public Types inherited from storm::solver::AbstractEquationSolver< ValueType >
enum  BoundType

Detailed Description

template<class ValueType>
class storm::solver::LinearEquationSolver< ValueType >

An interface that represents an abstract linear equation solver.

Definition at line 24 of file LinearEquationSolver.h.

Constructor & Destructor Documentation

◆ LinearEquationSolver()

template<typename ValueType>
storm::solver::LinearEquationSolver< ValueType >::LinearEquationSolver ( )

Definition at line 21 of file LinearEquationSolver.cpp.

◆ ~LinearEquationSolver()

template<class ValueType>
virtual storm::solver::LinearEquationSolver< ValueType >::~LinearEquationSolver ( )
inlinevirtual

Definition at line 28 of file LinearEquationSolver.h.

Member Function Documentation

◆ clearCache()

◆ getEquationProblemFormat()

template<class ValueType>
virtual LinearEquationSolverProblemFormat storm::solver::LinearEquationSolver< ValueType >::getEquationProblemFormat ( Environment const & env) const
pure virtual

Retrieves the format in which this solver expects to solve equations.

If the solver expects the equation system format, it solves Ax = b. If it it expects a fixed point format, it solves Ax + b = x.

Implemented in storm::solver::AcyclicLinearEquationSolver< ValueType >, storm::solver::EigenLinearEquationSolver< ValueType >, storm::solver::EliminationLinearEquationSolver< ValueType >, storm::solver::GmmxxLinearEquationSolver< ValueType >, storm::solver::NativeLinearEquationSolver< ValueType >, and storm::solver::TopologicalLinearEquationSolver< ValueType >.

◆ getRequirements()

template<typename ValueType>
LinearEquationSolverRequirements storm::solver::LinearEquationSolver< ValueType >::getRequirements ( Environment const & env) const
virtual

Retrieves the requirements of the solver under the current settings.

Note that these requirements only apply to solving linear equations and not to the matrix vector multiplications.

Reimplemented in storm::solver::AcyclicLinearEquationSolver< ValueType >, storm::solver::NativeLinearEquationSolver< ValueType >, and storm::solver::TopologicalLinearEquationSolver< ValueType >.

Definition at line 37 of file LinearEquationSolver.cpp.

◆ internalSolveEquations()

◆ isCachingEnabled()

template<typename ValueType>
bool storm::solver::LinearEquationSolver< ValueType >::isCachingEnabled ( ) const

Retrieves whether some of the generated data during solver calls should be cached.

Definition at line 51 of file LinearEquationSolver.cpp.

◆ setCachingEnabled()

template<typename ValueType>
void storm::solver::LinearEquationSolver< ValueType >::setCachingEnabled ( bool value) const

Sets whether some of the generated data during solver calls should be cached.

This possibly increases the runtime of subsequent calls but also increases memory consumption.

Definition at line 42 of file LinearEquationSolver.cpp.

◆ setMatrix() [1/2]

◆ setMatrix() [2/2]

◆ solveEquations()

template<typename ValueType>
bool storm::solver::LinearEquationSolver< ValueType >::solveEquations ( Environment const & env,
std::vector< ValueType > & x,
std::vector< ValueType > const & b ) const

If the solver expects the equation system format, it solves Ax = b.

If it it expects a fixed point format, it solves Ax + b = x. In both versions, the matrix A is required to be square and the problem is required to have a unique solution. The solution will be written to the vector x. Note that the matrix A has to be given upon construction time of the solver object.

Parameters
xThe solution vector that has to be computed. Its length must be equal to the number of rows of A.
bThe vector b. Its length must be equal to the number of rows of A.
Returns
true

Definition at line 26 of file LinearEquationSolver.cpp.

Member Data Documentation

◆ cachedRowVector

template<class ValueType>
std::unique_ptr<std::vector<ValueType> > storm::solver::LinearEquationSolver< ValueType >::cachedRowVector
mutableprotected

Definition at line 80 of file LinearEquationSolver.h.


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