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 NativeDoubleGuessingViEnvironment {
88 static const bool isExact =
false;
93 env.
solver().
native().
setMethod(storm::solver::NativeLinearEquationSolverMethod::GuessingValueIteration);
100class NativeDoubleJacobiEnvironment {
103 static const bool isExact =
false;
113class NativeDoubleGaussSeidelEnvironment {
116 static const bool isExact =
false;
126class NativeDoubleSorEnvironment {
129 static const bool isExact =
false;
139class NativeDoubleWalkerChaeEnvironment {
142 static const bool isExact =
false;
153class NativeRationalRationalSearchEnvironment {
156 static const bool isExact =
true;
165class EliminationRationalEnvironment {
168 static const bool isExact =
true;
176class GmmGmresIluEnvironment {
179 static const bool isExact =
false;
190class GmmGmresDiagonalEnvironment {
193 static const bool isExact =
false;
204class GmmGmresNoneEnvironment {
207 static const bool isExact =
false;
218class GmmBicgstabIluEnvironment {
221 static const bool isExact =
false;
232class GmmQmrDiagonalEnvironment {
235 static const bool isExact =
false;
246class EigenDGmresDiagonalEnvironment {
249 static const bool isExact =
false;
260class EigenGmresIluEnvironment {
263 static const bool isExact =
false;
274class EigenBicgstabNoneEnvironment {
277 static const bool isExact =
false;
288class EigenDoubleLUEnvironment {
291 static const bool isExact =
false;
300class EigenRationalLUEnvironment {
303 static const bool isExact =
true;
312class TopologicalEigenRationalLUEnvironment {
315 static const bool isExact =
true;
325template<
typename TestType>
326class LinearEquationSolverTest :
public ::testing::Test {
328 typedef typename TestType::ValueType
ValueType;
329 LinearEquationSolverTest() : _environment(TestType::createEnvironment()) {}
337 return storm::utility::convertNumber<ValueType>(input);
344typedef ::testing::Types<NativeDoublePowerEnvironment, NativeDoublePowerRegMultEnvironment, NativeDoubleSoundValueIterationEnvironment,
345 NativeDoubleOptimisticValueIterationEnvironment, NativeDoubleGuessingViEnvironment, NativeDoubleIntervalIterationEnvironment,
346 NativeDoubleJacobiEnvironment, NativeDoubleGaussSeidelEnvironment, NativeDoubleSorEnvironment, NativeDoubleWalkerChaeEnvironment,
347 NativeRationalRationalSearchEnvironment, EliminationRationalEnvironment,
349 GmmGmresIluEnvironment, GmmGmresDiagonalEnvironment, GmmGmresNoneEnvironment, GmmBicgstabIluEnvironment, GmmQmrDiagonalEnvironment,
351 EigenDGmresDiagonalEnvironment, EigenGmresIluEnvironment, EigenBicgstabNoneEnvironment, EigenDoubleLUEnvironment,
352 EigenRationalLUEnvironment, TopologicalEigenRationalLUEnvironment>
357TYPED_TEST(LinearEquationSolverTest, solveEquationSystem) {
358 typedef typename TestFixture::ValueType
ValueType;
361 ASSERT_NO_THROW(builder.
addNextValue(0, 0, this->parseNumber(
"1/5")));
362 ASSERT_NO_THROW(builder.
addNextValue(0, 1, this->parseNumber(
"2/5")));
363 ASSERT_NO_THROW(builder.
addNextValue(0, 2, this->parseNumber(
"2/5")));
364 ASSERT_NO_THROW(builder.
addNextValue(1, 0, this->parseNumber(
"1/50")));
365 ASSERT_NO_THROW(builder.
addNextValue(1, 1, this->parseNumber(
"48/50")));
366 ASSERT_NO_THROW(builder.
addNextValue(1, 2, this->parseNumber(
"1/50")));
367 ASSERT_NO_THROW(builder.
addNextValue(2, 0, this->parseNumber(
"4/10")));
368 ASSERT_NO_THROW(builder.
addNextValue(2, 1, this->parseNumber(
"3/10")));
369 ASSERT_NO_THROW(builder.
addNextValue(2, 2, this->parseNumber(
"0")));
372 ASSERT_NO_THROW(A = builder.
build());
374 std::vector<ValueType> x(3);
382 auto requirements = factory.getRequirements(this->env());
383 requirements.clearUpperBounds();
384 requirements.clearLowerBounds();
385 ASSERT_FALSE(requirements.hasEnabledRequirement());
386 auto solver = factory.create(this->env(), A);
388 ASSERT_NO_THROW(solver->solveEquations(this->env(), x, b));
389 EXPECT_NEAR(x[0], this->
parseNumber(
"481/9"), this->precision());
390 EXPECT_NEAR(x[1], this->
parseNumber(
"457/9"), this->precision());
391 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