Browse Source

adapted counterexample generation to refactoring

Former-commit-id: e73d2885cd
tempestpy_adaptions
dehnert 9 years ago
parent
commit
7f5e775395
  1. 6
      src/adapters/Z3ExpressionAdapter.h
  2. 4
      src/builder/DdPrismModelBuilder.cpp
  3. 18
      src/counterexamples/SMTMinimalCommandSetGenerator.h
  4. 1
      src/models/symbolic/StandardRewardModel.cpp
  5. 2
      src/parser/FormulaParser.cpp
  6. 4
      test/functional/adapter/MathsatExpressionAdapterTest.cpp
  7. 32
      test/performance/modelchecker/GmmxxMdpPrctlModelCheckerTest.cpp
  8. 32
      test/performance/modelchecker/NativeMdpPrctlModelCheckerTest.cpp
  9. 32
      test/performance/modelchecker/TopologicalValueIterationMdpPrctlModelCheckerTest.cpp

6
src/adapters/Z3ExpressionAdapter.h

@ -5,6 +5,7 @@
#include <vector>
#include "storm-config.h"
// Include the headers of Z3 only if it is available.
#ifdef STORM_HAVE_Z3
#include "z3++.h"
@ -28,13 +29,15 @@ namespace storm {
* context needs to be guaranteed as long as the instance of this adapter is used.
*/
Z3ExpressionAdapter(storm::expressions::ExpressionManager& manager, z3::context& context);
/*!
* Translates the given expression to an equivalent expression for Z3.
*
* @param expression The expression to translate.
* @return An equivalent expression for Z3.
*/
z3::expr translateExpression(storm::expressions::Expression const& expression);
z3::expr translateExpression(storm::expressions::Expression const& expression);
/*!
* Translates the given variable to an equivalent expression for Z3.
*
@ -43,7 +46,6 @@ namespace storm {
*/
z3::expr translateExpression(storm::expressions::Variable const& variable);
storm::expressions::Expression translateExpression(z3::expr const& expr);
/*!
* Finds the counterpart to the given z3 variable declaration.

4
src/builder/DdPrismModelBuilder.cpp

@ -107,6 +107,8 @@ namespace storm {
int_fast64_t high = integerVariable.getUpperBoundExpression().evaluateAsInt();
std::pair<storm::expressions::Variable, storm::expressions::Variable> variablePair = manager->addMetaVariable(integerVariable.getName(), low, high);
STORM_LOG_TRACE("Created meta variables for global integer variable: " << variablePair.first.getName() << "[" << variablePair.first.getIndex() << "] and " << variablePair.second.getName() << "[" << variablePair.second.getIndex() << "]");
rowMetaVariables.insert(variablePair.first);
variableToRowMetaVariableMap.emplace(integerVariable.getExpressionVariable(), variablePair.first);
@ -120,6 +122,8 @@ namespace storm {
for (storm::prism::BooleanVariable const& booleanVariable : program.getGlobalBooleanVariables()) {
std::pair<storm::expressions::Variable, storm::expressions::Variable> variablePair = manager->addMetaVariable(booleanVariable.getName());
STORM_LOG_TRACE("Created meta variables for global boolean variable: " << variablePair.first.getName() << "[" << variablePair.first.getIndex() << "] and " << variablePair.second.getName() << "[" << variablePair.second.getIndex() << "]");
rowMetaVariables.insert(variablePair.first);
variableToRowMetaVariableMap.emplace(booleanVariable.getExpressionVariable(), variablePair.first);

18
src/counterexamples/SMTMinimalCommandSetGenerator.h

@ -8,7 +8,7 @@
#include "src/storage/prism/Program.h"
#include "src/storage/expressions/Expression.h"
#include "src/modelchecker/prctl/SparseMdpPrctlModelChecker.h"
#include "src/modelchecker/prctl/helper/SparseMdpPrctlHelper.h"
#include "src/modelchecker/results/ExplicitQuantitativeCheckResult.h"
#include "src/solver/GmmxxMinMaxLinearEquationSolver.h"
#include "src/settings/SettingsManager.h"
@ -190,7 +190,6 @@ namespace storm {
variableInformation.hasReachabilityVariables = true;
storm::storage::SparseMatrix<T> const& transitionMatrix = labeledMdp.getTransitionMatrix();
std::vector<uint_fast64_t> const& nondeterministicChoiceIndices = labeledMdp.getNondeterministicChoiceIndices();
for (auto state : relevancyInformation.relevantStates) {
variableInformation.relevantStatesToOrderVariableIndexMap[state] = variableInformation.stateOrderVariables.size();
@ -286,7 +285,6 @@ namespace storm {
// Get some data from the MDP for convenient access.
storm::storage::SparseMatrix<T> const& transitionMatrix = labeledMdp.getTransitionMatrix();
std::vector<uint_fast64_t> const& nondeterministicChoiceIndices = labeledMdp.getNondeterministicChoiceIndices();
storm::storage::BitVector const& initialStates = labeledMdp.getInitialStates();
std::vector<boost::container::flat_set<uint_fast64_t>> const& choiceLabeling = labeledMdp.getChoiceLabeling();
storm::storage::SparseMatrix<T> backwardTransitions = labeledMdp.getBackwardTransitions();
@ -312,7 +310,7 @@ namespace storm {
for (auto const& entry : transitionMatrix.getRow(currentChoice)) {
if (relevancyInformation.relevantStates.get(entry.getColumn())) {
for (auto relevantChoice : relevancyInformation.relevantChoicesForRelevantStates.at(entry.getColumn())) {
followingLabels[choiceLabeling[currentChoice]].insert(choiceLabeling[currentChoice]);
followingLabels[choiceLabeling[currentChoice]].insert(choiceLabeling[relevantChoice]);
}
} else if (psiStates.get(entry.getColumn())) {
canReachTargetState = true;
@ -1628,8 +1626,9 @@ namespace storm {
// (1) Check whether its possible to exceed the threshold if checkThresholdFeasible is set.
double maximalReachabilityProbability = 0;
if (checkThresholdFeasible) {
storm::modelchecker::SparseMdpPrctlModelChecker<T> modelchecker(labeledMdp);
std::vector<T> result = modelchecker.computeUntilProbabilitiesHelper(false, phiStates, psiStates, false);
storm::modelchecker::helper::SparseMdpPrctlHelper<T> modelCheckerHelper;
LOG4CPLUS_DEBUG(logger, "Invoking model checker.");
std::vector<T> result = modelCheckerHelper.computeUntilProbabilities(false, labeledMdp.getTransitionMatrix(), labeledMdp.getBackwardTransitions(), phiStates, psiStates, false, storm::utility::solver::MinMaxLinearEquationSolverFactory<T>());
for (auto state : labeledMdp.getInitialStates()) {
maximalReachabilityProbability = std::max(maximalReachabilityProbability, result[state]);
}
@ -1679,7 +1678,6 @@ namespace storm {
uint_fast64_t iterations = 0;
uint_fast64_t currentBound = 0;
maximalReachabilityProbability = 0;
auto iterationTimer = std::chrono::high_resolution_clock::now();
uint_fast64_t zeroProbabilityCount = 0;
do {
LOG4CPLUS_DEBUG(logger, "Computing minimal command set.");
@ -1692,9 +1690,9 @@ namespace storm {
modelCheckingClock = std::chrono::high_resolution_clock::now();
commandSet.insert(relevancyInformation.knownLabels.begin(), relevancyInformation.knownLabels.end());
storm::models::sparse::Mdp<T> subMdp = labeledMdp.restrictChoiceLabels(commandSet);
storm::modelchecker::SparseMdpPrctlModelChecker<T> modelchecker(subMdp);
storm::modelchecker::helper::SparseMdpPrctlHelper<T> modelCheckerHelper;
LOG4CPLUS_DEBUG(logger, "Invoking model checker.");
std::vector<T> result = modelchecker.computeUntilProbabilitiesHelper(false, phiStates, psiStates, false);
std::vector<T> result = modelCheckerHelper.computeUntilProbabilities(false, subMdp.getTransitionMatrix(), subMdp.getBackwardTransitions(), phiStates, psiStates, false, storm::utility::solver::MinMaxLinearEquationSolverFactory<T>());
LOG4CPLUS_DEBUG(logger, "Computed model checking results.");
totalModelCheckingTime += std::chrono::high_resolution_clock::now() - modelCheckingClock;
@ -1769,7 +1767,7 @@ namespace storm {
storm::storage::BitVector phiStates;
storm::storage::BitVector psiStates;
storm::modelchecker::SparseMdpPrctlModelChecker<T> modelchecker(labeledMdp);
storm::modelchecker::SparseMdpPrctlModelChecker<storm::models::sparse::Mdp<T>> modelchecker(labeledMdp);
if (probabilityOperator.getSubformula().isUntilFormula()) {
storm::logic::UntilFormula const& untilFormula = probabilityOperator.getSubformula().asUntilFormula();

1
src/models/symbolic/StandardRewardModel.cpp

@ -89,7 +89,6 @@ namespace storm {
result += filterAdd * optionalStateRewardVector.get();
}
if (this->hasStateActionRewards()) {
optionalStateActionRewardVector.get().exportToDot("statActRew.dot");
result += filterAdd * optionalStateActionRewardVector.get();
}
if (this->hasTransitionRewards()) {

2
src/parser/FormulaParser.cpp

@ -202,8 +202,6 @@ namespace storm {
STORM_LOG_DEBUG("Parsed formula successfully.");
} catch (qi::expectation_failure<PositionIteratorType> const& e) {
STORM_LOG_THROW(false, storm::exceptions::WrongFormatException, e.what_);
// } catch (std::exception const& e) {
// STORM_LOG_THROW(false, storm::exceptions::WrongFormatException, "Could not parse formula: " << e.what());
}
return result;

4
test/functional/adapter/MathsatExpressionAdapterTest.cpp

@ -170,9 +170,7 @@ TEST(MathsatExpressionAdapter, MathsatToStormBasic) {
msat_env env = msat_create_env(config);
ASSERT_FALSE(MSAT_ERROR_ENV(env));
msat_destroy_config(config);
unsigned args = 2;
std::shared_ptr<storm::expressions::ExpressionManager> manager(new storm::expressions::ExpressionManager());
manager->declareBooleanVariable("x");
manager->declareBooleanVariable("y");

32
test/performance/modelchecker/GmmxxMdpPrctlModelCheckerTest.cpp

@ -17,7 +17,7 @@ TEST(GmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_EQ(abstractModel->getType(), storm::models::ModelType::Mdp);
// A parser that we use for conveniently constructing the formulas.
storm::parser::FormulaParser parser;
storm::parser::FormulaParser formulaParser;
std::shared_ptr<storm::models::sparse::Mdp<double>> mdp = abstractModel->as<storm::models::sparse::Mdp<double>>();
@ -26,42 +26,42 @@ TEST(GmxxMdpPrctlModelCheckerTest, AsynchronousLeader) {
storm::modelchecker::SparseMdpPrctlModelChecker<storm::models::sparse::Mdp<double>> checker(*mdp, std::unique_ptr<storm::utility::solver::MinMaxLinearEquationSolverFactory<double>>(new storm::utility::solver::GmmxxMinMaxLinearEquationSolverFactory<double>()));
std::shared_ptr<storm::logic::Formula> formula = parser.parseFromString("Pmin=? [F \"elected\"]");
std::shared_ptr<storm::logic::Formula> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"elected\"]");
std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult1 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(1.0, quantitativeResult1[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult2 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(1.0, quantitativeResult2[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmin=? [F<=25 \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F<=25 \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult3 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.0, quantitativeResult3[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F<=25 \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F<=25 \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult4 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.0, quantitativeResult4[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmin=? [F \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmin=? [F \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult5 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(6.172433512, quantitativeResult5[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmax=? [F \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmax=? [F \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult6 = result->asExplicitQuantitativeCheckResult<double>();
@ -75,7 +75,7 @@ TEST(GmxxMdpPrctlModelCheckerTest, Consensus) {
ASSERT_EQ(abstractModel->getType(), storm::models::ModelType::Mdp);
// A parser that we use for conveniently constructing the formulas.
storm::parser::FormulaParser parser;
storm::parser::FormulaParser formulaParser;
std::shared_ptr<storm::models::sparse::Mdp<double>> mdp = abstractModel->as<storm::models::sparse::Mdp<double>>();
@ -84,56 +84,56 @@ TEST(GmxxMdpPrctlModelCheckerTest, Consensus) {
storm::modelchecker::SparseMdpPrctlModelChecker<storm::models::sparse::Mdp<double>> checker(*mdp, std::unique_ptr<storm::utility::solver::MinMaxLinearEquationSolverFactory<double>>(new storm::utility::solver::GmmxxMinMaxLinearEquationSolverFactory<double>()));
std::shared_ptr<storm::logic::Formula> formula = parser.parseFromString("Pmin=? [F \"finished\"]");
std::shared_ptr<storm::logic::Formula> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"finished\"]");
std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult1 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(1.0, quantitativeResult1[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmin=? [F \"finished\" & \"all_coins_equal_0\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"finished\" & \"all_coins_equal_0\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult2 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.4374282832, quantitativeResult2[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F \"finished\" & \"all_coins_equal_1\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"finished\" & \"all_coins_equal_1\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult3 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.5293286369, quantitativeResult3[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F \"finished\" & !\"agree\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"finished\" & !\"agree\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult4 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.10414097, quantitativeResult4[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmin=? [F<=50 \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F<=50 \"finished\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult5 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.0, quantitativeResult5[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F<=50 \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F<=50 \"finished\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult6 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.0, quantitativeResult6[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmin=? [F \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmin=? [F \"finished\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult7 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(1725.593313, quantitativeResult7[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmax=? [F \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmax=? [F \"finished\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult8 = result->asExplicitQuantitativeCheckResult<double>();

32
test/performance/modelchecker/NativeMdpPrctlModelCheckerTest.cpp

@ -18,7 +18,7 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
ASSERT_EQ(abstractModel->getType(), storm::models::ModelType::Mdp);
// A parser that we use for conveniently constructing the formulas.
storm::parser::FormulaParser parser;
storm::parser::FormulaParser formulaParser;
std::shared_ptr<storm::models::sparse::Mdp<double>> mdp = abstractModel->as<storm::models::sparse::Mdp<double>>();
@ -27,42 +27,42 @@ TEST(SparseMdpPrctlModelCheckerTest, AsynchronousLeader) {
storm::modelchecker::SparseMdpPrctlModelChecker<storm::models::sparse::Mdp<double>> checker(*mdp, std::unique_ptr<storm::utility::solver::MinMaxLinearEquationSolverFactory<double>>(new storm::utility::solver::NativeMinMaxLinearEquationSolverFactory<double>()));
std::shared_ptr<storm::logic::Formula> formula = parser.parseFromString("Pmin=? [F \"elected\"]");
std::shared_ptr<storm::logic::Formula> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"elected\"]");
std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult1 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(1.0, quantitativeResult1[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult2 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(1.0, quantitativeResult2[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmin=? [F<=25 \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F<=25 \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult3 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.0, quantitativeResult3[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F<=25 \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F<=25 \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult4 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.0, quantitativeResult4[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmin=? [F \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmin=? [F \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult5 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(6.172433512, quantitativeResult5[0], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmax=? [F \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmax=? [F \"elected\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult6 = result->asExplicitQuantitativeCheckResult<double>();
@ -76,7 +76,7 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
ASSERT_EQ(abstractModel->getType(), storm::models::ModelType::Mdp);
// A parser that we use for conveniently constructing the formulas.
storm::parser::FormulaParser parser;
storm::parser::FormulaParser formulaParser;
std::shared_ptr<storm::models::sparse::Mdp<double>> mdp = abstractModel->as<storm::models::sparse::Mdp<double>>();
@ -85,56 +85,56 @@ TEST(SparseMdpPrctlModelCheckerTest, Consensus) {
storm::modelchecker::SparseMdpPrctlModelChecker<storm::models::sparse::Mdp<double>> checker(*mdp, std::unique_ptr<storm::utility::solver::MinMaxLinearEquationSolverFactory<double>>(new storm::utility::solver::NativeMinMaxLinearEquationSolverFactory<double>()));
std::shared_ptr<storm::logic::Formula> formula = parser.parseFromString("Pmin=? [F \"finished\"]");
std::shared_ptr<storm::logic::Formula> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"finished\"]");
std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult1 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(1.0, quantitativeResult1[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmin=? [F \"finished\" & \"all_coins_equal_0\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"finished\" & \"all_coins_equal_0\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult2 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.4374282832, quantitativeResult2[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F \"finished\" & \"all_coins_equal_1\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"finished\" & \"all_coins_equal_1\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult3 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.5293286369, quantitativeResult3[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F \"finished\" & !\"agree\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"finished\" & !\"agree\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult4 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.10414097, quantitativeResult4[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmin=? [F<=50 \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F<=50 \"finished\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult5 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.0, quantitativeResult5[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F<=50 \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F<=50 \"finished\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult6 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(0.0, quantitativeResult6[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmin=? [F \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmin=? [F \"finished\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult7 = result->asExplicitQuantitativeCheckResult<double>();
EXPECT_NEAR(1725.593313, quantitativeResult7[31168], storm::settings::nativeEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmax=? [F \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmax=? [F \"finished\"]");
result = checker.check(*formula);
storm::modelchecker::ExplicitQuantitativeCheckResult<double> quantitativeResult8 = result->asExplicitQuantitativeCheckResult<double>();

32
test/performance/modelchecker/TopologicalValueIterationMdpPrctlModelCheckerTest.cpp

@ -15,41 +15,41 @@ TEST(DISABLED_TopologicalValueIterationMdpPrctlModelCheckerTest, AsynchronousLea
std::shared_ptr<storm::models::sparse::Mdp<double>> mdp = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.tra", STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.lab", "", STORM_CPP_BASE_PATH "/examples/mdp/asynchronous_leader/leader7.trans.rew")->as<storm::models::sparse::Mdp<double>>();
// A parser that we use for conveniently constructing the formulas.
storm::parser::FormulaParser parser;
storm::parser::FormulaParser formulaParser;
ASSERT_EQ(mdp->getNumberOfStates(), 2095783ull);
ASSERT_EQ(mdp->getNumberOfTransitions(), 7714385ull);
storm::modelchecker::SparseMdpPrctlModelChecker<storm::models::sparse::Mdp<double>> checker(*mdp, std::unique_ptr<storm::utility::solver::MinMaxLinearEquationSolverFactory<double>>(new storm::utility::solver::TopologicalMinMaxLinearEquationSolverFactory<double>()));
std::shared_ptr<storm::logic::Formula> formula = parser.parseFromString("Pmin=? [F \"elected\"]");
std::shared_ptr<storm::logic::Formula> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"elected\"]");
std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(*formula);
ASSERT_NEAR(1.0, result->asExplicitQuantitativeCheckResult<double>()[0], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"elected\"]");
result = checker.check(*formula);
ASSERT_NEAR(1.0, result->asExplicitQuantitativeCheckResult<double>()[0], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmin=? [F<=25 \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F<=25 \"elected\"]");
result = checker.check(*formula);
ASSERT_NEAR(0.0, result->asExplicitQuantitativeCheckResult<double>()[0], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F<=25 \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F<=25 \"elected\"]");
result = checker.check(*formula);
ASSERT_NEAR(0.0, result->asExplicitQuantitativeCheckResult<double>()[0], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmin=? [F \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmin=? [F \"elected\"]");
result = checker.check(*formula);
ASSERT_NEAR(6.172433512, result->asExplicitQuantitativeCheckResult<double>()[0], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmax=? [F \"elected\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmax=? [F \"elected\"]");
result = checker.check(*formula);
ASSERT_NEAR(6.1724344, result->asExplicitQuantitativeCheckResult<double>()[0], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
@ -62,50 +62,50 @@ TEST(DISABLED_TopologicalValueIterationMdpPrctlModelCheckerTest, Consensus) {
std::shared_ptr<storm::models::sparse::Mdp<double>> mdp = storm::parser::AutoParser::parseModel(STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin4_6.tra", STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin4_6.lab", STORM_CPP_BASE_PATH "/examples/mdp/consensus/coin4_6.steps.state.rew", "")->as<storm::models::sparse::Mdp<double>>();
// A parser that we use for conveniently constructing the formulas.
storm::parser::FormulaParser parser;
storm::parser::FormulaParser formulaParser;
ASSERT_EQ(mdp->getNumberOfStates(), 63616ull);
ASSERT_EQ(mdp->getNumberOfTransitions(), 213472ull);
storm::modelchecker::SparseMdpPrctlModelChecker<storm::models::sparse::Mdp<double>> checker(*mdp, std::unique_ptr<storm::utility::solver::MinMaxLinearEquationSolverFactory<double>>(new storm::utility::solver::TopologicalMinMaxLinearEquationSolverFactory<double>()));
std::shared_ptr<storm::logic::Formula> formula = parser.parseFromString("Pmin=? [F \"finished\"]");
std::shared_ptr<storm::logic::Formula> formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"finished\"]");
std::unique_ptr<storm::modelchecker::CheckResult> result = checker.check(*formula);
ASSERT_NEAR(1.0, result->asExplicitQuantitativeCheckResult<double>()[31168], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmin=? [F \"finished\" & \"all_coins_equal_0\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F \"finished\" & \"all_coins_equal_0\"]");
result = checker.check(*formula);
ASSERT_NEAR(0.4374282832, result->asExplicitQuantitativeCheckResult<double>()[31168], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F \"finished\" & \"all_coins_equal_1\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"finished\" & \"all_coins_equal_1\"]");
result = checker.check(*formula);
ASSERT_NEAR(0.5293286369, result->asExplicitQuantitativeCheckResult<double>()[31168], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F \"finished\" & !\"agree\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F \"finished\" & !\"agree\"]");
result = checker.check(*formula);
ASSERT_NEAR(0.10414097, result->asExplicitQuantitativeCheckResult<double>()[31168], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmin=? [F<=50 \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmin=? [F<=50 \"finished\"]");
result = checker.check(*formula);
ASSERT_NEAR(0.0, result->asExplicitQuantitativeCheckResult<double>()[31168], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Pmax=? [F<=50 \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Pmax=? [F<=50 \"finished\"]");
result = checker.check(*formula);
ASSERT_NEAR(0.0, result->asExplicitQuantitativeCheckResult<double>()[31168], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmin=? [F \"finished\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmin=? [F \"finished\"]");
result = checker.check(*formula);
ASSERT_NEAR(1725.593313, result->asExplicitQuantitativeCheckResult<double>()[31168], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
formula = parser.parseFromString("Rmax=? [F \"finished\"\"]");
formula = formulaParser.parseSingleFormulaFromString("Rmax=? [F \"finished\"\"]");
result = checker.check(*formula);
ASSERT_NEAR(2183.142422, result->asExplicitQuantitativeCheckResult<double>()[31168], storm::settings::topologicalValueIterationEquationSolverSettings().getPrecision());
Loading…
Cancel
Save