From 9bc402a20b46deb48ae5df5d418fc4b08278db1f Mon Sep 17 00:00:00 2001 From: Jip Spel Date: Fri, 17 Aug 2018 10:04:37 +0200 Subject: [PATCH] Remove states with transition with probability 1 from model --- src/storm-pars-cli/storm-pars.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/storm-pars-cli/storm-pars.cpp b/src/storm-pars-cli/storm-pars.cpp index 11d6a98bb..f97c67c8b 100644 --- a/src/storm-pars-cli/storm-pars.cpp +++ b/src/storm-pars-cli/storm-pars.cpp @@ -1,4 +1,6 @@ +#include +#include #include "storm-pars/api/storm-pars.h" #include "storm-pars/settings/ParsSettings.h" #include "storm-pars/settings/modules/ParametricSettings.h" @@ -612,6 +614,7 @@ namespace storm { STORM_LOG_THROW(model || input.properties.empty(), storm::exceptions::InvalidSettingsException, "No input model."); + if (model) { auto preprocessingResult = storm::pars::preprocessModel(model, input); if (preprocessingResult.second) { @@ -624,9 +627,21 @@ namespace storm { if (parSettings.isMonotonicityAnalysisSet()) { // Do something more fancy. std::cout << "Hello, Jip" << std::endl; + auto testModel = (model->as>()); + // TODO: check if it is a Dtmc + auto simplifier = storm::transformer::SparseParametricDtmcSimplifier>(*testModel); + - std::shared_ptr> sparseModel = model->as>(); std::vector> formulas = storm::api::extractFormulasFromProperties(input.properties); + STORM_LOG_THROW(formulas.begin()!=formulas.end(), storm::exceptions::NotSupportedException, "Only one formula at the time supported"); + + if (!simplifier.simplify(*(formulas[0]))) { + STORM_LOG_THROW(false, storm::exceptions::UnexpectedException, "Simplifying the model was not successfull."); + } + + + std::shared_ptr> sparseModel = simplifier.getSimplifiedModel();//->as>(); +// formulas = std::vector>({simplifier.getSimplifiedFormula()});//storm::api::extractFormulasFromProperties(input.properties); STORM_LOG_THROW((*(formulas[0])).isProbabilityOperatorFormula() && (*(formulas[0])).asProbabilityOperatorFormula().getSubformula().isUntilFormula(), storm::exceptions::NotSupportedException, "Expecting until formula"); storm::modelchecker::SparsePropositionalModelChecker> propositionalChecker(*sparseModel);