1#include "storm-config.h"
13class NativeDoublePowerEnvironment {
16 static const bool isExact =
false;
26class NativeDoublePowerRegMultEnvironment {
29 static const bool isExact =
false;
40class NativeDoubleSoundValueIterationEnvironment {
43 static const bool isExact =
false;
48 env.
solver().
native().
setMethod(storm::solver::NativeLinearEquationSolverMethod::SoundValueIteration);
55class NativeDoubleOptimisticValueIterationEnvironment {
58 static const bool isExact =
false;
63 env.
solver().
native().
setMethod(storm::solver::NativeLinearEquationSolverMethod::OptimisticValueIteration);
70class NativeDoubleIntervalIterationEnvironment {
73 static const bool isExact =
false;
85class NativeDoubleJacobiEnvironment {
88 static const bool isExact =
false;
98class NativeDoubleGaussSeidelEnvironment {
101 static const bool isExact =
false;
111class NativeDoubleSorEnvironment {
114 static const bool isExact =
false;
124class NativeDoubleWalkerChaeEnvironment {
127 static const bool isExact =
false;
138class NativeRationalRationalSearchEnvironment {
141 static const bool isExact =
true;
150class EliminationRationalEnvironment {
153 static const bool isExact =
true;
161class GmmGmresIluEnvironment {
164 static const bool isExact =
false;
175class GmmGmresDiagonalEnvironment {
178 static const bool isExact =
false;
189class GmmGmresNoneEnvironment {
192 static const bool isExact =
false;
203class GmmBicgstabIluEnvironment {
206 static const bool isExact =
false;
217class GmmQmrDiagonalEnvironment {
220 static const bool isExact =
false;
231class EigenDGmresDiagonalEnvironment {
234 static const bool isExact =
false;
245class EigenGmresIluEnvironment {
248 static const bool isExact =
false;
259class EigenBicgstabNoneEnvironment {
262 static const bool isExact =
false;
273class EigenDoubleLUEnvironment {
276 static const bool isExact =
false;
285class EigenRationalLUEnvironment {
288 static const bool isExact =
true;
297class TopologicalEigenRationalLUEnvironment {
300 static const bool isExact =
true;
310template<
typename TestType>
311class LinearEquationSolverTest :
public ::testing::Test {
313 typedef typename TestType::ValueType
ValueType;
314 LinearEquationSolverTest() : _environment(TestType::createEnvironment()) {}
322 return storm::utility::convertNumber<ValueType>(input);
329typedef ::testing::Types<NativeDoublePowerEnvironment, NativeDoublePowerRegMultEnvironment, NativeDoubleSoundValueIterationEnvironment,
330 NativeDoubleOptimisticValueIterationEnvironment, NativeDoubleIntervalIterationEnvironment, NativeDoubleJacobiEnvironment,
331 NativeDoubleGaussSeidelEnvironment, NativeDoubleSorEnvironment, NativeDoubleWalkerChaeEnvironment,
332 NativeRationalRationalSearchEnvironment, EliminationRationalEnvironment, GmmGmresIluEnvironment, GmmGmresDiagonalEnvironment,
333 GmmGmresNoneEnvironment, GmmBicgstabIluEnvironment, GmmQmrDiagonalEnvironment, EigenDGmresDiagonalEnvironment,
334 EigenGmresIluEnvironment, EigenBicgstabNoneEnvironment, EigenDoubleLUEnvironment, EigenRationalLUEnvironment,
335 TopologicalEigenRationalLUEnvironment>
340TYPED_TEST(LinearEquationSolverTest, solveEquationSystem) {
341 typedef typename TestFixture::ValueType
ValueType;
344 ASSERT_NO_THROW(builder.
addNextValue(0, 0, this->parseNumber(
"1/5")));
345 ASSERT_NO_THROW(builder.
addNextValue(0, 1, this->parseNumber(
"2/5")));
346 ASSERT_NO_THROW(builder.
addNextValue(0, 2, this->parseNumber(
"2/5")));
347 ASSERT_NO_THROW(builder.
addNextValue(1, 0, this->parseNumber(
"1/50")));
348 ASSERT_NO_THROW(builder.
addNextValue(1, 1, this->parseNumber(
"48/50")));
349 ASSERT_NO_THROW(builder.
addNextValue(1, 2, this->parseNumber(
"1/50")));
350 ASSERT_NO_THROW(builder.
addNextValue(2, 0, this->parseNumber(
"4/10")));
351 ASSERT_NO_THROW(builder.
addNextValue(2, 1, this->parseNumber(
"3/10")));
352 ASSERT_NO_THROW(builder.
addNextValue(2, 2, this->parseNumber(
"0")));
355 ASSERT_NO_THROW(A = builder.
build());
357 std::vector<ValueType> x(3);
365 auto requirements = factory.getRequirements(this->env());
366 requirements.clearUpperBounds();
367 requirements.clearLowerBounds();
368 ASSERT_FALSE(requirements.hasEnabledRequirement());
369 auto solver = factory.create(this->env(), A);
371 ASSERT_NO_THROW(solver->solveEquations(this->env(), x, b));
372 EXPECT_NEAR(x[0], this->
parseNumber(
"481/9"), this->precision());
373 EXPECT_NEAR(x[1], this->
parseNumber(
"457/9"), this->precision());
374 EXPECT_NEAR(x[2], this->
parseNumber(
"875/18"), this->precision());
void setPrecision(storm::RationalNumber value)
void setPreconditioner(storm::solver::EigenLinearEquationSolverPreconditioner value)
void setMethod(storm::solver::EigenLinearEquationSolverMethod value)
SolverEnvironment & solver()
void setMethod(storm::solver::GmmxxLinearEquationSolverMethod value)
void setPrecision(storm::RationalNumber value)
void setPreconditioner(storm::solver::GmmxxLinearEquationSolverPreconditioner value)
void setPowerMethodMultiplicationStyle(storm::solver::MultiplicationStyle value)
void setMaximalNumberOfIterations(uint64_t value)
void setMethod(storm::solver::NativeLinearEquationSolverMethod value)
void setRelativeTerminationCriterion(bool value)
void setPrecision(storm::RationalNumber value)
TopologicalSolverEnvironment & topological()
void setLinearEquationSolverType(storm::solver::EquationSolverType const &value, bool isSetFromDefault=false)
EigenSolverEnvironment & eigen()
void setForceSoundness(bool value)
NativeSolverEnvironment & native()
GmmxxSolverEnvironment & gmmxx()
void setUnderlyingEquationSolverType(storm::solver::EquationSolverType value)
A class that can be used to build a sparse matrix by adding value by value.
void addNextValue(index_type row, index_type column, value_type const &value)
Sets the matrix entry at the given row and column to the given value.
SparseMatrix< value_type > build(index_type overriddenRowCount=0, index_type overriddenColumnCount=0, index_type overriddenRowGroupCount=0)
A class that holds a possibly non-square matrix in the compressed row storage format.
void convertToEquationSystem()
Transforms the matrix into an equation system.
SFTBDDChecker::ValueType ValueType
NumberType parseNumber(std::string const &value)
Parse number from string.
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes