Browse Source

extended counterexamples towards expected rewards, and moved counterexamples to a seperate lib (still in main cli) to slightly accelarate building times

tempestpy_adaptions
sjunges 7 years ago
parent
commit
6dfce6a405
  1. 1
      src/CMakeLists.txt
  2. 2
      src/storm-cli-utilities/CMakeLists.txt
  3. 2
      src/storm-cli-utilities/cli.cpp
  4. 2
      src/storm-cli-utilities/model-handling.h
  5. 40
      src/storm-counterexamples/CMakeLists.txt
  6. 2
      src/storm-counterexamples/api/counterexamples.cpp
  7. 4
      src/storm-counterexamples/api/counterexamples.h
  8. 2
      src/storm-counterexamples/counterexamples/Counterexample.cpp
  9. 0
      src/storm-counterexamples/counterexamples/Counterexample.h
  10. 2
      src/storm-counterexamples/counterexamples/HighLevelCounterexample.cpp
  11. 2
      src/storm-counterexamples/counterexamples/HighLevelCounterexample.h
  12. 4
      src/storm-counterexamples/counterexamples/MILPMinimalLabelSetGenerator.h
  13. 91
      src/storm-counterexamples/counterexamples/SMTMinimalLabelSetGenerator.h
  14. 2
      src/storm-counterexamples/settings/modules/CounterexampleGeneratorSettings.cpp
  15. 0
      src/storm-counterexamples/settings/modules/CounterexampleGeneratorSettings.h
  16. 2
      src/storm-pars/settings/ParsSettings.cpp
  17. 1
      src/storm/api/storm.h
  18. 2
      src/storm/settings/SettingsManager.cpp
  19. 1
      src/test/storm-pars/utility/ModelInstantiatorTest.cpp

1
src/CMakeLists.txt

@ -5,6 +5,7 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
add_custom_target(binaries) add_custom_target(binaries)
add_subdirectory(storm) add_subdirectory(storm)
add_subdirectory(storm-counterexamples)
add_subdirectory(storm-cli-utilities) add_subdirectory(storm-cli-utilities)
add_subdirectory(storm-pgcl) add_subdirectory(storm-pgcl)
add_subdirectory(storm-pgcl-cli) add_subdirectory(storm-pgcl-cli)

2
src/storm-cli-utilities/CMakeLists.txt

@ -17,7 +17,7 @@ set_target_properties(storm-cli-utilities PROPERTIES DEFINE_SYMBOL "")
list(APPEND STORM_TARGETS storm-cli-utilities) list(APPEND STORM_TARGETS storm-cli-utilities)
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE) set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE)
target_link_libraries(storm-cli-utilities PUBLIC storm)
target_link_libraries(storm-cli-utilities PUBLIC storm storm-counterexamples)
# Install storm headers to include directory. # Install storm headers to include directory.
foreach(HEADER ${STORM_CLI_UTIL_HEADERS}) foreach(HEADER ${STORM_CLI_UTIL_HEADERS})

2
src/storm-cli-utilities/cli.cpp

