Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SolverEnvironment.cpp
Go to the documentation of this file.
2
4
11
14
15namespace storm {
16
19 forceSoundness = generalSettings.isSoundSet();
20 forceExact = generalSettings.isExactSet() || generalSettings.isExactFinitePrecisionSet();
21 linearEquationSolverType = storm::settings::getModule<storm::settings::modules::CoreSettings>().getEquationSolver();
22 linearEquationSolverTypeSetFromDefault = storm::settings::getModule<storm::settings::modules::CoreSettings>().isEquationSolverSetFromDefaultValue();
24 lpSolverTypeSetFromDefault = storm::settings::getModule<storm::settings::modules::CoreSettings>().isLpSolverSetFromDefaultValue();
26}
27
29 // Intentionally left empty
30}
31
33 return longRunAverageSolverEnvironment.get();
34}
35
37 return longRunAverageSolverEnvironment.get();
38}
39
41 return timeBoundedSolverEnvironment.get();
42}
43
45 return timeBoundedSolverEnvironment.get();
46}
47
49 return minMaxSolverEnvironment.get();
50}
51
53 return minMaxSolverEnvironment.get();
54}
55
57 return multiplierEnvironment.get();
58}
59
61 return multiplierEnvironment.get();
62}
63
65 return eigenSolverEnvironment.get();
66}
67
69 return eigenSolverEnvironment.get();
70}
71
73 return gmmxxSolverEnvironment.get();
74}
75
77 return gmmxxSolverEnvironment.get();
78}
79
81 return nativeSolverEnvironment.get();
82}
83
85 return nativeSolverEnvironment.get();
86}
87
89 return gameSolverEnvironment.get();
90}
91
93 return gameSolverEnvironment.get();
94}
95
97 return topologicalSolverEnvironment.get();
98}
99
101 return topologicalSolverEnvironment.get();
102}
103
105 return eliminationSolverEnvironment.get();
106}
107
109 return eliminationSolverEnvironment.get();
110}
111
113 return oviSolverEnvironment.get();
114}
115
117 return oviSolverEnvironment.get();
118}
119
121 return gurobiSolverEnvironment.get();
122}
123
125 return gurobiSolverEnvironment.get();
126}
127
129 return glpkSolverEnvironment.get();
130}
131
133 return glpkSolverEnvironment.get();
134}
135
137 return forceSoundness;
138}
139
141 SolverEnvironment::forceSoundness = value;
142}
143
145 return forceExact;
146}
147
149 SolverEnvironment::forceExact = value;
150}
151
153 return debug;
154}
155
157 SolverEnvironment::debug = value;
158}
159
160storm::solver::EquationSolverType const& SolverEnvironment::getLinearEquationSolverType() const {
161 return linearEquationSolverType;
162}
163
164void SolverEnvironment::setLinearEquationSolverType(storm::solver::EquationSolverType const& value, bool isSetFromDefault) {
165 linearEquationSolverTypeSetFromDefault = isSetFromDefault;
166 linearEquationSolverType = value;
167}
168
170 return linearEquationSolverTypeSetFromDefault;
171}
172
173storm::solver::LpSolverType const& SolverEnvironment::getLpSolverType() const {
174 return lpSolverType;
175}
176
177void SolverEnvironment::setLpSolverType(storm::solver::LpSolverType const& value, bool isSetFromDefault) {
178 lpSolverTypeSetFromDefault = isSetFromDefault;
179 lpSolverType = value;
180}
181
183 return lpSolverTypeSetFromDefault;
184}
185
186std::pair<boost::optional<storm::RationalNumber>, boost::optional<bool>> SolverEnvironment::getPrecisionOfLinearEquationSolver(
187 storm::solver::EquationSolverType const& solverType) const {
188 std::pair<boost::optional<storm::RationalNumber>, boost::optional<bool>> result;
189 switch (solverType) {
190 case storm::solver::EquationSolverType::Gmmxx:
191 result.first = gmmxx().getPrecision();
192 break;
193 case storm::solver::EquationSolverType::Eigen:
194 result.first = eigen().getPrecision();
195 break;
196 case storm::solver::EquationSolverType::Native:
197 result.first = native().getPrecision();
198 result.second = native().getRelativeTerminationCriterion();
199 break;
200 case storm::solver::EquationSolverType::Elimination:
201 break;
202 case storm::solver::EquationSolverType::Topological:
203 result = getPrecisionOfLinearEquationSolver(topological().getUnderlyingEquationSolverType());
204 break;
205 default:
206 STORM_LOG_THROW(false, storm::exceptions::UnexpectedException, "The selected solver type is unknown.");
207 }
208 return result;
209}
210
211void SolverEnvironment::setLinearEquationSolverPrecision(boost::optional<storm::RationalNumber> const& newPrecision,
212 boost::optional<bool> const& relativePrecision) {
213 // Assert that each solver type is handled in this method.
214 STORM_LOG_ASSERT(getLinearEquationSolverType() == storm::solver::EquationSolverType::Native ||
215 getLinearEquationSolverType() == storm::solver::EquationSolverType::Gmmxx ||
216 getLinearEquationSolverType() == storm::solver::EquationSolverType::Eigen ||
217 getLinearEquationSolverType() == storm::solver::EquationSolverType::Elimination ||
218 getLinearEquationSolverType() == storm::solver::EquationSolverType::Topological,
219 "The current solver type is not respected in this method.");
220 if (newPrecision) {
221 native().setPrecision(newPrecision.get());
222 gmmxx().setPrecision(newPrecision.get());
223 eigen().setPrecision(newPrecision.get());
224 // Elimination and Topological solver do not have a precision
225 }
226 if (relativePrecision) {
227 native().setRelativeTerminationCriterion(relativePrecision.get());
228 // gmm, eigen, elimination, and topological solvers do not have a precision
229 }
230}
231} // 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)
EliminationSolverEnvironment & elimination()
bool isLinearEquationSolverTypeSetFromDefaultValue() const
GlpkSolverEnvironment & glpk()
bool isLpSolverTypeSetFromDefaultValue() const
GameSolverEnvironment & game()
void setLpSolverType(storm::solver::LpSolverType const &value, bool isSetFromDefault=false)
TimeBoundedSolverEnvironment & timeBounded()
storm::solver::LpSolverType const & getLpSolverType() const
NativeSolverEnvironment & native()
GurobiSolverEnvironment & gurobi()
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:9
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28
SettingsType const & getModule()
Get module.