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;
177class GmmGmresIluEnvironment {
180 static const bool isExact =
false;
191class GmmGmresDiagonalEnvironment {
194 static const bool isExact =
false;
205class GmmGmresNoneEnvironment {
208 static const bool isExact =
false;
219class GmmBicgstabIluEnvironment {
222 static const bool isExact =
false;
233class GmmQmrDiagonalEnvironment {
236 static const bool isExact =
false;
248class EigenDGmresDiagonalEnvironment {
251 static const bool isExact =
false;
262class EigenGmresIluEnvironment {
265 static const bool isExact =
false;
276class EigenBicgstabNoneEnvironment {
279 static const bool isExact =
false;
290class EigenDoubleLUEnvironment {
293 static const bool isExact =
false;
302class EigenRationalLUEnvironment {
305 static const bool isExact =
true;
314class TopologicalEigenRationalLUEnvironment {
317 static const bool isExact =
true;
327template<
typename TestType>
328class LinearEquationSolverTest :
public ::testing::Test {
330 typedef typename TestType::ValueType
ValueType;
331 LinearEquationSolverTest() : _environment(TestType::createEnvironment()) {}
339 return storm::utility::convertNumber<ValueType>(input);
346typedef ::testing::Types<NativeDoublePowerEnvironment, NativeDoublePowerRegMultEnvironment, NativeDoubleSoundValueIterationEnvironment,
347 NativeDoubleOptimisticValueIterationEnvironment, NativeDoubleGuessingViEnvironment, NativeDoubleIntervalIterationEnvironment,
348 NativeDoubleJacobiEnvironment, NativeDoubleGaussSeidelEnvironment, NativeDoubleSorEnvironment, NativeDoubleWalkerChaeEnvironment,
349 NativeRationalRationalSearchEnvironment, EliminationRationalEnvironment,
351 GmmGmresIluEnvironment, GmmGmresDiagonalEnvironment, GmmGmresNoneEnvironment, GmmBicgstabIluEnvironment, GmmQmrDiagonalEnvironment,
353 EigenDGmresDiagonalEnvironment, EigenGmresIluEnvironment, EigenBicgstabNoneEnvironment, EigenDoubleLUEnvironment,
354 EigenRationalLUEnvironment, TopologicalEigenRationalLUEnvironment>
359TYPED_TEST(LinearEquationSolverTest, solveEquationSystem) {
360 typedef typename TestFixture::ValueType
ValueType;
363 ASSERT_NO_THROW(builder.
addNextValue(0, 0, this->parseNumber(
"1/5")));
364 ASSERT_NO_THROW(builder.
addNextValue(0, 1, this->parseNumber(
"2/5")));
365 ASSERT_NO_THROW(builder.
addNextValue(0, 2, this->parseNumber(
"2/5")));
366 ASSERT_NO_THROW(builder.
addNextValue(1, 0, this->parseNumber(
"1/50")));
367 ASSERT_NO_THROW(builder.
addNextValue(1, 1, this->parseNumber(
"48/50")));
368 ASSERT_NO_THROW(builder.
addNextValue(1, 2, this->parseNumber(
"1/50")));
369 ASSERT_NO_THROW(builder.
addNextValue(2, 0, this->parseNumber(
"4/10")));
370 ASSERT_NO_THROW(builder.
addNextValue(2, 1, this->parseNumber(
"3/10")));
371 ASSERT_NO_THROW(builder.
addNextValue(2, 2, this->parseNumber(
"0")));
374 ASSERT_NO_THROW(A = builder.
build());
376 std::vector<ValueType> x(3);
384 auto requirements = factory.getRequirements(this->env());
385 requirements.clearUpperBounds();
386 requirements.clearLowerBounds();
387 ASSERT_FALSE(requirements.hasEnabledRequirement());
388 auto solver = factory.create(this->env(), A);
390 ASSERT_NO_THROW(solver->solveEquations(this->env(), x, b));
391 EXPECT_NEAR(x[0], this->
parseNumber(
"481/9"), this->precision());
392 EXPECT_NEAR(x[1], this->
parseNumber(
"457/9"), this->precision());
393 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