Browse Source

made some region settings attribute to the model checker instead of global

Former-commit-id: e53ca96760
tempestpy_adaptions
sjunges 8 years ago
parent
commit
0ef2b55c75
  1. 7
      src/modelchecker/region/ParameterRegion.cpp
  2. 14
      src/modelchecker/region/SparseDtmcRegionModelChecker.cpp
  3. 2
      src/modelchecker/region/SparseDtmcRegionModelChecker.h
  4. 4
      src/modelchecker/region/SparseMdpRegionModelChecker.cpp
  5. 2
      src/modelchecker/region/SparseMdpRegionModelChecker.h
  6. 73
      src/modelchecker/region/SparseRegionModelChecker.cpp
  7. 44
      src/modelchecker/region/SparseRegionModelChecker.h
  8. 37
      src/settings/modules/RegionSettings.cpp
  9. 33
      src/settings/modules/RegionSettings.h
  10. 8
      src/utility/storm.h
  11. 22
      test/functional/modelchecker/SparseDtmcRegionModelCheckerTest.cpp

7
src/modelchecker/region/ParameterRegion.cpp

@ -1,10 +1,3 @@
/*
* File: ParameterRegion.cpp
* Author: tim
*
* Created on August 10, 2015, 1:51 PM
*/
#include "src/modelchecker/region/ParameterRegion.h"
#include "src/utility/region.h"

14
src/modelchecker/region/SparseDtmcRegionModelChecker.cpp

