Browse Source

More environments checked in Lra Dtmc test.

tempestpy_adaptions
Tim Quatmann 5 years ago
parent
commit
6110a677f5
  1. 91
      src/test/storm/modelchecker/prctl/dtmc/LraDtmcPrctlModelCheckerTest.cpp

91
src/test/storm/modelchecker/prctl/dtmc/LraDtmcPrctlModelCheckerTest.cpp

@ -16,80 +16,147 @@
#include "storm/environment/solver/NativeSolverEnvironment.h" #include "storm/environment/solver/NativeSolverEnvironment.h"
#include "storm/environment/solver/EigenSolverEnvironment.h" #include "storm/environment/solver/EigenSolverEnvironment.h"
#include "storm/environment/solver/GmmxxSolverEnvironment.h" #include "storm/environment/solver/GmmxxSolverEnvironment.h"
#include "storm/environment/solver/LongRunAverageSolverEnvironment.h"
#include "storm-parsers/parser/AutoParser.h" #include "storm-parsers/parser/AutoParser.h"
#include "storm/builder/ExplicitModelBuilder.h" #include "storm/builder/ExplicitModelBuilder.h"
namespace { namespace {
class GmmxxDoubleGmresEnvironment {
class GBGmmxxDoubleGmresEnvironment {
public: public:
typedef double ValueType; typedef double ValueType;
static const bool isExact = false; static const bool isExact = false;
static storm::Environment createEnvironment() { static storm::Environment createEnvironment() {
storm::Environment env; storm::Environment env;
env.solver().lra().setDetLraMethod(storm::solver::LraMethod::GainBiasEquations);
env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Gmmxx); env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Gmmxx);
env.solver().gmmxx().setMethod(storm::solver::GmmxxLinearEquationSolverMethod::Gmres); env.solver().gmmxx().setMethod(storm::solver::GmmxxLinearEquationSolverMethod::Gmres);
env.solver().gmmxx().setPreconditioner(storm::solver::GmmxxLinearEquationSolverPreconditioner::Ilu); env.solver().gmmxx().setPreconditioner(storm::solver::GmmxxLinearEquationSolverPreconditioner::Ilu);
env.solver().gmmxx().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8)); env.solver().gmmxx().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
env.solver().lra().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
return env; return env;
} }
}; };
class EigenDoubleDGmresEnvironment {
class GBEigenDoubleDGmresEnvironment {
public: public:
typedef double ValueType; typedef double ValueType;
static const bool isExact = false; static const bool isExact = false;
static storm::Environment createEnvironment() { static storm::Environment createEnvironment() {
storm::Environment env; storm::Environment env;
env.solver().lra().setDetLraMethod(storm::solver::LraMethod::GainBiasEquations);
env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Eigen); env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Eigen);
env.solver().eigen().setMethod(storm::solver::EigenLinearEquationSolverMethod::DGmres); env.solver().eigen().setMethod(storm::solver::EigenLinearEquationSolverMethod::DGmres);
env.solver().eigen().setPreconditioner(storm::solver::EigenLinearEquationSolverPreconditioner::Ilu); env.solver().eigen().setPreconditioner(storm::solver::EigenLinearEquationSolverPreconditioner::Ilu);
env.solver().lra().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
env.solver().eigen().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8)); env.solver().eigen().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
return env; return env;
} }
}; };
class EigenRationalLUEnvironment {
class GBEigenRationalLUEnvironment {
public: public:
typedef storm::RationalNumber ValueType; typedef storm::RationalNumber ValueType;
static const bool isExact = true; static const bool isExact = true;
static storm::Environment createEnvironment() { static storm::Environment createEnvironment() {
storm::Environment env; storm::Environment env;
env.solver().lra().setDetLraMethod(storm::solver::LraMethod::GainBiasEquations);
env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Eigen); env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Eigen);
env.solver().eigen().setMethod(storm::solver::EigenLinearEquationSolverMethod::SparseLU); env.solver().eigen().setMethod(storm::solver::EigenLinearEquationSolverMethod::SparseLU);
return env; return env;
} }
}; };
class NativeSorEnvironment {
class GBNativeSorEnvironment {
public: public:
typedef double ValueType; typedef double ValueType;
static const bool isExact = false; static const bool isExact = false;
static storm::Environment createEnvironment() { static storm::Environment createEnvironment() {
storm::Environment env; storm::Environment env;
env.solver().lra().setDetLraMethod(storm::solver::LraMethod::GainBiasEquations);
env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Native); env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Native);
env.solver().native().setMethod(storm::solver::NativeLinearEquationSolverMethod::SOR); env.solver().native().setMethod(storm::solver::NativeLinearEquationSolverMethod::SOR);
env.solver().native().setSorOmega(storm::utility::convertNumber<storm::RationalNumber>(0.8)); // A test fails if this is set to 0.9... env.solver().native().setSorOmega(storm::utility::convertNumber<storm::RationalNumber>(0.8)); // A test fails if this is set to 0.9...
env.solver().native().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8)); env.solver().native().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
env.solver().lra().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
return env; return env;
} }
}; };
class NativeWalkerChaeEnvironment {
class GBNativeWalkerChaeEnvironment {
public: public:
typedef double ValueType; typedef double ValueType;
static const bool isExact = false; static const bool isExact = false;
static storm::Environment createEnvironment() { static storm::Environment createEnvironment() {
storm::Environment env; storm::Environment env;
env.solver().lra().setDetLraMethod(storm::solver::LraMethod::GainBiasEquations);
env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Native); env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Native);
env.solver().native().setMethod(storm::solver::NativeLinearEquationSolverMethod::WalkerChae); env.solver().native().setMethod(storm::solver::NativeLinearEquationSolverMethod::WalkerChae);
env.solver().native().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8)); env.solver().native().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
env.solver().lra().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
env.solver().native().setMaximalNumberOfIterations(50000); env.solver().native().setMaximalNumberOfIterations(50000);
return env; return env;
} }
}; };
class DistrGmmxxDoubleGmresEnvironment {
public:
typedef double ValueType;
static const bool isExact = false;
static storm::Environment createEnvironment() {
storm::Environment env;
env.solver().lra().setDetLraMethod(storm::solver::LraMethod::LraDistributionEquations);
env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Gmmxx);
env.solver().gmmxx().setMethod(storm::solver::GmmxxLinearEquationSolverMethod::Gmres);
env.solver().gmmxx().setPreconditioner(storm::solver::GmmxxLinearEquationSolverPreconditioner::Ilu);
env.solver().gmmxx().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
env.solver().lra().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
return env;
}
};
class DistrEigenRationalLUEnvironment {
public:
typedef storm::RationalNumber ValueType;
static const bool isExact = true;
static storm::Environment createEnvironment() {
storm::Environment env;
env.solver().lra().setDetLraMethod(storm::solver::LraMethod::LraDistributionEquations);
env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Eigen);
env.solver().eigen().setMethod(storm::solver::EigenLinearEquationSolverMethod::SparseLU);
return env;
}
};
class DistrNativeWalkerChaeEnvironment {
public:
typedef double ValueType;
static const bool isExact = false;
static storm::Environment createEnvironment() {
storm::Environment env;
env.solver().lra().setDetLraMethod(storm::solver::LraMethod::GainBiasEquations);
env.solver().setLinearEquationSolverType(storm::solver::EquationSolverType::Native);
env.solver().native().setMethod(storm::solver::NativeLinearEquationSolverMethod::WalkerChae);
env.solver().lra().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
env.solver().native().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
env.solver().native().setMaximalNumberOfIterations(50000);
return env;
}
};
class ValueIterationEnvironment {
public:
typedef double ValueType;
static const bool isExact = false;
static storm::Environment createEnvironment() {
storm::Environment env;
env.solver().lra().setDetLraMethod(storm::solver::LraMethod::ValueIteration);
env.solver().lra().setPrecision(storm::utility::convertNumber<storm::RationalNumber>(1e-8));
return env;
}
};
template<typename TestType> template<typename TestType>
class LraDtmcPrctlModelCheckerTest : public ::testing::Test { class LraDtmcPrctlModelCheckerTest : public ::testing::Test {
public: public:
@ -104,11 +171,15 @@ namespace {
}; };
typedef ::testing::Types< typedef ::testing::Types<
GmmxxDoubleGmresEnvironment,
EigenDoubleDGmresEnvironment,
EigenRationalLUEnvironment,
NativeSorEnvironment,
NativeWalkerChaeEnvironment
GBGmmxxDoubleGmresEnvironment,
GBEigenDoubleDGmresEnvironment,
GBEigenRationalLUEnvironment,
GBNativeSorEnvironment,
GBNativeWalkerChaeEnvironment,
DistrGmmxxDoubleGmresEnvironment,
DistrEigenRationalLUEnvironment,
DistrNativeWalkerChaeEnvironment,
ValueIterationEnvironment
> TestingTypes; > TestingTypes;
TYPED_TEST_SUITE(LraDtmcPrctlModelCheckerTest, TestingTypes,); TYPED_TEST_SUITE(LraDtmcPrctlModelCheckerTest, TestingTypes,);

Loading…
Cancel
Save