1#include "storm-config.h"
13class DoubleViEnvironment {
15 typedef double ValueType;
16 static const bool isExact =
false;
17 static storm::Environment createEnvironment() {
18 storm::Environment env;
25class DoubleViRegMultEnvironment {
27 typedef double ValueType;
28 static const bool isExact =
false;
29 static storm::Environment createEnvironment() {
30 storm::Environment env;
38class DoubleSoundViEnvironment {
40 typedef double ValueType;
41 static const bool isExact =
false;
42 static storm::Environment createEnvironment() {
43 storm::Environment env;
51class DoubleIntervalIterationEnvironment {
53 typedef double ValueType;
54 static const bool isExact =
false;
55 static storm::Environment createEnvironment() {
56 storm::Environment env;
64class DoubleGuessingViEnvironment {
66 typedef double ValueType;
67 static const bool isExact =
false;
68 static storm::Environment createEnvironment() {
69 storm::Environment env;
77class DoubleOptimisticViEnvironment {
79 typedef double ValueType;
80 static const bool isExact =
false;
81 static storm::Environment createEnvironment() {
82 storm::Environment env;
90class DoubleTopologicalViEnvironment {
92 typedef double ValueType;
93 static const bool isExact =
false;
94 static storm::Environment createEnvironment() {
95 storm::Environment env;
103class DoublePIEnvironment {
105 typedef double ValueType;
106 static const bool isExact =
false;
107 static storm::Environment createEnvironment() {
108 storm::Environment env;
117class RationalPIEnvironment {
119 typedef storm::RationalNumber ValueType;
120 static const bool isExact =
true;
121 static storm::Environment createEnvironment() {
122 storm::Environment env;
127class RationalRationalSearchEnvironment {
129 typedef storm::RationalNumber ValueType;
130 static const bool isExact =
true;
131 static storm::Environment createEnvironment() {
132 storm::Environment env;
138template<
typename TestType>
139class MinMaxLinearEquationSolverTest :
public ::testing::Test {
141 typedef typename TestType::ValueType ValueType;
142 MinMaxLinearEquationSolverTest() : _environment(TestType::createEnvironment()) {}
143 storm::Environment
const& env()
const {
146 ValueType precision()
const {
149 ValueType
parseNumber(std::string
const& input)
const {
154 storm::Environment _environment;
157typedef ::testing::Types<DoubleViEnvironment, DoubleViRegMultEnvironment, DoubleSoundViEnvironment, DoubleIntervalIterationEnvironment,
158 DoubleOptimisticViEnvironment, DoubleGuessingViEnvironment, DoubleTopologicalViEnvironment, DoublePIEnvironment, RationalPIEnvironment,
159 RationalRationalSearchEnvironment>
164TYPED_TEST(MinMaxLinearEquationSolverTest, SolveEquations) {
165 typedef typename TestFixture::ValueType
ValueType;
168 ASSERT_NO_THROW(builder.newRowGroup(0));
169 ASSERT_NO_THROW(builder.addNextValue(0, 0, this->parseNumber(
"0.9")));
172 ASSERT_NO_THROW(A = builder.build(2));
174 std::vector<ValueType> x(1);
178 auto solver = factory.create(this->env(), A);
179 solver->setHasUniqueSolution(
true);
180 solver->setHasNoEndComponents(
true);
185 ASSERT_NO_THROW(solver->solveEquations(this->env(), storm::OptimizationDirection::Minimize, x, b));
186 EXPECT_NEAR(x[0], this->
parseNumber(
"0.5"), this->precision());
188 ASSERT_NO_THROW(solver->solveEquations(this->env(), storm::OptimizationDirection::Maximize, x, b));
189 EXPECT_NEAR(x[0], this->
parseNumber(
"0.99"), this->precision());
SolverEnvironment & solver()
void setMultiplicationStyle(storm::solver::MultiplicationStyle value)
storm::RationalNumber const & getPrecision() const
void setPrecision(storm::RationalNumber value)
void setMethod(storm::solver::MinMaxMethod value, bool isSetFromDefault=false)
void setMethod(storm::solver::NativeLinearEquationSolverMethod value)
TopologicalSolverEnvironment & topological()
void setLinearEquationSolverType(storm::solver::EquationSolverType const &value, bool isSetFromDefault=false)
MinMaxSolverEnvironment & minMax()
void setForceSoundness(bool value)
void setLinearEquationSolverPrecision(boost::optional< storm::RationalNumber > const &newPrecision, boost::optional< bool > const &relativePrecision=boost::none)
NativeSolverEnvironment & native()
void setUnderlyingMinMaxMethod(storm::solver::MinMaxMethod value)
bool hasEnabledRequirement() const
A class that can be used to build a sparse matrix by adding value by value.
A class that holds a possibly non-square matrix in the compressed row storage format.
SFTBDDChecker::ValueType ValueType
NumberType parseNumber(std::string const &value)
Parse number from string.
TargetType convertNumber(SourceType const &number)
TYPED_TEST(GraphTestAR, SymbolicProb01StochasticGameDieSmall)
TYPED_TEST_SUITE(GraphTestAR, TestingTypes,)
::testing::Types< Cudd, Sylvan > TestingTypes