@ -36,8 +36,8 @@ namespace storm {
namespace region {
template<typename ParametricSparseModelType, typename ConstantType>
SparseDtmcRegionModelChecker<ParametricSparseModelType, ConstantType>::SparseDtmcRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model) :
SparseRegionModelChecker<ParametricSparseModelType, ConstantType>(model){
SparseDtmcRegionModelChecker<ParametricSparseModelType, ConstantType>::SparseDtmcRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model, SparseRegionModelCheckerSettings const& settings) :
SparseRegionModelChecker<ParametricSparseModelType, ConstantType>(model, settings){
//intentionally left empty
}
@ -247,8 +247,8 @@ namespace storm {
simpleFormula = std::shared_ptr<storm::logic::OperatorFormula>(new storm::logic::ProbabilityOperatorFormula(eventuallyFormula, storm::logic::OperatorInformation(boost::none, this->getSpecifiedFormula()->getBound())));
}
//Check if the reachability function needs to be computed
if((storm::settings::getModule<storm::settings::modules::RegionSettings>().getSmtMode()==storm::settings::modules::RegionSettings::SmtMode::FUNCTION) ||
(storm::settings::getModule<storm::settings::modules::RegionSettings>().getSampleMode()==storm::settings::modules::RegionSettings::SampleMode::EVALUATE)){
if((this->getSettings().getSmtMode()==storm::settings::modules::RegionSettings::SmtMode::FUNCTION) ||
(this->getSettings().getSampleMode()==storm::settings::modules::RegionSettings::SampleMode::EVALUATE)){
this->computeReachabilityFunction(*(this->getSimpleModel())->template as<storm::models::sparse::Dtmc<ParametricType>>());
}
}
@ -439,8 +439,8 @@ namespace storm {
template<typename ParametricSparseModelType, typename ConstantType>
bool SparseDtmcRegionModelChecker<ParametricSparseModelType, ConstantType>::checkPoint(ParameterRegion<ParametricType>& region, std::map<VariableType, CoefficientType>const& point, bool favorViaFunction) {
bool valueInBoundOfFormula;
if((storm::settings::getModule<storm::settings::modules::RegionSettings>().getSampleMode()==storm::settings::modules::RegionSettings::SampleMode::EVALUATE) ||
(!storm::settings::getModule<storm::settings::modules::RegionSettings>().doSample() && favorViaFunction)){
if((this->getSettings().getSampleMode()==storm::settings::modules::RegionSettings::SampleMode::EVALUATE) ||
(!this->getSettings().doSample() && favorViaFunction)){
//evaluate the reachability function
valueInBoundOfFormula = this->valueIsInBoundOfFormula(this->evaluateReachabilityFunction(point));
}
@ -496,7 +496,7 @@ namespace storm {
template<typename ParametricSparseModelType, typename ConstantType>
bool SparseDtmcRegionModelChecker<ParametricSparseModelType, ConstantType>::checkSmt(ParameterRegion<ParametricType>& region) {
STORM_LOG_THROW((storm::settings::getModule<storm::settings::modules::RegionSettings>().getSmtMode()==storm::settings::modules::RegionSettings::SmtMode::FUNCTION), storm::exceptions::NotImplementedException, "Selected SMT mode has not been implemented.");
STORM_LOG_THROW((this->getSettings().getSmtMode()==storm::settings::modules::RegionSettings::SmtMode::FUNCTION), storm::exceptions::NotImplementedException, "Selected SMT mode has not been implemented.");
if (region.getCheckResult()==RegionCheckResult::UNKNOWN){
//Sampling needs to be done (on a single point)
checkPoint(region,region.getSomePoint(), true);

2
src/modelchecker/region/SparseDtmcRegionModelChecker.h

@ -20,7 +20,7 @@ namespace storm {
typedef typename storm::utility::region::VariableType<ParametricType> VariableType;
typedef typename storm::utility::region::CoefficientType<ParametricType> CoefficientType;
explicit SparseDtmcRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model);
SparseDtmcRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model, SparseRegionModelCheckerSettings const& settings);
virtual ~SparseDtmcRegionModelChecker();

4
src/modelchecker/region/SparseMdpRegionModelChecker.cpp

@ -36,8 +36,8 @@ namespace storm {
namespace region {
template<typename ParametricSparseModelType, typename ConstantType>
SparseMdpRegionModelChecker<ParametricSparseModelType, ConstantType>::SparseMdpRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model) :
SparseRegionModelChecker<ParametricSparseModelType, ConstantType>(model){
SparseMdpRegionModelChecker<ParametricSparseModelType, ConstantType>::SparseMdpRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model, SparseRegionModelCheckerSettings const& settings) :
SparseRegionModelChecker<ParametricSparseModelType, ConstantType>(model, settings){
STORM_LOG_THROW(model->isOfType(storm::models::ModelType::Mdp), storm::exceptions::InvalidArgumentException, "Tried to create an mdp region model checker for a model that is not an mdp");
}

2
src/modelchecker/region/SparseMdpRegionModelChecker.h

@ -19,7 +19,7 @@ namespace storm {
typedef typename storm::utility::region::VariableType<ParametricType> VariableType;
typedef typename storm::utility::region::CoefficientType<ParametricType> CoefficientType;
explicit SparseMdpRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model);
SparseMdpRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model, SparseRegionModelCheckerSettings const& settings);
virtual ~SparseMdpRegionModelChecker();

73
src/modelchecker/region/SparseRegionModelChecker.cpp

@ -1,10 +1,3 @@
/*
* File: SparseRegionModelChecker.cpp
* Author: tim
*
* Created on September 9, 2015, 12:34 PM
*/
#include "src/modelchecker/region/SparseRegionModelChecker.h"
#include "src/adapters/CarlAdapter.h"
@ -30,11 +23,42 @@
namespace storm {
namespace modelchecker {
namespace region {
SparseRegionModelCheckerSettings::SparseRegionModelCheckerSettings(storm::settings::modules::RegionSettings::SampleMode const& sampleM,
storm::settings::modules::RegionSettings::ApproxMode const& appM,
storm::settings::modules::RegionSettings::SmtMode const& smtM) : sampleMode(sampleM), approxMode(appM), smtMode(smtM) {
// Intentionally left empty
}
storm::settings::modules::RegionSettings::ApproxMode SparseRegionModelCheckerSettings::getApproxMode() const {
return this->approxMode;
}
storm::settings::modules::RegionSettings::SampleMode SparseRegionModelCheckerSettings::getSampleMode() const {
return this->sampleMode;
}
storm::settings::modules::RegionSettings::SmtMode SparseRegionModelCheckerSettings::getSmtMode() const {
return this->smtMode;
}
bool SparseRegionModelCheckerSettings::doApprox() const {
return getApproxMode() != storm::settings::modules::RegionSettings::ApproxMode::OFF;
}
bool SparseRegionModelCheckerSettings::doSample() const {
return getSampleMode() != storm::settings::modules::RegionSettings::SampleMode::OFF;
}
bool SparseRegionModelCheckerSettings::doSmt() const {
return getSmtMode() != storm::settings::modules::RegionSettings::SmtMode::OFF;
}
template<typename ParametricSparseModelType, typename ConstantType>
SparseRegionModelChecker<ParametricSparseModelType, ConstantType>::SparseRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model) :
SparseRegionModelChecker<ParametricSparseModelType, ConstantType>::SparseRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model, SparseRegionModelCheckerSettings const& settings) :
model(model),
specifiedFormula(nullptr){
specifiedFormula(nullptr),
settings(settings) {
STORM_LOG_THROW(model->getInitialStates().getNumberOfSetBits() == 1, storm::exceptions::InvalidArgumentException, "Model is required to have exactly one initial state.");
}
@ -83,6 +107,19 @@ namespace storm {
return this->simpleFormula;
}
// template<typename ParametricSparseModelType, typename ConstantType>
// SparseRegionModelCheckerSettings& SparseRegionModelChecker<ParametricSparseModelType, ConstantType>::getSettings() {
// return this->settings;
// };
template<typename ParametricSparseModelType, typename ConstantType>
SparseRegionModelCheckerSettings const& SparseRegionModelChecker<ParametricSparseModelType, ConstantType>::getSettings() const {
return this->settings;
};
template<typename ParametricSparseModelType, typename ConstantType>
void SparseRegionModelChecker<ParametricSparseModelType, ConstantType>::specifyFormula(std::shared_ptr<const storm::logic::Formula> formula) {
std::chrono::high_resolution_clock::time_point timeSpecifyFormulaStart = std::chrono::high_resolution_clock::now();
@ -133,11 +170,11 @@ namespace storm {
//Check if the approximation and the sampling model needs to be computed
if(!this->isResultConstant()){
if(this->isApproximationApplicable && storm::settings::getModule<storm::settings::modules::RegionSettings>().doApprox()){
if(this->isApproximationApplicable && settings.doApprox()){
initializeApproximationModel(*this->getSimpleModel(), this->getSimpleFormula());
}
if(storm::settings::getModule<storm::settings::modules::RegionSettings>().getSampleMode()==storm::settings::modules::RegionSettings::SampleMode::INSTANTIATE ||
(!storm::settings::getModule<storm::settings::modules::RegionSettings>().doSample() && storm::settings::getModule<storm::settings::modules::RegionSettings>().getApproxMode()==storm::settings::modules::RegionSettings::ApproxMode::TESTFIRST)){
if(settings.getSampleMode()==storm::settings::modules::RegionSettings::SampleMode::INSTANTIATE ||
(!settings.doSample() && settings.getApproxMode()==storm::settings::modules::RegionSettings::ApproxMode::TESTFIRST)){
initializeSamplingModel(*this->getSimpleModel(), this->getSimpleFormula());
}
} else if (this->isResultConstant() && this->constantResult.get() == storm::utility::region::convertNumber<ConstantType>(-1.0)){
@ -240,10 +277,10 @@ namespace storm {
//switches for the different steps.
bool done=false;
STORM_LOG_WARN_COND( (!storm::settings::getModule<storm::settings::modules::RegionSettings>().doApprox() || this->isApproximationApplicable), "the approximation is only correct if the model has only linear functions (more precisely: linear in a single parameter, i.e., functions like p*q are okay). As this is not the case, approximation is deactivated");
bool doApproximation=storm::settings::getModule<storm::settings::modules::RegionSettings>().doApprox() && this->isApproximationApplicable;
bool doSampling=storm::settings::getModule<storm::settings::modules::RegionSettings>().doSample();
bool doSmt=storm::settings::getModule<storm::settings::modules::RegionSettings>().doSmt();
STORM_LOG_WARN_COND( (!settings.doApprox() || this->isApproximationApplicable), "the approximation is only correct if the model has only linear functions (more precisely: linear in a single parameter, i.e., functions like p*q are okay). As this is not the case, approximation is deactivated");
bool doApproximation=settings.doApprox() && this->isApproximationApplicable;
bool doSampling=settings.doSample();
bool doSmt=settings.doSmt();
if(this->isResultConstant()){
STORM_LOG_DEBUG("Checking a region although the result is constant, i.e., independent of the region. This makes sense none.");
@ -316,7 +353,7 @@ namespace storm {
bool proveAllSat;
switch (region.getCheckResult()){
case RegionCheckResult::UNKNOWN:
switch(storm::settings::getModule<storm::settings::modules::RegionSettings>().getApproxMode()){
switch(this->settings.getApproxMode()){
case storm::settings::modules::RegionSettings::ApproxMode::TESTFIRST:
//Sample a single point to know whether we should try to prove ALLSAT or ALLVIOLATED
checkPoint(region,region.getSomePoint(), false);

44
src/modelchecker/region/SparseRegionModelChecker.h

@ -1,12 +1,4 @@
/*
* File: SparseRegionModelChecker.h
* Author: tim
*
* Created on September 9, 2015, 12:34 PM
*/
#ifndef STORM_MODELCHECKER_REGION_SPARSEREGIONMODELCHECKER_H
#define STORM_MODELCHECKER_REGION_SPARSEREGIONMODELCHECKER_H
#pragma once
#include <ostream>
#include <boost/optional.hpp>
@ -23,9 +15,31 @@
#include "src/models/sparse/Mdp.h"
#include "src/logic/Formulas.h"
#include "src/settings/modules/RegionSettings.h"
namespace storm {
namespace modelchecker{
namespace region{
class SparseRegionModelCheckerSettings {
public:
SparseRegionModelCheckerSettings(storm::settings::modules::RegionSettings::SampleMode const& sampleM,
storm::settings::modules::RegionSettings::ApproxMode const& appM,
storm::settings::modules::RegionSettings::SmtMode const& smtM);
storm::settings::modules::RegionSettings::SampleMode getSampleMode() const;
storm::settings::modules::RegionSettings::ApproxMode getApproxMode() const;
storm::settings::modules::RegionSettings::SmtMode getSmtMode() const;
bool doApprox() const;
bool doSmt() const;
bool doSample() const;
private:
storm::settings::modules::RegionSettings::SampleMode sampleMode;
storm::settings::modules::RegionSettings::ApproxMode approxMode;
storm::settings::modules::RegionSettings::SmtMode smtMode;
};
template<typename ParametricSparseModelType, typename ConstantType>
class SparseRegionModelChecker : public AbstractSparseRegionModelChecker<typename ParametricSparseModelType::ValueType, ConstantType> {
public:
@ -34,7 +48,7 @@ namespace storm {
typedef typename storm::utility::region::VariableType<ParametricType> VariableType;
typedef typename storm::utility::region::CoefficientType<ParametricType> CoefficientType;
explicit SparseRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model);
SparseRegionModelChecker(std::shared_ptr<ParametricSparseModelType> model, SparseRegionModelCheckerSettings const& settings);
virtual ~SparseRegionModelChecker();
@ -138,6 +152,9 @@ namespace storm {
*/
std::shared_ptr<storm::logic::OperatorFormula> const& getSpecifiedFormula() const;
//SparseRegionModelCheckerSettings& getSettings();
SparseRegionModelCheckerSettings const& getSettings() const;
protected:
/*!
@ -244,6 +261,10 @@ namespace storm {
std::shared_ptr<SamplingModel<ParametricSparseModelType, ConstantType>> samplingModel;
// a flag that is true iff the resulting reachability function is constant
boost::optional<ConstantType> constantResult;
SparseRegionModelCheckerSettings settings;
// runtimes and other information for statistics.
uint_fast64_t numOfCheckedRegions;
@ -269,6 +290,3 @@ namespace storm {
} //namespace region
} //namespace modelchecker
} //namespace storm
#endif /* STORM_MODELCHECKER_REGION_SPARSEREGIONMODELCHECKER_H */

37
src/settings/modules/RegionSettings.cpp

@ -19,7 +19,7 @@ namespace storm {
const std::string RegionSettings::smtmodeOptionName = "smtmode";
const std::string RegionSettings::refinementOptionName = "refinement";
RegionSettings::RegionSettings() : ModuleSettings(moduleName), modesModified(false) {
RegionSettings::RegionSettings() : ModuleSettings(moduleName) {
this->addOption(storm::settings::OptionBuilder(moduleName, regionfileOptionName, true, "Specifies the regions via a file. Format: 0.3<=p<=0.4,0.2<=q<=0.5; 0.6<=p<=0.7,0.8<=q<=0.9")
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("filename", "The file from which to read the regions.")
.addValidationFunctionString(storm::settings::ArgumentValidators::existingReadableFileValidator()).build()).build());
@ -58,9 +58,6 @@ namespace storm {
}
RegionSettings::ApproxMode RegionSettings::getApproxMode() const {
if(this->modesModified) {
return this->approxMode;
}
std::string modeString= this->getOption(approxmodeOptionName).getArgumentByName("mode").getValueAsString();
if(modeString=="off"){
return ApproxMode::OFF;
@ -79,14 +76,7 @@ namespace storm {
return ApproxMode::OFF;
}
bool RegionSettings::doApprox() const {
return getApproxMode()!=ApproxMode::OFF;
}
RegionSettings::SampleMode RegionSettings::getSampleMode() const {
if (this->modesModified){
return this->sampleMode;
}
std::string modeString= this->getOption(samplemodeOptionName).getArgumentByName("mode").getValueAsString();
if(modeString=="off"){
return SampleMode::OFF;
@ -101,15 +91,8 @@ namespace storm {
STORM_LOG_THROW(false, storm::exceptions::InvalidSettingsException, "The sample mode '" << modeString << "' is not valid");
return SampleMode::OFF;
}
bool RegionSettings::doSample() const {
return getSampleMode()!=SampleMode::OFF;
}
RegionSettings::SmtMode RegionSettings::getSmtMode() const {
if(this->modesModified){
return this->smtMode;
}
std::string modeString= this->getOption(smtmodeOptionName).getArgumentByName("mode").getValueAsString();
if(modeString=="off"){
return SmtMode::OFF;
@ -124,22 +107,8 @@ namespace storm {
STORM_LOG_THROW(false, storm::exceptions::InvalidSettingsException, "The smt mode '" << modeString << "' is not valid");
return SmtMode::OFF;
}
bool RegionSettings::doSmt() const {
return getSmtMode()!=SmtMode::OFF;
}
void RegionSettings::modifyModes(ApproxMode const& approxMode, SampleMode const& sampleMode, SmtMode const& smtMode) {
this->approxMode = approxMode;
this->sampleMode = sampleMode;
this->smtMode = smtMode;
this->modesModified=true;
}
void RegionSettings::resetModes() {
this->modesModified=false;
}
bool RegionSettings::doRefinement() const{
return this->getOption(refinementOptionName).getHasOptionBeenSet();
}

33
src/settings/modules/RegionSettings.h

@ -51,43 +51,17 @@ namespace storm {
*/
ApproxMode getApproxMode() const;
/*!
* Returns whether to use approximation
*/
bool doApprox() const;
/*!
* Returns the mode in which Sampling should be used
*/
SampleMode getSampleMode() const;
/*!
* Returns whether to use Sampling
*/
bool doSample() const;
/*!
* Returns the mode in which SMT solving should be used
*/
SmtMode getSmtMode() const;
/*!
* Returns whether to use SMT Solving
*/
bool doSmt() const;
/*!
* Sets the modes accordingly. Great for debugging purposes.
* Use resetModes() to switch back to the modes specified by the settings
*/
void modifyModes(ApproxMode const& approxMode, SampleMode const& sampleMode, SmtMode const& smtMode);
/*!
* Resets the modes to the ones specified by the settings.
* This is useful if the modes have been altered by setModes(...)
*/
void resetModes();
bool doRefinement() const;
double getRefinementThreshold() const;
@ -102,11 +76,6 @@ namespace storm {
const static std::string samplemodeOptionName;
const static std::string smtmodeOptionName;
const static std::string refinementOptionName;
bool modesModified;
ApproxMode approxMode;
SampleMode sampleMode;
SmtMode smtMode;
};
} // namespace modules

8
src/utility/storm.h

@ -409,18 +409,20 @@ namespace storm {
storm::prism::Program program = parseProgram(programFilePath);
program.checkValidity();
std::vector<std::shared_ptr<const storm::logic::Formula>> formulas = parseFormulasForProgram(formulaString, program);;
if(formulas.size()!=1){
if(formulas.size()!=1) {
STORM_LOG_ERROR("The given formulaString does not specify exactly one formula");
return false;
}
std::shared_ptr<storm::models::sparse::Model<storm::RationalFunction>> model = buildSparseModel<storm::RationalFunction>(program, formulas);
auto const& regionSettings = storm::settings::getModule<storm::settings::modules::RegionSettings>();
storm::modelchecker::region::SparseRegionModelCheckerSettings settings(regionSettings.getSampleMode(), regionSettings.getApproxMode(), regionSettings.getSmtMode());
// Preprocessing and ModelChecker
if(model->isOfType(storm::models::ModelType::Dtmc)){
preprocessModel<storm::models::sparse::Dtmc<storm::RationalFunction>>(model,formulas);
regionModelChecker = std::make_shared<storm::modelchecker::region::SparseDtmcRegionModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double>>(model->as<storm::models::sparse::Dtmc<storm::RationalFunction>>());
regionModelChecker = std::make_shared<storm::modelchecker::region::SparseDtmcRegionModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double>>(model->as<storm::models::sparse::Dtmc<storm::RationalFunction>>(), settings);
} else if (model->isOfType(storm::models::ModelType::Mdp)){
preprocessModel<storm::models::sparse::Mdp<storm::RationalFunction>>(model,formulas);
regionModelChecker = std::make_shared<storm::modelchecker::region::SparseMdpRegionModelChecker<storm::models::sparse::Mdp<storm::RationalFunction>, double>>(model->as<storm::models::sparse::Mdp<storm::RationalFunction>>());
regionModelChecker = std::make_shared<storm::modelchecker::region::SparseMdpRegionModelChecker<storm::models::sparse::Mdp<storm::RationalFunction>, double>>(model->as<storm::models::sparse::Mdp<storm::RationalFunction>>(), settings);
} else {
STORM_LOG_ERROR("The type of the given model is not supported (only Dtmcs or Mdps are supported");
return false;

22
test/functional/modelchecker/SparseDtmcRegionModelCheckerTest.cpp

@ -48,10 +48,11 @@ TEST(SparseDtmcRegionModelCheckerTest, Brp_Prob) {
EXPECT_NEAR(0.8429289733, storm::utility::region::convertNumber<double>(dtmcModelchecker->evaluateReachabilityFunction(allVioRegion.getUpperBoundaries())), storm::settings::getModule<storm::settings::modules::GeneralSettings>().getPrecision());
//test approximative method
storm::settings::getModule<storm::settings::modules::RegionSettings>().modifyModes(storm::settings::modules::RegionSettings::ApproxMode::TESTFIRST, storm::settings::modules::RegionSettings::SampleMode::INSTANTIATE, storm::settings::modules::RegionSettings::SmtMode::OFF);
ASSERT_TRUE(storm::settings::getModule<storm::settings::modules::RegionSettings>().doApprox());
ASSERT_TRUE(storm::settings::getModule<storm::settings::modules::RegionSettings>().doSample());
ASSERT_FALSE(storm::settings::getModule<storm::settings::modules::RegionSettings>().doSmt());
storm::modelchecker::region::SparseRegionModelCheckerSettings settings(storm::settings::modules::RegionSettings::ApproxMode::TESTFIRST, storm::settings::modules::RegionSettings::SampleMode::INSTANTIATE, storm::settings::modules::RegionSettings::SmtMode::OFF);
dtmcModelchecker = std::dynamic_pointer_cast<storm::modelchecker::region::SparseDtmcRegionModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double>>(modelchecker, settings);
ASSERT_TRUE(settings.doApprox());
ASSERT_TRUE(settings.doSample());
ASSERT_FALSE(settings.doSmt());
dtmcModelchecker->checkRegion(allSatRegion);
EXPECT_EQ((storm::modelchecker::region::RegionCheckResult::ALLSAT), allSatRegion.getCheckResult());
dtmcModelchecker->checkRegion(exBothRegion);
@ -63,18 +64,19 @@ TEST(SparseDtmcRegionModelCheckerTest, Brp_Prob) {
auto allSatRegionSmt=storm::modelchecker::region::ParameterRegion<storm::RationalFunction>::parseRegion("0.7<=pL<=0.9,0.75<=pK<=0.95");
auto exBothRegionSmt=storm::modelchecker::region::ParameterRegion<storm::RationalFunction>::parseRegion("0.4<=pL<=0.65,0.75<=pK<=0.95");
auto allVioRegionSmt=storm::modelchecker::region::ParameterRegion<storm::RationalFunction>::parseRegion("0.1<=pL<=0.9,0.2<=pK<=0.5");
storm::settings::mutableRegionSettings().modifyModes(storm::settings::modules::RegionSettings::ApproxMode::OFF, storm::settings::modules::RegionSettings::SampleMode::EVALUATE, storm::settings::modules::RegionSettings::SmtMode::FUNCTION);
ASSERT_FALSE(storm::settings::getModule<storm::settings::modules::RegionSettings>().doApprox());
ASSERT_TRUE(storm::settings::getModule<storm::settings::modules::RegionSettings>().doSample());
ASSERT_TRUE(storm::settings::getModule<storm::settings::modules::RegionSettings>().doSmt());
settings = storm::modelchecker::region::SparseRegionModelCheckerSettings(storm::settings::modules::RegionSettings::ApproxMode::OFF, storm::settings::modules::RegionSettings::SampleMode::EVALUATE, storm::settings::modules::RegionSettings::SmtMode::FUNCTION);
dtmcModelchecker = std::dynamic_pointer_cast<storm::modelchecker::region::SparseDtmcRegionModelChecker<storm::models::sparse::Dtmc<storm::RationalFunction>, double>>(modelchecker, settings);
ASSERT_FALSE(settings.doApprox());
ASSERT_TRUE(settings.doSample());
ASSERT_TRUE(settings.doSmt());
dtmcModelchecker->checkRegion(allSatRegionSmt);
//smt EXPECT_EQ((storm::modelchecker::region::RegionCheckResult::ALLSAT), allSatRegionSmt.getCheckResult());
dtmcModelchecker->checkRegion(exBothRegionSmt);
//smt EXPECT_EQ((storm::modelchecker::region::RegionCheckResult::EXISTSBOTH), exBothRegionSmt.getCheckResult());
dtmcModelchecker->checkRegion(allVioRegionSmt);
//smt EXPECT_EQ((storm::modelchecker::region::RegionCheckResult::ALLVIOLATED), allVioRegionSmt.getCheckResult());
storm::settings::mutableRegionSettings().resetModes();
carl::VariablePool::getInstance().clear();
}

Loading…
Cancel
Save