diff --git a/CMakeLists.txt b/CMakeLists.txt index 2abc6a992..9f6a50f70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,7 +85,7 @@ if(CMAKE_COMPILER_IS_GNUCC) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -funroll-loops") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -funroll-loops") add_definitions(-DBOOST_RESULT_OF_USE_DECLTYPE) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -pedantic -Wno-deprecated-declarations -Wno-unused-local-typedefs") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -Wall -pedantic -Wno-deprecated-declarations -Wno-unused-local-typedefs -Wno-unknown-pragmas") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -Wno-deprecated-declarations") # Turn on popcnt instruction if desired (yes by default) diff --git a/src/cli/entrypoints.h b/src/cli/entrypoints.h index 93f9e1777..4eaa264cb 100644 --- a/src/cli/entrypoints.h +++ b/src/cli/entrypoints.h @@ -3,6 +3,8 @@ #include "src/utility/storm.h" +#include "src/exceptions/NotImplementedException.h" + namespace storm { namespace cli { @@ -47,6 +49,11 @@ namespace storm { } #endif + template + void verifySymbolicModelWithAbstractionRefinementEngine(storm::prism::Program const& program, std::vector> const& formulas) { + STORM_LOG_THROW(false, storm::exceptions::NotImplementedException, "Abstraction Refinement is not yet implemented."); + } + template void verifySymbolicModelWithHybridEngine(std::shared_ptr> model, std::vector> const& formulas) { for (auto const& formula : formulas) { @@ -108,50 +115,56 @@ namespace storm { template void buildAndCheckSymbolicModel(storm::prism::Program const& program, std::vector> const& formulas) { - storm::storage::ModelProgramPair modelProgramPair = buildSymbolicModel(program, formulas); - STORM_LOG_THROW(modelProgramPair.model != nullptr, storm::exceptions::InvalidStateException, "Model could not be constructed for an unknown reason."); - - // Preprocess the model if needed. - BRANCH_ON_MODELTYPE(modelProgramPair.model, modelProgramPair.model, ValueType, LibraryType, preprocessModel, formulas); - - // Print some information about the model. - modelProgramPair.model->printModelInformationToStream(std::cout); + storm::settings::modules::GeneralSettings const& settings = storm::settings::generalSettings(); - // Verify the model, if a formula was given. - if (!formulas.empty()) { - // There may be constants of the model appearing in the formulas, so we replace all their occurrences - // by their definitions in the translated program. + if (settings.getEngine() == storm::settings::modules::GeneralSettings::Engine::AbstractionRefinement) { + verifySymbolicModelWithAbstractionRefinementEngine(program, formulas); + } else { + storm::storage::ModelProgramPair modelProgramPair = buildSymbolicModel(program, formulas); + STORM_LOG_THROW(modelProgramPair.model != nullptr, storm::exceptions::InvalidStateException, "Model could not be constructed for an unknown reason."); - // Start by building a mapping from constants of the (translated) model to their defining expressions. - std::map constantSubstitution; - for (auto const& constant : modelProgramPair.program.getConstants()) { - if (constant.isDefined()) { - constantSubstitution.emplace(constant.getExpressionVariable(), constant.getExpression()); - } - } + // Preprocess the model if needed. + BRANCH_ON_MODELTYPE(modelProgramPair.model, modelProgramPair.model, ValueType, LibraryType, preprocessModel, formulas); - std::vector> preparedFormulas; - for (auto const& formula : formulas) { - preparedFormulas.emplace_back(formula->substitute(constantSubstitution)); - } + // Print some information about the model. + modelProgramPair.model->printModelInformationToStream(std::cout); - if (modelProgramPair.model->isSparseModel()) { - if(storm::settings::generalSettings().isCounterexampleSet()) { - // If we were requested to generate a counterexample, we now do so for each formula. - for(auto const& formula : preparedFormulas) { - generateCounterexample(program, modelProgramPair.model->as>(), formula); + // Verify the model, if a formula was given. + if (!formulas.empty()) { + // There may be constants of the model appearing in the formulas, so we replace all their occurrences + // by their definitions in the translated program. + + // Start by building a mapping from constants of the (translated) model to their defining expressions. + std::map constantSubstitution; + for (auto const& constant : modelProgramPair.program.getConstants()) { + if (constant.isDefined()) { + constantSubstitution.emplace(constant.getExpressionVariable(), constant.getExpression()); } - } else { - verifySparseModel(modelProgramPair.model->as>(), preparedFormulas); } - } else if (modelProgramPair.model->isSymbolicModel()) { - if (storm::settings::generalSettings().getEngine() == storm::settings::modules::GeneralSettings::Engine::Hybrid) { - verifySymbolicModelWithHybridEngine(modelProgramPair.model->as>(), preparedFormulas); + + std::vector> preparedFormulas; + for (auto const& formula : formulas) { + preparedFormulas.emplace_back(formula->substitute(constantSubstitution)); + } + + if (modelProgramPair.model->isSparseModel()) { + if(settings.isCounterexampleSet()) { + // If we were requested to generate a counterexample, we now do so for each formula. + for(auto const& formula : preparedFormulas) { + generateCounterexample(program, modelProgramPair.model->as>(), formula); + } + } else { + verifySparseModel(modelProgramPair.model->as>(), preparedFormulas); + } + } else if (modelProgramPair.model->isSymbolicModel()) { + if (settings.getEngine() == storm::settings::modules::GeneralSettings::Engine::Hybrid) { + verifySymbolicModelWithHybridEngine(modelProgramPair.model->as>(), preparedFormulas); + } else { + verifySymbolicModelWithSymbolicEngine(modelProgramPair.model->as>(), preparedFormulas); + } } else { - verifySymbolicModelWithSymbolicEngine(modelProgramPair.model->as>(), preparedFormulas); + STORM_LOG_THROW(false, storm::exceptions::InvalidSettingsException, "Invalid input model type."); } - } else { - STORM_LOG_THROW(false, storm::exceptions::InvalidSettingsException, "Invalid input model type."); } } } diff --git a/src/parser/SpiritParserDefinitions.h b/src/parser/SpiritParserDefinitions.h index 20c922863..b4d1e183d 100644 --- a/src/parser/SpiritParserDefinitions.h +++ b/src/parser/SpiritParserDefinitions.h @@ -1,6 +1,9 @@ #ifndef STORM_PARSER_SPIRITPARSERDEFINITIONS_H_ #define STORM_PARSER_SPIRITPARSERDEFINITIONS_H_ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wno-#pragma-messages" + // Include boost spirit. #define BOOST_SPIRIT_USE_PHOENIX_V3 #include @@ -9,6 +12,8 @@ #include #include +#pragma clang diagnostic pop + namespace qi = boost::spirit::qi; namespace phoenix = boost::phoenix; diff --git a/src/settings/modules/GeneralSettings.cpp b/src/settings/modules/GeneralSettings.cpp index 701422587..95a48931b 100644 --- a/src/settings/modules/GeneralSettings.cpp +++ b/src/settings/modules/GeneralSettings.cpp @@ -96,9 +96,9 @@ namespace storm { .addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The file from which to read the choice labels.").addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).build()).build()); this->addOption(storm::settings::OptionBuilder(moduleName, dontFixDeadlockOptionName, false, "If the model contains deadlock states, they need to be fixed by setting this option.").setShortName(dontFixDeadlockOptionShortName).build()); - std::vector engines = {"sparse", "hybrid", "dd"}; + std::vector engines = {"sparse", "hybrid", "dd", "abs"}; this->addOption(storm::settings::OptionBuilder(moduleName, engineOptionName, false, "Sets which engine is used for model building and model checking.").setShortName(engineOptionShortName) - .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the engine to use. Available are {sparse, hybrid, dd}.").addValidationFunctionString(storm::settings::ArgumentValidators::stringInListValidator(engines)).setDefaultValueString("sparse").build()).build()); + .addArgument(storm::settings::ArgumentBuilder::createStringArgument("name", "The name of the engine to use. Available are {sparse, hybrid, dd, ar}.").addValidationFunctionString(storm::settings::ArgumentValidators::stringInListValidator(engines)).setDefaultValueString("sparse").build()).build()); std::vector linearEquationSolver = {"gmm++", "native"}; this->addOption(storm::settings::OptionBuilder(moduleName, eqSolverOptionName, false, "Sets which solver is preferred for solving systems of linear equations.") @@ -346,10 +346,11 @@ namespace storm { engine = GeneralSettings::Engine::Hybrid; } else if (engineStr == "dd") { engine = GeneralSettings::Engine::Dd; + } else if (engineStr == "abs") { + engine = GeneralSettings::Engine::AbstractionRefinement; } else { STORM_LOG_THROW(false, storm::exceptions::IllegalArgumentValueException, "Unknown engine '" << engineStr << "'."); } - } bool GeneralSettings::check() const { diff --git a/src/settings/modules/GeneralSettings.h b/src/settings/modules/GeneralSettings.h index d6803b600..8144c0a1f 100644 --- a/src/settings/modules/GeneralSettings.h +++ b/src/settings/modules/GeneralSettings.h @@ -27,7 +27,7 @@ namespace storm { // An enumeration of all engines. enum class Engine { - Sparse, Hybrid, Dd + Sparse, Hybrid, Dd, AbstractionRefinement }; /*! diff --git a/src/utility/storm.h b/src/utility/storm.h index af70bb89c..03e297ca5 100644 --- a/src/utility/storm.h +++ b/src/utility/storm.h @@ -232,6 +232,9 @@ namespace storm { STORM_LOG_THROW(ddModel != nullptr, storm::exceptions::InvalidArgumentException, "Dd engine requires a dd input model"); return verifySymbolicModelWithDdEngine(ddModel, formula); } + case storm::settings::modules::GeneralSettings::Engine::AbstractionRefinement: { + STORM_LOG_ASSERT(false, "This position should not be reached, as at this point no model has been built."); + } } }