@ -49,6 +49,8 @@ namespace storm {
storm::cli::printHeader("Storm", argc, argv); storm::cli::printHeader("Storm", argc, argv);
storm::settings::initializeAll("Storm", "storm"); storm::settings::initializeAll("Storm", "storm");
storm::settings::addModule<storm::settings::modules::CounterexampleGeneratorSettings>();
storm::utility::Stopwatch totalTimer(true); storm::utility::Stopwatch totalTimer(true);
if (!storm::cli::parseOptions(argc, argv)) { if (!storm::cli::parseOptions(argc, argv)) {
return -1; return -1;

2
src/storm-cli-utilities/model-handling.h

@ -2,6 +2,8 @@
#include "storm/api/storm.h" #include "storm/api/storm.h"
#include "storm-counterexamples/api/counterexamples.h"
#include "storm/utility/resources.h" #include "storm/utility/resources.h"
#include "storm/utility/file.h" #include "storm/utility/file.h"
#include "storm/utility/storm-version.h" #include "storm/utility/storm-version.h"

40
src/storm-counterexamples/CMakeLists.txt

@ -0,0 +1,40 @@
file(GLOB_RECURSE ALL_FILES ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*.h ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*.cpp)
register_source_groups_from_filestructure("${ALL_FILES}" storm-counterexamples)
file(GLOB_RECURSE STORM_CEX_SOURCES ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*/*.cpp)
file(GLOB_RECURSE STORM_CEX_HEADERS ${PROJECT_SOURCE_DIR}/src/storm-counterexamples/*/*.h)
# Create storm-dft.
add_library(storm-counterexamples SHARED ${STORM_CEX_SOURCES} ${STORM_CEX_HEADERS})
# Remove define symbol for shared libstorm.
set_target_properties(storm-counterexamples PROPERTIES DEFINE_SYMBOL "")
#add_dependencies(storm resources)
list(APPEND STORM_TARGETS storm-counterexamples)
set(STORM_TARGETS ${STORM_TARGETS} PARENT_SCOPE)
target_link_libraries(storm-counterexamples PUBLIC storm)
# Install storm headers to include directory.
foreach(HEADER ${STORM_DFT_HEADERS})
string(REGEX REPLACE "${PROJECT_SOURCE_DIR}/src/?" "" RELATIVE_HEADER_PATH ${HEADER})
string(REGEX MATCH "(.*)[/\\]" RELATIVE_DIRECTORY ${RELATIVE_HEADER_PATH})
string(REGEX REPLACE "${RELATIVE_DIRECTORY}/?" "" HEADER_FILENAME ${RELATIVE_HEADER_PATH})
add_custom_command(
OUTPUT ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}
COMMAND ${CMAKE_COMMAND} -E copy ${HEADER} ${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}
DEPENDS ${HEADER}
)
list(APPEND STORM_CEX_OUTPUT_HEADERS "${CMAKE_BINARY_DIR}/include/${RELATIVE_DIRECTORY}${HEADER_FILENAME}")
endforeach()
add_custom_target(copy_storm_cex_headers DEPENDS ${STORM_CEX_OUTPUT_HEADERS} ${STORM_CEX_HEADERS})
add_dependencies(storm-counterexamples copy_storm_cex_headers)
# installation
install(TARGETS storm-counterexamples EXPORT storm_Targets RUNTIME DESTINATION bin LIBRARY DESTINATION lib OPTIONAL)

2
src/storm/api/counterexamples.cpp → src/storm-counterexamples/api/counterexamples.cpp

@ -1,4 +1,4 @@
#include "storm/api/counterexamples.h"
#include "storm-counterexamples/api/counterexamples.h"
#include "storm/environment/Environment.h" #include "storm/environment/Environment.h"

4
src/storm/api/counterexamples.h → src/storm-counterexamples/api/counterexamples.h

@ -1,7 +1,7 @@
#pragma once #pragma once
#include "storm/counterexamples/MILPMinimalLabelSetGenerator.h"
#include "storm/counterexamples/SMTMinimalLabelSetGenerator.h"
#include "storm-counterexamples/counterexamples/MILPMinimalLabelSetGenerator.h"
#include "storm-counterexamples/counterexamples/SMTMinimalLabelSetGenerator.h"
namespace storm { namespace storm {
namespace api { namespace api {

2
src/storm/counterexamples/Counterexample.cpp → src/storm-counterexamples/counterexamples/Counterexample.cpp

@ -1,4 +1,4 @@
#include "storm/counterexamples/Counterexample.h"
#include "storm-counterexamples/counterexamples/Counterexample.h"
namespace storm { namespace storm {
namespace counterexamples { namespace counterexamples {

0
src/storm/counterexamples/Counterexample.h → src/storm-counterexamples/counterexamples/Counterexample.h

2
src/storm/counterexamples/HighLevelCounterexample.cpp → src/storm-counterexamples/counterexamples/HighLevelCounterexample.cpp

@ -1,4 +1,4 @@
#include "storm/counterexamples/HighLevelCounterexample.h"
#include "storm-counterexamples/counterexamples/HighLevelCounterexample.h"
namespace storm { namespace storm {
namespace counterexamples { namespace counterexamples {

2
src/storm/counterexamples/HighLevelCounterexample.h → src/storm-counterexamples/counterexamples/HighLevelCounterexample.h

@ -1,6 +1,6 @@
#pragma once #pragma once
#include "storm/counterexamples/Counterexample.h"
#include "Counterexample.h"
#include "storm/storage/SymbolicModelDescription.h" #include "storm/storage/SymbolicModelDescription.h"

4
src/storm/counterexamples/MILPMinimalLabelSetGenerator.h → src/storm-counterexamples/counterexamples/MILPMinimalLabelSetGenerator.h

@ -17,7 +17,7 @@
#include "storm/solver/MinMaxLinearEquationSolver.h" #include "storm/solver/MinMaxLinearEquationSolver.h"
#include "storm/counterexamples/HighLevelCounterexample.h"
#include "storm-counterexamples/counterexamples/HighLevelCounterexample.h"
#include "storm/utility/graph.h" #include "storm/utility/graph.h"
#include "storm/utility/counterexamples.h" #include "storm/utility/counterexamples.h"
@ -29,7 +29,7 @@
#include "storm/settings/SettingsManager.h" #include "storm/settings/SettingsManager.h"
#include "storm/settings/modules/GeneralSettings.h" #include "storm/settings/modules/GeneralSettings.h"
#include "storm/settings/modules/CounterexampleGeneratorSettings.h"
#include "storm-counterexamples/settings/modules/CounterexampleGeneratorSettings.h"
namespace storm { namespace storm {

91
src/storm/counterexamples/SMTMinimalLabelSetGenerator.h → src/storm-counterexamples/counterexamples/SMTMinimalLabelSetGenerator.h

@ -5,7 +5,7 @@
#include "storm/solver/Z3SmtSolver.h" #include "storm/solver/Z3SmtSolver.h"
#include "storm/counterexamples/HighLevelCounterexample.h"
#include "storm-counterexamples/counterexamples/HighLevelCounterexample.h"
#include "storm/storage/prism/Program.h" #include "storm/storage/prism/Program.h"
#include "storm/storage/expressions/Expression.h" #include "storm/storage/expressions/Expression.h"
@ -1510,7 +1510,7 @@ namespace storm {
* Returns the sub-model obtained from removing all choices that do not originate from the specified filterLabelSet. * Returns the sub-model obtained from removing all choices that do not originate from the specified filterLabelSet.
* Also returns the Labelsets of the sub-model. * Also returns the Labelsets of the sub-model.
*/ */
static std::pair<std::shared_ptr<storm::models::sparse::Model<T>>, std::vector<boost::container::flat_set<uint_fast64_t>>> restrictModelToLabelSet(storm::models::sparse::Model<T> const& model, boost::container::flat_set<uint_fast64_t> const& filterLabelSet) {
static std::pair<std::shared_ptr<storm::models::sparse::Model<T>>, std::vector<boost::container::flat_set<uint_fast64_t>>> restrictModelToLabelSet(storm::models::sparse::Model<T> const& model, boost::container::flat_set<uint_fast64_t> const& filterLabelSet, boost::optional<uint64_t> absorbState = boost::none) {
bool customRowGrouping = model.isOfType(storm::models::ModelType::Mdp); bool customRowGrouping = model.isOfType(storm::models::ModelType::Mdp);
@ -1544,7 +1544,8 @@ namespace storm {
if (customRowGrouping) { if (customRowGrouping) {
transitionMatrixBuilder.newRowGroup(currentRow); transitionMatrixBuilder.newRowGroup(currentRow);
} }
transitionMatrixBuilder.addNextValue(currentRow, state, storm::utility::one<T>());
uint64_t targetState = absorbState == boost::none ? state : absorbState.get();
transitionMatrixBuilder.addNextValue(currentRow, targetState, storm::utility::one<T>());
// Insert an empty label set for this choice // Insert an empty label set for this choice
resultLabelSet.emplace_back(); resultLabelSet.emplace_back();
++currentRow; ++currentRow;
@ -1561,17 +1562,25 @@ namespace storm {
return std::make_pair(resultModel, std::move(resultLabelSet)); return std::make_pair(resultModel, std::move(resultLabelSet));
} }
static T computeMaximalReachabilityProbability(Environment const& env, storm::models::sparse::Model<T> const& model, storm::storage::BitVector const& phiStates, storm::storage::BitVector const& psiStates) {
static T computeMaximalReachabilityProbability(Environment const& env, storm::models::sparse::Model<T> const& model, storm::storage::BitVector const& phiStates, storm::storage::BitVector const& psiStates, boost::optional<std::string> const& rewardName) {
T result = storm::utility::zero<T>(); T result = storm::utility::zero<T>();
std::vector<T> allStatesResult; std::vector<T> allStatesResult;
STORM_LOG_DEBUG("Invoking model checker."); STORM_LOG_DEBUG("Invoking model checker.");
if (model.isOfType(storm::models::ModelType::Dtmc)) { if (model.isOfType(storm::models::ModelType::Dtmc)) {
allStatesResult = storm::modelchecker::helper::SparseDtmcPrctlHelper<T>::computeUntilProbabilities(env, false, model.getTransitionMatrix(), model.getBackwardTransitions(), phiStates, psiStates, false);
if (rewardName == boost::none) {
allStatesResult = storm::modelchecker::helper::SparseDtmcPrctlHelper<T>::computeUntilProbabilities(env, false, model.getTransitionMatrix(), model.getBackwardTransitions(), phiStates, psiStates, false);
} else {
allStatesResult = storm::modelchecker::helper::SparseDtmcPrctlHelper<T>::computeReachabilityRewards(env, false, model.getTransitionMatrix(), model.getBackwardTransitions(), model.getRewardModel(rewardName.get()), psiStates, false);
}
} else { } else {
storm::modelchecker::helper::SparseMdpPrctlHelper<T> modelCheckerHelper;
allStatesResult = std::move(modelCheckerHelper.computeUntilProbabilities(env, false, model.getTransitionMatrix(), model.getBackwardTransitions(), phiStates, psiStates, false, false).values);
if (rewardName == boost::none) {
storm::modelchecker::helper::SparseMdpPrctlHelper<T> modelCheckerHelper;
allStatesResult = std::move(modelCheckerHelper.computeUntilProbabilities(env, false, model.getTransitionMatrix(),model.getBackwardTransitions(), phiStates,psiStates, false, false).values);
} else {
STORM_LOG_THROW(rewardName != boost::none, storm::exceptions::NotSupportedException, "Reward property counterexample generation is currently only supported for DTMCs.");
}
} }
for (auto state : model.getInitialStates()) { for (auto state : model.getInitialStates()) {
result = std::max(result, allStatesResult[state]); result = std::max(result, allStatesResult[state]);
@ -1604,11 +1613,12 @@ namespace storm {
* @param model The sparse model in which to find the minimal command set. * @param model The sparse model in which to find the minimal command set.
* @param phiStates A bit vector characterizing all phi states in the model. * @param phiStates A bit vector characterizing all phi states in the model.
* @param psiStates A bit vector characterizing all psi states in the model. * @param psiStates A bit vector characterizing all psi states in the model.
* @param probabilityThreshold The threshold that is to be achieved or exceeded.
* @param propertyThreshold The threshold that is to be achieved or exceeded.
* @param rewardName The name of the reward structure to use, or boost::none if probabilities are considerd.
* @param strictBound Indicates whether the threshold needs to be achieved (true) or exceeded (false). * @param strictBound Indicates whether the threshold needs to be achieved (true) or exceeded (false).
* @param options A set of options for customization. * @param options A set of options for customization.
*/ */
static std::vector<boost::container::flat_set<uint_fast64_t>> getMinimalLabelSet(Environment const& env, storm::storage::SymbolicModelDescription const& symbolicModel, storm::models::sparse::Model<T> const& model, storm::storage::BitVector const& phiStates, storm::storage::BitVector const& psiStates, double probabilityThreshold, bool strictBound, boost::container::flat_set<uint_fast64_t> const& dontCareLabels = boost::container::flat_set<uint_fast64_t>(), Options const& options = Options()) {
static std::vector<boost::container::flat_set<uint_fast64_t>> getMinimalLabelSet(Environment const& env, storm::storage::SymbolicModelDescription const& symbolicModel, storm::models::sparse::Model<T> const& model, storm::storage::BitVector const& phiStates, storm::storage::BitVector const& psiStates, double propertyThreshold, boost::optional<std::string> const& rewardName, bool strictBound, boost::container::flat_set<uint_fast64_t> const& dontCareLabels = boost::container::flat_set<uint_fast64_t>(), Options const& options = Options()) {
#ifdef STORM_HAVE_Z3 #ifdef STORM_HAVE_Z3
std::vector<boost::container::flat_set<uint_fast64_t>> result; std::vector<boost::container::flat_set<uint_fast64_t>> result;
// Set up all clocks used for time measurement. // Set up all clocks used for time measurement.
@ -1650,10 +1660,10 @@ namespace storm {
// (1) Check whether its possible to exceed the threshold if checkThresholdFeasible is set. // (1) Check whether its possible to exceed the threshold if checkThresholdFeasible is set.
double maximalReachabilityProbability = 0; double maximalReachabilityProbability = 0;
if (options.checkThresholdFeasible) { if (options.checkThresholdFeasible) {
maximalReachabilityProbability = computeMaximalReachabilityProbability(env, model, phiStates, psiStates);
maximalReachabilityProbability = computeMaximalReachabilityProbability(env, model, phiStates, psiStates, rewardName);
STORM_LOG_THROW((strictBound && maximalReachabilityProbability >= probabilityThreshold) || (!strictBound && maximalReachabilityProbability > probabilityThreshold), storm::exceptions::InvalidArgumentException, "Given probability threshold " << probabilityThreshold << " can not be " << (strictBound ? "achieved" : "exceeded") << " in model with maximal reachability probability of " << maximalReachabilityProbability << ".");
std::cout << std::endl << "Maximal reachability in model is " << maximalReachabilityProbability << "." << std::endl << std::endl;
STORM_LOG_THROW((strictBound && maximalReachabilityProbability >= propertyThreshold) || (!strictBound && maximalReachabilityProbability > propertyThreshold), storm::exceptions::InvalidArgumentException, "Given probability threshold " << propertyThreshold << " can not be " << (strictBound ? "achieved" : "exceeded") << " in model with maximal reachability probability of " << maximalReachabilityProbability << ".");
std::cout << std::endl << "Maximal property value in model is " << maximalReachabilityProbability << "." << std::endl << std::endl;
} }
// (2) Identify all states and commands that are relevant, because only these need to be considered later. // (2) Identify all states and commands that are relevant, because only these need to be considered later.
@ -1705,7 +1715,7 @@ namespace storm {
uint_fast64_t lastSize = 0; uint_fast64_t lastSize = 0;
uint_fast64_t iterations = 0; uint_fast64_t iterations = 0;
uint_fast64_t currentBound = 0; uint_fast64_t currentBound = 0;
maximalReachabilityProbability = 0;
double maximalPropertyValue = 0;
uint_fast64_t zeroProbabilityCount = 0; uint_fast64_t zeroProbabilityCount = 0;
uint64_t smallestCounterexampleSize = model.getNumberOfChoices(); // Definitive u uint64_t smallestCounterexampleSize = model.getNumberOfChoices(); // Definitive u
uint64_t progressDelay = storm::settings::getModule<storm::settings::modules::GeneralSettings>().getShowProgressDelay(); uint64_t progressDelay = storm::settings::getModule<storm::settings::modules::GeneralSettings>().getShowProgressDelay();
@ -1732,18 +1742,18 @@ namespace storm {
} }
auto subChoiceOrigins = restrictModelToLabelSet(model, commandSet);
auto subChoiceOrigins = restrictModelToLabelSet(model, commandSet, psiStates.getNextSetIndex(0));
std::shared_ptr<storm::models::sparse::Model<T>> const& subModel = subChoiceOrigins.first; std::shared_ptr<storm::models::sparse::Model<T>> const& subModel = subChoiceOrigins.first;
std::vector<boost::container::flat_set<uint_fast64_t>> const& subLabelSets = subChoiceOrigins.second; std::vector<boost::container::flat_set<uint_fast64_t>> const& subLabelSets = subChoiceOrigins.second;
// Now determine the maximal reachability probability in the sub-model. // Now determine the maximal reachability probability in the sub-model.
maximalReachabilityProbability = computeMaximalReachabilityProbability(env, *subModel, phiStates, psiStates);
maximalPropertyValue = computeMaximalReachabilityProbability(env, *subModel, phiStates, psiStates, rewardName);
totalModelCheckingTime += std::chrono::high_resolution_clock::now() - modelCheckingClock; totalModelCheckingTime += std::chrono::high_resolution_clock::now() - modelCheckingClock;
// Depending on whether the threshold was successfully achieved or not, we proceed by either analyzing the bad solution or stopping the iteration process. // Depending on whether the threshold was successfully achieved or not, we proceed by either analyzing the bad solution or stopping the iteration process.
analysisClock = std::chrono::high_resolution_clock::now(); analysisClock = std::chrono::high_resolution_clock::now();
if ((strictBound && maximalReachabilityProbability < probabilityThreshold) || (!strictBound && maximalReachabilityProbability <= probabilityThreshold)) {
if (maximalReachabilityProbability == storm::utility::zero<T>()) {
if ((strictBound && maximalPropertyValue < propertyThreshold) || (!strictBound && maximalPropertyValue <= propertyThreshold)) {
if (maximalPropertyValue == storm::utility::zero<T>()) {
++zeroProbabilityCount; ++zeroProbabilityCount;
} }
@ -1759,6 +1769,10 @@ namespace storm {
// the given threshold, we analyze the solution and try to guide the solver into the right direction. // the given threshold, we analyze the solution and try to guide the solver into the right direction.
analyzeInsufficientProbabilitySolution(*solver, *subModel, subLabelSets, model, labelSets, phiStates, psiStates, commandSet, variableInformation, relevancyInformation); analyzeInsufficientProbabilitySolution(*solver, *subModel, subLabelSets, model, labelSets, phiStates, psiStates, commandSet, variableInformation, relevancyInformation);
} }
if (relevancyInformation.dontCareLabels.size() > 0) {
ruleOutSingleSolution(*solver, commandSet, variableInformation, relevancyInformation);
}
} else { } else {
// Do not guide solver, just rule out current solution. // Do not guide solver, just rule out current solution.
ruleOutSingleSolution(*solver, commandSet, variableInformation, relevancyInformation); ruleOutSingleSolution(*solver, commandSet, variableInformation, relevancyInformation);
@ -1915,22 +1929,41 @@ namespace storm {
std::cout << std::endl << "Generating minimal label counterexample for formula " << *formula << std::endl; std::cout << std::endl << "Generating minimal label counterexample for formula " << *formula << std::endl;
} }
STORM_LOG_THROW(formula->isProbabilityOperatorFormula(), storm::exceptions::InvalidPropertyException, "Counterexample generation does not support this kind of formula. Expecting a probability operator as the outermost formula element.");
storm::logic::ProbabilityOperatorFormula const& probabilityOperator = formula->asProbabilityOperatorFormula();
STORM_LOG_THROW(probabilityOperator.hasBound(), storm::exceptions::InvalidPropertyException, "Counterexample generation only supports bounded formulas.");
STORM_LOG_THROW(probabilityOperator.getSubformula().isUntilFormula() || probabilityOperator.getSubformula().isEventuallyFormula(), storm::exceptions::InvalidPropertyException, "Path formula is required to be of the form 'phi U psi' for counterexample generation.");
storm::logic::ComparisonType comparisonType;
double threshold;
boost::optional<std::string> rewardName = boost::none;
STORM_LOG_THROW(formula->isProbabilityOperatorFormula() || formula->isRewardOperatorFormula(), storm::exceptions::InvalidPropertyException, "Counterexample generation does not support this kind of formula. Expecting a probability operator as the outermost formula element.");
if (formula->isProbabilityOperatorFormula()) {
storm::logic::ProbabilityOperatorFormula const& probabilityOperator = formula->asProbabilityOperatorFormula();
STORM_LOG_THROW(probabilityOperator.hasBound(), storm::exceptions::InvalidPropertyException, "Counterexample generation only supports bounded formulas.");
STORM_LOG_THROW(probabilityOperator.getSubformula().isUntilFormula() || probabilityOperator.getSubformula().isEventuallyFormula(), storm::exceptions::InvalidPropertyException, "Path formula is required to be of the form 'phi U psi' for counterexample generation.");
comparisonType = probabilityOperator.getComparisonType();
threshold = probabilityOperator.getThresholdAs<T>();
} else {
assert(formula->isRewardOperatorFormula());
storm::logic::RewardOperatorFormula const& rewardOperator = formula->asRewardOperatorFormula();
STORM_LOG_THROW(rewardOperator.hasBound(), storm::exceptions::InvalidPropertyException, "Counterexample generation only supports bounded formulas.");
STORM_LOG_THROW( rewardOperator.getSubformula().isEventuallyFormula(), storm::exceptions::InvalidPropertyException, "Path formula is required to be of the form 'F phi' for counterexample generation.");
comparisonType = rewardOperator.getComparisonType();
threshold = rewardOperator.getThresholdAs<T>();
rewardName = rewardOperator.getRewardModelName();
storm::logic::ComparisonType comparisonType = probabilityOperator.getComparisonType();
bool strictBound = comparisonType == storm::logic::ComparisonType::Less;
double threshold = probabilityOperator.getThresholdAs<T>();
STORM_LOG_THROW(!storm::logic::isLowerBound(comparisonType), storm::exceptions::NotSupportedException, "Lower bounds in counterexamples are only supported for probability formulas.");
}
bool strictBound = comparisonType == storm::logic::ComparisonType::Less;
storm::logic::Formula const& subformula = formula->asOperatorFormula().getSubformula();
storm::storage::BitVector phiStates; storm::storage::BitVector phiStates;
storm::storage::BitVector psiStates; storm::storage::BitVector psiStates;
storm::modelchecker::SparsePropositionalModelChecker<storm::models::sparse::Model<T>> modelchecker(model); storm::modelchecker::SparsePropositionalModelChecker<storm::models::sparse::Model<T>> modelchecker(model);
if (probabilityOperator.getSubformula().isUntilFormula()) {
if (subformula.isUntilFormula()) {
STORM_LOG_THROW(!storm::logic::isLowerBound(comparisonType), storm::exceptions::NotSupportedException, "Lower bounds in counterexamples are only supported for eventually formulas."); STORM_LOG_THROW(!storm::logic::isLowerBound(comparisonType), storm::exceptions::NotSupportedException, "Lower bounds in counterexamples are only supported for eventually formulas.");
storm::logic::UntilFormula const& untilFormula = probabilityOperator.getSubformula().asUntilFormula();
storm::logic::UntilFormula const& untilFormula = subformula.asUntilFormula();
std::unique_ptr<storm::modelchecker::CheckResult> leftResult = modelchecker.check(env, untilFormula.getLeftSubformula()); std::unique_ptr<storm::modelchecker::CheckResult> leftResult = modelchecker.check(env, untilFormula.getLeftSubformula());
std::unique_ptr<storm::modelchecker::CheckResult> rightResult = modelchecker.check(env, untilFormula.getRightSubformula()); std::unique_ptr<storm::modelchecker::CheckResult> rightResult = modelchecker.check(env, untilFormula.getRightSubformula());
@ -1940,8 +1973,8 @@ namespace storm {
phiStates = leftQualitativeResult.getTruthValuesVector(); phiStates = leftQualitativeResult.getTruthValuesVector();
psiStates = rightQualitativeResult.getTruthValuesVector(); psiStates = rightQualitativeResult.getTruthValuesVector();
} else if (probabilityOperator.getSubformula().isEventuallyFormula()) {
storm::logic::EventuallyFormula const& eventuallyFormula = probabilityOperator.getSubformula().asEventuallyFormula();
} else if (subformula.isEventuallyFormula()) {
storm::logic::EventuallyFormula const& eventuallyFormula = subformula.asEventuallyFormula();
std::unique_ptr<storm::modelchecker::CheckResult> subResult = modelchecker.check(env, eventuallyFormula.getSubformula()); std::unique_ptr<storm::modelchecker::CheckResult> subResult = modelchecker.check(env, eventuallyFormula.getSubformula());
@ -1981,7 +2014,7 @@ namespace storm {
// Delegate the actual computation work to the function of equal name. // Delegate the actual computation work to the function of equal name.
auto startTime = std::chrono::high_resolution_clock::now(); auto startTime = std::chrono::high_resolution_clock::now();
auto labelSets = getMinimalLabelSet(env, symbolicModel, model, phiStates, psiStates, threshold, strictBound, dontCareLabels, options);
auto labelSets = getMinimalLabelSet(env, symbolicModel, model, phiStates, psiStates, threshold, rewardName, strictBound, dontCareLabels, options);
auto endTime = std::chrono::high_resolution_clock::now(); auto endTime = std::chrono::high_resolution_clock::now();
if (!options.silent) { if (!options.silent) {
for (auto const& labelSet : labelSets) { for (auto const& labelSet : labelSets) {

2
src/storm/settings/modules/CounterexampleGeneratorSettings.cpp → src/storm-counterexamples/settings/modules/CounterexampleGeneratorSettings.cpp

@ -1,4 +1,4 @@
#include "storm/settings/modules/CounterexampleGeneratorSettings.h"
#include "CounterexampleGeneratorSettings.h"
#include "storm/settings/SettingsManager.h" #include "storm/settings/SettingsManager.h"
#include "storm/exceptions/InvalidSettingsException.h" #include "storm/exceptions/InvalidSettingsException.h"

0
src/storm/settings/modules/CounterexampleGeneratorSettings.h → src/storm-counterexamples/settings/modules/CounterexampleGeneratorSettings.h

2
src/storm-pars/settings/ParsSettings.cpp

@ -1,4 +1,3 @@
#include <storm/settings/modules/CounterexampleGeneratorSettings.h>
#include "storm-pars/settings/ParsSettings.h" #include "storm-pars/settings/ParsSettings.h"
#include "storm-pars/settings/modules/ParametricSettings.h" #include "storm-pars/settings/modules/ParametricSettings.h"
@ -38,7 +37,6 @@ namespace storm {
storm::settings::addModule<storm::settings::modules::ParametricSettings>(); storm::settings::addModule<storm::settings::modules::ParametricSettings>();
storm::settings::addModule<storm::settings::modules::RegionSettings>(); storm::settings::addModule<storm::settings::modules::RegionSettings>();
storm::settings::addModule<storm::settings::modules::BuildSettings>(); storm::settings::addModule<storm::settings::modules::BuildSettings>();
storm::settings::addModule<storm::settings::modules::CounterexampleGeneratorSettings>();
storm::settings::addModule<storm::settings::modules::ModelCheckerSettings>(); storm::settings::addModule<storm::settings::modules::ModelCheckerSettings>();
storm::settings::addModule<storm::settings::modules::DebugSettings>(); storm::settings::addModule<storm::settings::modules::DebugSettings>();
storm::settings::addModule<storm::settings::modules::SylvanSettings>(); storm::settings::addModule<storm::settings::modules::SylvanSettings>();

1
src/storm/api/storm.h

@ -6,5 +6,4 @@
#include "storm/api/bisimulation.h" #include "storm/api/bisimulation.h"
#include "storm/api/transformation.h" #include "storm/api/transformation.h"
#include "storm/api/verification.h" #include "storm/api/verification.h"
#include "storm/api/counterexamples.h"
#include "storm/api/export.h" #include "storm/api/export.h"

2
src/storm/settings/SettingsManager.cpp

@ -17,7 +17,6 @@
#include "storm/settings/modules/IOSettings.h" #include "storm/settings/modules/IOSettings.h"
#include "storm/settings/modules/ModelCheckerSettings.h" #include "storm/settings/modules/ModelCheckerSettings.h"
#include "storm/settings/modules/DebugSettings.h" #include "storm/settings/modules/DebugSettings.h"
#include "storm/settings/modules/CounterexampleGeneratorSettings.h"
#include "storm/settings/modules/CuddSettings.h" #include "storm/settings/modules/CuddSettings.h"
#include "storm/settings/modules/BuildSettings.h" #include "storm/settings/modules/BuildSettings.h"
#include "storm/settings/modules/SylvanSettings.h" #include "storm/settings/modules/SylvanSettings.h"
@ -531,7 +530,6 @@ namespace storm {
storm::settings::addModule<storm::settings::modules::CoreSettings>(); storm::settings::addModule<storm::settings::modules::CoreSettings>();
storm::settings::addModule<storm::settings::modules::ModelCheckerSettings>(); storm::settings::addModule<storm::settings::modules::ModelCheckerSettings>();
storm::settings::addModule<storm::settings::modules::DebugSettings>(); storm::settings::addModule<storm::settings::modules::DebugSettings>();
storm::settings::addModule<storm::settings::modules::CounterexampleGeneratorSettings>();
storm::settings::addModule<storm::settings::modules::CuddSettings>(); storm::settings::addModule<storm::settings::modules::CuddSettings>();
storm::settings::addModule<storm::settings::modules::SylvanSettings>(); storm::settings::addModule<storm::settings::modules::SylvanSettings>();
storm::settings::addModule<storm::settings::modules::GmmxxEquationSolverSettings>(); storm::settings::addModule<storm::settings::modules::GmmxxEquationSolverSettings>();

1
src/test/storm-pars/utility/ModelInstantiatorTest.cpp

@ -16,6 +16,7 @@
#include "storm/models/sparse/Model.h" #include "storm/models/sparse/Model.h"
#include "storm/models/sparse/Dtmc.h" #include "storm/models/sparse/Dtmc.h"
#include "storm/models/sparse/Mdp.h" #include "storm/models/sparse/Mdp.h"
#include "storm/modelchecker/results/ExplicitQuantitativeCheckResult.h"
TEST(ModelInstantiatorTest, BrpProb) { TEST(ModelInstantiatorTest, BrpProb) {
carl::VariablePool::getInstance().clear(); carl::VariablePool::getInstance().clear();

Loading…
Cancel
Save