Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SolverEnvironment.cpp
Go to the documentation of this file.
2
4
9
12
13namespace storm {
14
17 forceSoundness = generalSettings.isSoundSet();
18 forceExact = generalSettings.isExactSet() || generalSettings.isExactFinitePrecisionSet();
19 linearEquationSolverType = storm::settings::getModule<storm::settings::modules::CoreSettings>().getEquationSolver();
20 linearEquationSolverTypeSetFromDefault = storm::settings::getModule<storm::settings::modules::CoreSettings>().isEquationSolverSetFromDefaultValue();
21}
22
24 // Intentionally left empty
25}
26
28 return longRunAverageSolverEnvironment.get();
29}
30
32 return longRunAverageSolverEnvironment.get();
33}
34
36 return timeBoundedSolverEnvironment.get();
37}
38
40 return timeBoundedSolverEnvironment.get();
41}
42
44 return minMaxSolverEnvironment.get();
45}
46
48 return minMaxSolverEnvironment.get();
49}
50
52 return multiplierEnvironment.get();
53}
54
56 return multiplierEnvironment.get();
57}
58
60 return eigenSolverEnvironment.get();
61}
62
64 return eigenSolverEnvironment.get();
65}
66
68 return gmmxxSolverEnvironment.get();
69}
70
72 return gmmxxSolverEnvironment.get();
73}
74
76 return nativeSolverEnvironment.get();
77}
78
80 return nativeSolverEnvironment.get();
81}
82
84 return gameSolverEnvironment.get();
85}
86
88 return gameSolverEnvironment.get();
89}
90
92 return topologicalSolverEnvironment.get();
93}
94
96 return topologicalSolverEnvironment.get();
97}
98
100 return oviSolverEnvironment.get();
101}
102
104 return oviSolverEnvironment.get();
105}
106
108 return forceSoundness;
109}
110
112 SolverEnvironment::forceSoundness = value;
113}
114
116 return forceExact;
117}
118
120 SolverEnvironment::forceExact = value;
121}
122
123storm::solver::EquationSolverType const& SolverEnvironment::getLinearEquationSolverType() const {
124 return linearEquationSolverType;
125}
126
127void SolverEnvironment::setLinearEquationSolverType(storm::solver::EquationSolverType const& value, bool isSetFromDefault) {
128 linearEquationSolverTypeSetFromDefault = isSetFromDefault;
129 linearEquationSolverType = value;
130}
131
133 return linearEquationSolverTypeSetFromDefault;
134}
135
136std::pair<boost::optional<storm::RationalNumber>, boost::optional<bool>> SolverEnvironment::getPrecisionOfLinearEquationSolver(
137 storm::solver::EquationSolverType const& solverType) const {
138 std::pair<boost::optional<storm::RationalNumber>, boost::optional<bool>> result;
139 switch (solverType) {
140 case storm::solver::EquationSolverType::Gmmxx:
141 result.first = gmmxx().getPrecision();
142 break;
143 case storm::solver::EquationSolverType::Eigen:
144 result.first = eigen().getPrecision();
145 break;
146 case storm::solver::EquationSolverType::Native:
147 result.first = native().getPrecision();
148 result.second = native().getRelativeTerminationCriterion();
149 break;
150 case storm::solver::EquationSolverType::Elimination:
151 break;
152 case storm::solver::EquationSolverType::Topological:
153 result = getPrecisionOfLinearEquationSolver(topological().getUnderlyingEquationSolverType());
154 break;
155 default:
156 STORM_LOG_THROW(false, storm::exceptions::UnexpectedException, "The selected solver type is unknown.");
157 }
158 return result;
159}
160
161void SolverEnvironment::setLinearEquationSolverPrecision(boost::optional<storm::RationalNumber> const& newPrecision,
162 boost::optional<bool> const& relativePrecision) {
163 // Assert that each solver type is handled in this method.
164 STORM_LOG_ASSERT(getLinearEquationSolverType() == storm::solver::EquationSolverType::Native ||
165 getLinearEquationSolverType() == storm::solver::EquationSolverType::Gmmxx ||
166 getLinearEquationSolverType() == storm::solver::EquationSolverType::Eigen ||
167 getLinearEquationSolverType() == storm::solver::EquationSolverType::Elimination ||
168 getLinearEquationSolverType() == storm::solver::EquationSolverType::Topological,
169 "The current solver type is not respected in this method.");
170 if (newPrecision) {
171 native().setPrecision(newPrecision.get());
172 gmmxx().setPrecision(newPrecision.get());
173 eigen().setPrecision(newPrecision.get());
174 // Elimination and Topological solver do not have a precision
175 }
176 if (relativePrecision) {
177 native().setRelativeTerminationCriterion(relativePrecision.get());
178 // gmm, eigen, elimination, and topological solvers do not have a precision
179 }
180}
181} // namespace storm
void setPrecision(storm::RationalNumber value)
storm::RationalNumber const & getPrecision() const
storm::RationalNumber const & getPrecision() const
void setPrecision(storm::RationalNumber value)
storm::RationalNumber const & getPrecision() const
bool const & getRelativeTerminationCriterion() const
void setPrecision(storm::RationalNumber value)
TopologicalSolverEnvironment & topological()
void setLinearEquationSolverType(storm::solver::EquationSolverType const &value, bool isSetFromDefault=false)
OviSolverEnvironment const & ovi() const
EigenSolverEnvironment & eigen()
MinMaxSolverEnvironment & minMax()
MultiplierEnvironment & multiplier()
storm::solver::EquationSolverType const & getLinearEquationSolverType() const
void setLinearEquationSolverPrecision(boost::optional< storm::RationalNumber > const &newPrecision, boost::optional< bool > const &relativePrecision=boost::none)
bool isLinearEquationSolverTypeSetFromDefaultValue() const
GameSolverEnvironment & game()
TimeBoundedSolverEnvironment & timeBounded()
NativeSolverEnvironment & native()
GmmxxSolverEnvironment & gmmxx()
LongRunAverageSolverEnvironment & lra()
std::pair< boost::optional< storm::RationalNumber >, boost::optional< bool > > getPrecisionOfLinearEquationSolver(storm::solver::EquationSolverType const &solverType) const
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:11
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:30
SettingsType const & getModule()
Get module.
LabParser.cpp.
Definition cli.cpp:18