Browse Source

updates after cherry pick

tempestpy_adaptions
Stefan Pranger 3 years ago
parent
commit
7a851901e2
  1. 52
      src/storm-parsers/parser/FormulaParserGrammar.cpp
  2. 38
      src/storm-parsers/parser/FormulaParserGrammar.h
  3. 4
      src/storm/logic/BoundedGloballyFormula.cpp
  4. 7
      src/storm/logic/BoundedGloballyFormula.h
  5. 3
      src/storm/logic/Formula.h
  6. 9
      src/storm/logic/FragmentSpecification.cpp
  7. 48
      src/storm/logic/ToPrefixStringVisitor.cpp
  8. 8
      src/storm/logic/ToPrefixStringVisitor.h
  9. 13
      src/storm/modelchecker/csl/SparseCtmcCslModelChecker.h
  10. 1
      src/storm/modelchecker/prctl/SparseDtmcPrctlModelChecker.h
  11. 2
      src/storm/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp
  12. 3
      src/storm/storage/Scheduler.cpp
  13. 1
      src/storm/storage/Scheduler.h

52
src/storm-parsers/parser/FormulaParserGrammar.cpp

@ -29,7 +29,7 @@ namespace storm {
rewardMeasureType_.name("reward measure"); rewardMeasureType_.name("reward measure");
operatorKeyword_.name("Operator keyword"); operatorKeyword_.name("Operator keyword");
filterType_.name("filter type"); filterType_.name("filter type");
// Auxiliary helpers // Auxiliary helpers
isPathFormula = qi::eps(qi::_r1 == FormulaKind::Path); isPathFormula = qi::eps(qi::_r1 == FormulaKind::Path);
noAmbiguousNonAssociativeOperator = !(qi::lit(qi::_r2)[qi::_pass = phoenix::bind(&FormulaParserGrammar::raiseAmbiguousNonAssociativeOperatorError, phoenix::ref(*this), qi::_r1, qi::_r2)]); noAmbiguousNonAssociativeOperator = !(qi::lit(qi::_r2)[qi::_pass = phoenix::bind(&FormulaParserGrammar::raiseAmbiguousNonAssociativeOperatorError, phoenix::ref(*this), qi::_r1, qi::_r2)]);
@ -40,7 +40,7 @@ namespace storm {
label.name("label"); label.name("label");
quotedString %= qi::as_string[qi::lexeme[qi::omit[qi::char_('"')] > qi::raw[*(!qi::char_('"') >> qi::char_)] > qi::omit[qi::lit('"')]]]; quotedString %= qi::as_string[qi::lexeme[qi::omit[qi::char_('"')] > qi::raw[*(!qi::char_('"') >> qi::char_)] > qi::omit[qi::lit('"')]]];
quotedString.name("quoted string"); quotedString.name("quoted string");
// PCTL-like Operator Formulas // PCTL-like Operator Formulas
operatorInformation = (-optimalityOperator_)[qi::_a = qi::_1] >> operatorInformation = (-optimalityOperator_)[qi::_a = qi::_1] >>
((qi::lit("=") > qi::lit("?"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createOperatorInformation, phoenix::ref(*this), qi::_a, boost::none, boost::none)] ((qi::lit("=") > qi::lit("?"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createOperatorInformation, phoenix::ref(*this), qi::_a, boost::none, boost::none)]
@ -61,7 +61,7 @@ namespace storm {
operatorFormula = (operatorKeyword_[qi::_a = qi::_1] > -rewardMeasureType(qi::_a) > -rewardModelName(qi::_a) > operatorInformation > qi::lit("[") > operatorSubFormula(qi::_a) > qi::lit("]")) operatorFormula = (operatorKeyword_[qi::_a = qi::_1] > -rewardMeasureType(qi::_a) > -rewardModelName(qi::_a) > operatorInformation > qi::lit("[") > operatorSubFormula(qi::_a) > qi::lit("]"))
[qi::_val = phoenix::bind(&FormulaParserGrammar::createOperatorFormula, phoenix::ref(*this), qi::_a, qi::_2, qi::_3, qi::_4, qi::_5)]; [qi::_val = phoenix::bind(&FormulaParserGrammar::createOperatorFormula, phoenix::ref(*this), qi::_a, qi::_2, qi::_3, qi::_4, qi::_5)];
operatorFormula.name("operator formula"); operatorFormula.name("operator formula");
// Atomic propositions // Atomic propositions
labelFormula = (qi::lit("\"") >> label >> qi::lit("\""))[qi::_val = phoenix::bind(&FormulaParserGrammar::createAtomicLabelFormula, phoenix::ref(*this), qi::_1)]; labelFormula = (qi::lit("\"") >> label >> qi::lit("\""))[qi::_val = phoenix::bind(&FormulaParserGrammar::createAtomicLabelFormula, phoenix::ref(*this), qi::_1)];
@ -72,7 +72,7 @@ namespace storm {
expressionFormula.name("expression formula"); expressionFormula.name("expression formula");
atomicPropositionFormula = (booleanLiteralFormula | labelFormula | expressionFormula); atomicPropositionFormula = (booleanLiteralFormula | labelFormula | expressionFormula);
atomicPropositionFormula.name("atomic proposition"); atomicPropositionFormula.name("atomic proposition");
// Propositional Logic operators // Propositional Logic operators
// To correctly parse the operator precedences (! binds stronger than & binds stronger than |), we run through different "precedence levels" starting with the weakest binding operator. // To correctly parse the operator precedences (! binds stronger than & binds stronger than |), we run through different "precedence levels" starting with the weakest binding operator.
basicPropositionalFormula = (qi::lit("(") >> (formula(qi::_r1, qi::_r2) > qi::lit(")"))) basicPropositionalFormula = (qi::lit("(") >> (formula(qi::_r1, qi::_r2) > qi::lit(")")))
@ -94,7 +94,7 @@ namespace storm {
> andLevelPropositionalFormula(qi::_r1, qi::_r2)[qi::_val = phoenix::bind(&FormulaParserGrammar::createBinaryBooleanStateOrPathFormula, phoenix::ref(*this), qi::_val, qi::_1, storm::logic::BinaryBooleanStateFormula::OperatorType::Or)]); > andLevelPropositionalFormula(qi::_r1, qi::_r2)[qi::_val = phoenix::bind(&FormulaParserGrammar::createBinaryBooleanStateOrPathFormula, phoenix::ref(*this), qi::_val, qi::_1, storm::logic::BinaryBooleanStateFormula::OperatorType::Or)]);
orLevelPropositionalFormula.name("or precedence level propositional formula"); orLevelPropositionalFormula.name("or precedence level propositional formula");
propositionalFormula = orLevelPropositionalFormula(qi::_r1, qi::_r2); propositionalFormula = orLevelPropositionalFormula(qi::_r1, qi::_r2);
// Path operators // Path operators
// Again need to parse precedences correctly. Propositional formulae bind stronger than temporal operators. // Again need to parse precedences correctly. Propositional formulae bind stronger than temporal operators.
basicPathFormula = propositionalFormula(FormulaKind::Path, qi::_r1) // Bracketed case is handled here as well basicPathFormula = propositionalFormula(FormulaKind::Path, qi::_r1) // Bracketed case is handled here as well
@ -139,7 +139,7 @@ namespace storm {
untilLevelPathFormula.name("until precedence level path formula"); untilLevelPathFormula.name("until precedence level path formula");
pathFormula = untilLevelPathFormula(qi::_r1); pathFormula = untilLevelPathFormula(qi::_r1);
pathFormula.name("path formula"); pathFormula.name("path formula");
// Quantitative path formulae (reward) // Quantitative path formulae (reward)
longRunAverageRewardFormula = (qi::lit("LRA") | qi::lit("S") | qi::lit("MP"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createLongRunAverageRewardFormula, phoenix::ref(*this))]; longRunAverageRewardFormula = (qi::lit("LRA") | qi::lit("S") | qi::lit("MP"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createLongRunAverageRewardFormula, phoenix::ref(*this))];
longRunAverageRewardFormula.name("long run average reward formula"); longRunAverageRewardFormula.name("long run average reward formula");
@ -149,13 +149,13 @@ namespace storm {
cumulativeRewardFormula.name("cumulative reward formula"); cumulativeRewardFormula.name("cumulative reward formula");
totalRewardFormula = (qi::lit("C"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createTotalRewardFormula, phoenix::ref(*this))]; totalRewardFormula = (qi::lit("C"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createTotalRewardFormula, phoenix::ref(*this))];
totalRewardFormula.name("total reward formula"); totalRewardFormula.name("total reward formula");
// Game Formulae // Game Formulae
playerCoalition = (-((identifier[phoenix::push_back(qi::_a, qi::_1)] | qi::uint_[phoenix::push_back(qi::_a, qi::_1)]) % ','))[qi::_val = phoenix::bind(&FormulaParserGrammar::createPlayerCoalition, phoenix::ref(*this), qi::_a)]; playerCoalition = (-((identifier[phoenix::push_back(qi::_a, qi::_1)] | qi::uint_[phoenix::push_back(qi::_a, qi::_1)]) % ','))[qi::_val = phoenix::bind(&FormulaParserGrammar::createPlayerCoalition, phoenix::ref(*this), qi::_a)];
playerCoalition.name("player coalition"); playerCoalition.name("player coalition");
gameFormula = (qi::lit("<<") > playerCoalition > qi::lit(">>") > operatorFormula)[qi::_val = phoenix::bind(&FormulaParserGrammar::createGameFormula, phoenix::ref(*this), qi::_1, qi::_2)]; gameFormula = (qi::lit("<<") > playerCoalition > qi::lit(">>") > operatorFormula)[qi::_val = phoenix::bind(&FormulaParserGrammar::createGameFormula, phoenix::ref(*this), qi::_1, qi::_2)];
gameFormula.name("game formula"); gameFormula.name("game formula");
// Multi-objective, quantiles // Multi-objective, quantiles
multiOperatorFormula = (qi::lit("multi") > qi::lit("(") multiOperatorFormula = (qi::lit("multi") > qi::lit("(")
> (operatorFormula % qi::lit(",")) > (operatorFormula % qi::lit(","))
@ -165,14 +165,14 @@ namespace storm {
quantileBoundVariable.name("quantile bound variable"); quantileBoundVariable.name("quantile bound variable");
quantileFormula = (qi::lit("quantile") > qi::lit("(") > *(quantileBoundVariable) > operatorFormula[qi::_pass = phoenix::bind(&FormulaParserGrammar::isBooleanReturnType, phoenix::ref(*this), qi::_1, true)] > qi::lit(")"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createQuantileFormula, phoenix::ref(*this), qi::_1, qi::_2)]; quantileFormula = (qi::lit("quantile") > qi::lit("(") > *(quantileBoundVariable) > operatorFormula[qi::_pass = phoenix::bind(&FormulaParserGrammar::isBooleanReturnType, phoenix::ref(*this), qi::_1, true)] > qi::lit(")"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createQuantileFormula, phoenix::ref(*this), qi::_1, qi::_2)];
quantileFormula.name("Quantile formula"); quantileFormula.name("Quantile formula");
// General formulae // General formulae
formula = (isPathFormula(qi::_r1) >> pathFormula(qi::_r2) | propositionalFormula(qi::_r1, qi::_r2)); formula = (isPathFormula(qi::_r1) >> pathFormula(qi::_r2) | propositionalFormula(qi::_r1, qi::_r2));
formula.name("formula"); formula.name("formula");
topLevelFormula = formula(FormulaKind::State, storm::logic::FormulaContext::Undefined); topLevelFormula = formula(FormulaKind::State, storm::logic::FormulaContext::Undefined);
topLevelFormula.name("top-level formula"); topLevelFormula.name("top-level formula");
formulaName = qi::lit("\"") >> identifier >> qi::lit("\"") >> qi::lit(":"); formulaName = qi::lit("\"") >> identifier >> qi::lit("\"") >> qi::lit(":");
formulaName.name("formula name"); formulaName.name("formula name");
@ -183,7 +183,7 @@ namespace storm {
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverloaded-shift-op-parentheses" #pragma clang diagnostic ignored "-Woverloaded-shift-op-parentheses"
filterProperty = (-formulaName >> qi::lit("filter") > qi::lit("(") > filterType_ > qi::lit(",") > topLevelFormula > qi::lit(",") > formula(FormulaKind::State, storm::logic::FormulaContext::Undefined)> qi::lit(")"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createProperty, phoenix::ref(*this), qi::_1, qi::_2, qi::_3, qi::_4)] | filterProperty = (-formulaName >> qi::lit("filter") > qi::lit("(") > filterType_ > qi::lit(",") > topLevelFormula > qi::lit(",") > formula(FormulaKind::State, storm::logic::FormulaContext::Undefined)> qi::lit(")"))[qi::_val = phoenix::bind(&FormulaParserGrammar::createProperty, phoenix::ref(*this), qi::_1, qi::_2, qi::_3, qi::_4)] |
(-formulaName >> topLevelFormula)[qi::_val = phoenix::bind(&FormulaParserGrammar::createPropertyWithDefaultFilterTypeAndStates, phoenix::ref(*this), qi::_1, qi::_2)]; (-formulaName >> topLevelFormula)[qi::_val = phoenix::bind(&FormulaParserGrammar::createPropertyWithDefaultFilterTypeAndStates, phoenix::ref(*this), qi::_1, qi::_2)];
filterProperty.name("filter property"); filterProperty.name("filter property");
@ -236,7 +236,7 @@ namespace storm {
// debug(filterProperty) // debug(filterProperty)
// debug(constantDefinition ) // debug(constantDefinition )
// debug(start) // debug(start)
// Enable error reporting. // Enable error reporting.
qi::on_error<qi::fail>(rewardModelName, handler(qi::_1, qi::_2, qi::_3, qi::_4)); qi::on_error<qi::fail>(rewardModelName, handler(qi::_1, qi::_2, qi::_3, qi::_4));
qi::on_error<qi::fail>(rewardMeasureType, handler(qi::_1, qi::_2, qi::_3, qi::_4)); qi::on_error<qi::fail>(rewardMeasureType, handler(qi::_1, qi::_2, qi::_3, qi::_4));
@ -388,20 +388,8 @@ namespace storm {
} }
} }
std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createGloballyFormula(boost::optional<std::vector<std::tuple<boost::optional<storm::logic::TimeBound>, boost::optional<storm::logic::TimeBound>, std::shared_ptr<storm::logic::TimeBoundReference>>>> const& timeBounds, std::shared_ptr<storm::logic::Formula const> const& subformula) const {
if (timeBounds && !timeBounds.get().empty()) {
std::vector<boost::optional<storm::logic::TimeBound>> lowerBounds, upperBounds;
std::vector<storm::logic::TimeBoundReference> timeBoundReferences;
for (auto const& timeBound : timeBounds.get()) {
STORM_LOG_ASSERT(!std::get<0>(timeBound), "Cannot use lower time bounds (or intervals) in globally formulas.");
lowerBounds.push_back(std::get<0>(timeBound));
upperBounds.push_back(std::get<1>(timeBound));
timeBoundReferences.emplace_back(*std::get<2>(timeBound));
}
return std::shared_ptr<storm::logic::Formula const>(new storm::logic::BoundedGloballyFormula(subformula, lowerBounds, upperBounds, timeBoundReferences));
} else {
return std::shared_ptr<storm::logic::Formula const>(new storm::logic::GloballyFormula(subformula));
}
std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createGloballyFormula(std::shared_ptr<storm::logic::Formula const> const& subformula) const {
return std::shared_ptr<storm::logic::Formula const>(new storm::logic::GloballyFormula(subformula));
} }
std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createNextFormula(std::shared_ptr<storm::logic::Formula const> const& subformula) const { std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createNextFormula(std::shared_ptr<storm::logic::Formula const> const& subformula) const {
@ -451,7 +439,7 @@ namespace storm {
return storm::logic::OperatorInformation(optimizationDirection, boost::none); return storm::logic::OperatorInformation(optimizationDirection, boost::none);
} }
} }
std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createOperatorFormula(storm::logic::FormulaContext const& context, boost::optional<storm::logic::RewardMeasureType> const& rewardMeasureType, boost::optional<std::string> const& rewardModelName, storm::logic::OperatorInformation const& operatorInformation, std::shared_ptr<storm::logic::Formula const> const& subformula) { std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createOperatorFormula(storm::logic::FormulaContext const& context, boost::optional<storm::logic::RewardMeasureType> const& rewardMeasureType, boost::optional<std::string> const& rewardModelName, storm::logic::OperatorInformation const& operatorInformation, std::shared_ptr<storm::logic::Formula const> const& subformula) {
switch(context) { switch(context) {
case storm::logic::FormulaContext::Probability: case storm::logic::FormulaContext::Probability:
@ -469,7 +457,7 @@ namespace storm {
STORM_LOG_THROW(false, storm::exceptions::WrongFormatException, "Unexpected formula context."); STORM_LOG_THROW(false, storm::exceptions::WrongFormatException, "Unexpected formula context.");
} }
} }
std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createLongRunAverageOperatorFormula(storm::logic::OperatorInformation const& operatorInformation, std::shared_ptr<storm::logic::Formula const> const& subformula) const { std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createLongRunAverageOperatorFormula(storm::logic::OperatorInformation const& operatorInformation, std::shared_ptr<storm::logic::Formula const> const& subformula) const {
return std::shared_ptr<storm::logic::Formula const>(new storm::logic::LongRunAverageOperatorFormula(subformula, operatorInformation)); return std::shared_ptr<storm::logic::Formula const>(new storm::logic::LongRunAverageOperatorFormula(subformula, operatorInformation));
} }
@ -570,7 +558,7 @@ namespace storm {
} }
return std::shared_ptr<storm::logic::Formula const>(new storm::logic::BoundedUntilFormula(leftSubformulas, rightSubformulas, lowerBounds, upperBounds, timeBoundReferences)); return std::shared_ptr<storm::logic::Formula const>(new storm::logic::BoundedUntilFormula(leftSubformulas, rightSubformulas, lowerBounds, upperBounds, timeBoundReferences));
} }
std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createMultiOperatorFormula(std::vector<std::shared_ptr<storm::logic::Formula const>> const& subformulas) { std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createMultiOperatorFormula(std::vector<std::shared_ptr<storm::logic::Formula const>> const& subformulas) {
return std::shared_ptr<storm::logic::Formula const>(new storm::logic::MultiObjectiveFormula(subformulas)); return std::shared_ptr<storm::logic::Formula const>(new storm::logic::MultiObjectiveFormula(subformulas));
} }
@ -620,7 +608,7 @@ namespace storm {
return storm::jani::Property(std::to_string(propertyCount), formula, this->getUndefinedConstants(formula)); return storm::jani::Property(std::to_string(propertyCount), formula, this->getUndefinedConstants(formula));
} }
} }
storm::logic::PlayerCoalition FormulaParserGrammar::createPlayerCoalition(std::vector<boost::variant<std::string, storm::storage::PlayerIndex>> const& playerIds) const { storm::logic::PlayerCoalition FormulaParserGrammar::createPlayerCoalition(std::vector<boost::variant<std::string, storm::storage::PlayerIndex>> const& playerIds) const {
return storm::logic::PlayerCoalition(playerIds); return storm::logic::PlayerCoalition(playerIds);
} }
@ -628,7 +616,7 @@ namespace storm {
std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createGameFormula(storm::logic::PlayerCoalition const& coalition, std::shared_ptr<storm::logic::Formula const> const& subformula) const { std::shared_ptr<storm::logic::Formula const> FormulaParserGrammar::createGameFormula(storm::logic::PlayerCoalition const& coalition, std::shared_ptr<storm::logic::Formula const> const& subformula) const {
return std::shared_ptr<storm::logic::Formula const>(new storm::logic::GameFormula(coalition, subformula)); return std::shared_ptr<storm::logic::Formula const>(new storm::logic::GameFormula(coalition, subformula));
} }
bool FormulaParserGrammar::isBooleanReturnType(std::shared_ptr<storm::logic::Formula const> const& formula, bool raiseErrorMessage) { bool FormulaParserGrammar::isBooleanReturnType(std::shared_ptr<storm::logic::Formula const> const& formula, bool raiseErrorMessage) {
if (formula->hasQualitativeResult()) { if (formula->hasQualitativeResult()) {
return true; return true;
@ -636,7 +624,7 @@ namespace storm {
STORM_LOG_ERROR_COND(!raiseErrorMessage, "Formula " << *formula << " does not have a Boolean return type."); STORM_LOG_ERROR_COND(!raiseErrorMessage, "Formula " << *formula << " does not have a Boolean return type.");
return false; return false;
} }
bool FormulaParserGrammar::raiseAmbiguousNonAssociativeOperatorError(std::shared_ptr<storm::logic::Formula const> const& formula, std::string const& op) { bool FormulaParserGrammar::raiseAmbiguousNonAssociativeOperatorError(std::shared_ptr<storm::logic::Formula const> const& formula, std::string const& op) {
STORM_LOG_ERROR( "Ambiguous use of non-associative operator '" << op << "' in formula '" << *formula << " U ... '"); STORM_LOG_ERROR( "Ambiguous use of non-associative operator '" << op << "' in formula '" << *formula << " U ... '");
return true; return true;

38
src/storm-parsers/parser/FormulaParserGrammar.h

@ -63,7 +63,7 @@ namespace storm {
}; };
// A parser used for recognizing the standard keywords (that also apply to e.g. PRISM). These shall not coincide with expression variables // A parser used for recognizing the standard keywords (that also apply to e.g. PRISM). These shall not coincide with expression variables
keywordsStruct keywords_; keywordsStruct keywords_;
struct nonStandardKeywordsStruct : qi::symbols<char, uint_fast64_t> { struct nonStandardKeywordsStruct : qi::symbols<char, uint_fast64_t> {
nonStandardKeywordsStruct() { nonStandardKeywordsStruct() {
add add
@ -78,7 +78,7 @@ namespace storm {
// A parser used for recognizing non-standard Storm-specific keywords. // A parser used for recognizing non-standard Storm-specific keywords.
// For compatibility, we still try to parse expression variables whose identifier is such a keyword and just issue a warning. // For compatibility, we still try to parse expression variables whose identifier is such a keyword and just issue a warning.
nonStandardKeywordsStruct nonStandardKeywords_; nonStandardKeywordsStruct nonStandardKeywords_;
struct relationalOperatorStruct : qi::symbols<char, storm::logic::ComparisonType> { struct relationalOperatorStruct : qi::symbols<char, storm::logic::ComparisonType> {
relationalOperatorStruct() { relationalOperatorStruct() {
add add
@ -91,7 +91,7 @@ namespace storm {
// A parser used for recognizing the operators at the "relational" precedence level. // A parser used for recognizing the operators at the "relational" precedence level.
relationalOperatorStruct relationalOperator_; relationalOperatorStruct relationalOperator_;
struct optimalityOperatorStruct : qi::symbols<char, storm::OptimizationDirection> { struct optimalityOperatorStruct : qi::symbols<char, storm::OptimizationDirection> {
optimalityOperatorStruct() { optimalityOperatorStruct() {
add add
@ -132,7 +132,7 @@ namespace storm {
// A parser used for recognizing the filter type. // A parser used for recognizing the filter type.
filterTypeStruct filterType_; filterTypeStruct filterType_;
struct operatorKeyword : qi::symbols<char, storm::logic::FormulaContext> { struct operatorKeyword : qi::symbols<char, storm::logic::FormulaContext> {
operatorKeyword() { operatorKeyword() {
add add
@ -144,7 +144,7 @@ namespace storm {
} }
}; };
operatorKeyword operatorKeyword_; operatorKeyword operatorKeyword_;
enum class FormulaKind { enum class FormulaKind {
State, /// PCTL*-like (boolean) state formula State, /// PCTL*-like (boolean) state formula
Path, /// PCTL*-like (boolean) path formula (include state formulae) Path, /// PCTL*-like (boolean) path formula (include state formulae)
@ -161,23 +161,23 @@ namespace storm {
// A symbol table that is a mapping from identifiers that can be used in expressions to the expressions // A symbol table that is a mapping from identifiers that can be used in expressions to the expressions
// they are to be replaced with. // they are to be replaced with.
qi::symbols<char, storm::expressions::Expression> identifiers_; qi::symbols<char, storm::expressions::Expression> identifiers_;
// Rules // Rules
// Auxiliary helpers // Auxiliary helpers
qi::rule<Iterator, qi::unused_type(std::shared_ptr<storm::logic::Formula const>, std::string), Skipper> noAmbiguousNonAssociativeOperator; qi::rule<Iterator, qi::unused_type(std::shared_ptr<storm::logic::Formula const>, std::string), Skipper> noAmbiguousNonAssociativeOperator;
qi::rule<Iterator, std::string(), Skipper> identifier; qi::rule<Iterator, std::string(), Skipper> identifier;
qi::rule<Iterator, std::string(), Skipper> label; qi::rule<Iterator, std::string(), Skipper> label;
qi::rule<Iterator, std::string(), Skipper> quotedString; qi::rule<Iterator, std::string(), Skipper> quotedString;
// PCTL-like Operator Formulas // PCTL-like Operator Formulas
qi::rule<Iterator, storm::logic::OperatorInformation(), qi::locals<boost::optional<storm::OptimizationDirection>>, Skipper> operatorInformation; qi::rule<Iterator, storm::logic::OperatorInformation(), qi::locals<boost::optional<storm::OptimizationDirection>>, Skipper> operatorInformation;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(storm::logic::FormulaContext), Skipper> operatorSubFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(storm::logic::FormulaContext), Skipper> operatorSubFormula;
qi::rule<Iterator, std::string(storm::logic::FormulaContext), Skipper> rewardModelName; qi::rule<Iterator, std::string(storm::logic::FormulaContext), Skipper> rewardModelName;
qi::rule<Iterator, storm::logic::RewardMeasureType(storm::logic::FormulaContext), Skipper> rewardMeasureType; qi::rule<Iterator, storm::logic::RewardMeasureType(storm::logic::FormulaContext), Skipper> rewardMeasureType;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), qi::locals<storm::logic::FormulaContext>, Skipper> operatorFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), qi::locals<storm::logic::FormulaContext>, Skipper> operatorFormula;
// Atomic propositions // Atomic propositions
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> labelFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> labelFormula;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> expressionFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> expressionFormula;
@ -190,7 +190,7 @@ namespace storm {
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(FormulaKind, storm::logic::FormulaContext), Skipper> andLevelPropositionalFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(FormulaKind, storm::logic::FormulaContext), Skipper> andLevelPropositionalFormula;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(FormulaKind, storm::logic::FormulaContext), Skipper> orLevelPropositionalFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(FormulaKind, storm::logic::FormulaContext), Skipper> orLevelPropositionalFormula;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(FormulaKind, storm::logic::FormulaContext), Skipper> propositionalFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(FormulaKind, storm::logic::FormulaContext), Skipper> propositionalFormula;
// Path operators // Path operators
qi::rule<Iterator, std::shared_ptr<storm::logic::TimeBoundReference>, Skipper> timeBoundReference; qi::rule<Iterator, std::shared_ptr<storm::logic::TimeBoundReference>, Skipper> timeBoundReference;
qi::rule<Iterator, std::tuple<boost::optional<storm::logic::TimeBound>, boost::optional<storm::logic::TimeBound>, std::shared_ptr<storm::logic::TimeBoundReference>>(), qi::locals<bool, bool>, Skipper> timeBound; qi::rule<Iterator, std::tuple<boost::optional<storm::logic::TimeBound>, boost::optional<storm::logic::TimeBound>, std::shared_ptr<storm::logic::TimeBoundReference>>(), qi::locals<bool, bool>, Skipper> timeBound;
@ -205,13 +205,13 @@ namespace storm {
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(storm::logic::FormulaContext), Skipper> basicPathFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(storm::logic::FormulaContext), Skipper> basicPathFormula;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(storm::logic::FormulaContext), Skipper> untilLevelPathFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(storm::logic::FormulaContext), Skipper> untilLevelPathFormula;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(storm::logic::FormulaContext), Skipper> pathFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(storm::logic::FormulaContext), Skipper> pathFormula;
// Quantitative path operators (reward) // Quantitative path operators (reward)
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> longRunAverageRewardFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> longRunAverageRewardFormula;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> instantaneousRewardFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> instantaneousRewardFormula;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> cumulativeRewardFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> cumulativeRewardFormula;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> totalRewardFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> totalRewardFormula;
// Game Formulae // Game Formulae
qi::rule<Iterator, storm::logic::PlayerCoalition(), qi::locals<std::vector<boost::variant<std::string, storm::storage::PlayerIndex>>>, Skipper> playerCoalition; qi::rule<Iterator, storm::logic::PlayerCoalition(), qi::locals<std::vector<boost::variant<std::string, storm::storage::PlayerIndex>>>, Skipper> playerCoalition;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> gameFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> gameFormula;
@ -220,7 +220,7 @@ namespace storm {
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> multiOperatorFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> multiOperatorFormula;
qi::rule<Iterator, storm::expressions::Variable(), Skipper> quantileBoundVariable; qi::rule<Iterator, storm::expressions::Variable(), Skipper> quantileBoundVariable;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> quantileFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> quantileFormula;
// General formulae // General formulae
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(FormulaKind, storm::logic::FormulaContext), Skipper> formula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(FormulaKind, storm::logic::FormulaContext), Skipper> formula;
qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> topLevelFormula; qi::rule<Iterator, std::shared_ptr<storm::logic::Formula const>(), Skipper> topLevelFormula;
@ -228,7 +228,7 @@ namespace storm {
// Properties // Properties
qi::rule<Iterator, std::string(), Skipper> formulaName; qi::rule<Iterator, std::string(), Skipper> formulaName;
qi::rule<Iterator, storm::jani::Property(), Skipper> filterProperty; qi::rule<Iterator, storm::jani::Property(), Skipper> filterProperty;
// Constant declarations // Constant declarations
enum class ConstantDataType { enum class ConstantDataType {
Bool, Integer, Rational Bool, Integer, Rational
@ -237,7 +237,7 @@ namespace storm {
// Start symbol // Start symbol
qi::rule<Iterator, std::vector<storm::jani::Property>(), Skipper> start; qi::rule<Iterator, std::vector<storm::jani::Property>(), Skipper> start;
void addHoaAPMapping(storm::logic::Formula const& hoaFormula, const std::string& ap, std::shared_ptr<storm::logic::Formula const>& expression) const; void addHoaAPMapping(storm::logic::Formula const& hoaFormula, const std::string& ap, std::shared_ptr<storm::logic::Formula const>& expression) const;
storm::logic::PlayerCoalition createPlayerCoalition(std::vector<boost::variant<std::string, storm::storage::PlayerIndex>> const& playerIds) const; storm::logic::PlayerCoalition createPlayerCoalition(std::vector<boost::variant<std::string, storm::storage::PlayerIndex>> const& playerIds) const;
@ -263,7 +263,7 @@ namespace storm {
std::shared_ptr<storm::logic::Formula const> createBooleanLiteralFormula(bool literal) const; std::shared_ptr<storm::logic::Formula const> createBooleanLiteralFormula(bool literal) const;
std::shared_ptr<storm::logic::Formula const> createAtomicLabelFormula(std::string const& label) const; std::shared_ptr<storm::logic::Formula const> createAtomicLabelFormula(std::string const& label) const;
std::shared_ptr<storm::logic::Formula const> createEventuallyFormula(boost::optional<std::vector<std::tuple<boost::optional<storm::logic::TimeBound>, boost::optional<storm::logic::TimeBound>, std::shared_ptr<storm::logic::TimeBoundReference>>>> const& timeBounds, storm::logic::FormulaContext context, std::shared_ptr<storm::logic::Formula const> const& subformula) const; std::shared_ptr<storm::logic::Formula const> createEventuallyFormula(boost::optional<std::vector<std::tuple<boost::optional<storm::logic::TimeBound>, boost::optional<storm::logic::TimeBound>, std::shared_ptr<storm::logic::TimeBoundReference>>>> const& timeBounds, storm::logic::FormulaContext context, std::shared_ptr<storm::logic::Formula const> const& subformula) const;
std::shared_ptr<storm::logic::Formula const> createGloballyFormula(boost::optional<std::vector<std::tuple<boost::optional<storm::logic::TimeBound>, boost::optional<storm::logic::TimeBound>, std::shared_ptr<storm::logic::TimeBoundReference>>>> const& timeBounds, std::shared_ptr<storm::logic::Formula const> const& subformula) const;
std::shared_ptr<storm::logic::Formula const> createGloballyFormula(std::shared_ptr<storm::logic::Formula const> const& subformula) const;
std::shared_ptr<storm::logic::Formula const> createNextFormula(std::shared_ptr<storm::logic::Formula const> const& subformula) const; std::shared_ptr<storm::logic::Formula const> createNextFormula(std::shared_ptr<storm::logic::Formula const> const& subformula) const;
std::shared_ptr<storm::logic::Formula const> createUntilFormula(std::shared_ptr<storm::logic::Formula const> const& leftSubformula, boost::optional<std::vector<std::tuple<boost::optional<storm::logic::TimeBound>, boost::optional<storm::logic::TimeBound>, std::shared_ptr<storm::logic::TimeBoundReference>>>> const& timeBounds, std::shared_ptr<storm::logic::Formula const> const& rightSubformula); std::shared_ptr<storm::logic::Formula const> createUntilFormula(std::shared_ptr<storm::logic::Formula const> const& leftSubformula, boost::optional<std::vector<std::tuple<boost::optional<storm::logic::TimeBound>, boost::optional<storm::logic::TimeBound>, std::shared_ptr<storm::logic::TimeBoundReference>>>> const& timeBounds, std::shared_ptr<storm::logic::Formula const> const& rightSubformula);
std::shared_ptr<storm::logic::Formula const> createHOAPathFormula(const std::string& automataFile) const; std::shared_ptr<storm::logic::Formula const> createHOAPathFormula(const std::string& automataFile) const;
@ -289,10 +289,10 @@ namespace storm {
std::set<storm::expressions::Variable> getUndefinedConstants(std::shared_ptr<storm::logic::Formula const> const& formula) const; std::set<storm::expressions::Variable> getUndefinedConstants(std::shared_ptr<storm::logic::Formula const> const& formula) const;
storm::jani::Property createProperty(boost::optional<std::string> const& propertyName, storm::modelchecker::FilterType const& filterType, std::shared_ptr<storm::logic::Formula const> const& formula, std::shared_ptr<storm::logic::Formula const> const& states); storm::jani::Property createProperty(boost::optional<std::string> const& propertyName, storm::modelchecker::FilterType const& filterType, std::shared_ptr<storm::logic::Formula const> const& formula, std::shared_ptr<storm::logic::Formula const> const& states);
storm::jani::Property createPropertyWithDefaultFilterTypeAndStates(boost::optional<std::string> const& propertyName, std::shared_ptr<storm::logic::Formula const> const& formula); storm::jani::Property createPropertyWithDefaultFilterTypeAndStates(boost::optional<std::string> const& propertyName, std::shared_ptr<storm::logic::Formula const> const& formula);
bool isBooleanReturnType(std::shared_ptr<storm::logic::Formula const> const& formula, bool raiseErrorMessage = false); bool isBooleanReturnType(std::shared_ptr<storm::logic::Formula const> const& formula, bool raiseErrorMessage = false);
bool raiseAmbiguousNonAssociativeOperatorError(std::shared_ptr<storm::logic::Formula const> const& formula, std::string const& op); bool raiseAmbiguousNonAssociativeOperatorError(std::shared_ptr<storm::logic::Formula const> const& formula, std::string const& op);
// An error handler function. // An error handler function.
phoenix::function<SpiritErrorHandler> handler; phoenix::function<SpiritErrorHandler> handler;

4
src/storm/logic/BoundedGloballyFormula.cpp

@ -218,7 +218,7 @@ namespace storm {
STORM_LOG_THROW(!bound.containsVariables(), storm::exceptions::InvalidOperationException, "Cannot evaluate time-bound '" << bound << "' as it contains undefined constants."); STORM_LOG_THROW(!bound.containsVariables(), storm::exceptions::InvalidOperationException, "Cannot evaluate time-bound '" << bound << "' as it contains undefined constants.");
} }
std::ostream& BoundedGloballyFormula::writeToStream(std::ostream& out) const {
std::ostream& BoundedGloballyFormula::writeToStream(std::ostream& out, bool allowParentheses) const {
out << "G" ; out << "G" ;
if (this->isMultiDimensional()) { if (this->isMultiDimensional()) {
out << "^{"; out << "^{";
@ -277,4 +277,4 @@ namespace storm {
return out; return out;
} }
} }
}
}

7
src/storm/logic/BoundedGloballyFormula.h

@ -60,10 +60,7 @@ namespace storm {
template<typename ValueType> template<typename ValueType>
ValueType getNonStrictLowerBound(unsigned i = 0) const; ValueType getNonStrictLowerBound(unsigned i = 0) const;
virtual std::ostream &writeToStream(std::ostream &out) const override;
virtual std::ostream &writeToStream(std::ostream &out, bool allowParentheses = false) const override;
private: private:
static void checkNoVariablesInBound(storm::expressions::Expression const& bound); static void checkNoVariablesInBound(storm::expressions::Expression const& bound);
@ -73,4 +70,4 @@ namespace storm {
std::vector<boost::optional<TimeBound>> upperBound; std::vector<boost::optional<TimeBound>> upperBound;
}; };
} }
}
}

3
src/storm/logic/Formula.h

@ -74,6 +74,7 @@ namespace storm {
virtual bool isGloballyFormula() const; virtual bool isGloballyFormula() const;
virtual bool isEventuallyFormula() const; virtual bool isEventuallyFormula() const;
virtual bool isReachabilityProbabilityFormula() const; virtual bool isReachabilityProbabilityFormula() const;
virtual bool isHOAPathFormula() const;
virtual bool isBoundedGloballyFormula() const; virtual bool isBoundedGloballyFormula() const;
// Reward formulas. // Reward formulas.
@ -244,7 +245,7 @@ namespace storm {
* @return * @return
*/ */
virtual std::ostream& writeToStream(std::ostream& out, bool allowParentheses = false) const = 0; virtual std::ostream& writeToStream(std::ostream& out, bool allowParentheses = false) const = 0;
std::string toPrefixString() const; std::string toPrefixString() const;
virtual void gatherAtomicExpressionFormulas(std::vector<std::shared_ptr<AtomicExpressionFormula const>>& atomicExpressionFormulas) const; virtual void gatherAtomicExpressionFormulas(std::vector<std::shared_ptr<AtomicExpressionFormula const>>& atomicExpressionFormulas) const;

9
src/storm/logic/FragmentSpecification.cpp

@ -433,6 +433,15 @@ namespace storm {
return *this; return *this;
} }
bool FragmentSpecification::areBinaryBooleanStateFormulasAllowed() const {
return binaryBooleanStateFormula;
}
FragmentSpecification& FragmentSpecification::setBinaryBooleanStateFormulasAllowed(bool newValue) {
this->binaryBooleanStateFormula = newValue;
return *this;
}
bool FragmentSpecification::areBinaryBooleanPathFormulasAllowed() const { bool FragmentSpecification::areBinaryBooleanPathFormulasAllowed() const {
return binaryBooleanPathFormula; return binaryBooleanPathFormula;
} }

48
src/storm/logic/ToPrefixStringVisitor.cpp

@ -7,20 +7,20 @@
namespace storm { namespace storm {
namespace logic { namespace logic {
std::string ToPrefixStringVisitor::toPrefixString(Formula const& f) const { std::string ToPrefixStringVisitor::toPrefixString(Formula const& f) const {
boost::any result = f.accept(*this, boost::any()); boost::any result = f.accept(*this, boost::any());
return boost::any_cast<std::string>(result); return boost::any_cast<std::string>(result);
} }
boost::any ToPrefixStringVisitor::visit(AtomicExpressionFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(AtomicExpressionFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(AtomicLabelFormula const& f, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(AtomicLabelFormula const& f, boost::any const&) const {
return std::string("\"" + f.getLabel() + "\""); return std::string("\"" + f.getLabel() + "\"");
} }
boost::any ToPrefixStringVisitor::visit(BinaryBooleanStateFormula const& f, boost::any const& data) const { boost::any ToPrefixStringVisitor::visit(BinaryBooleanStateFormula const& f, boost::any const& data) const {
std::string left = boost::any_cast<std::string>(f.getLeftSubformula().accept(*this, data)); std::string left = boost::any_cast<std::string>(f.getLeftSubformula().accept(*this, data));
std::string right = boost::any_cast<std::string>(f.getRightSubformula().accept(*this, data)); std::string right = boost::any_cast<std::string>(f.getRightSubformula().accept(*this, data));
@ -34,7 +34,7 @@ namespace storm {
} }
return boost::any(); return boost::any();
} }
boost::any ToPrefixStringVisitor::visit(BinaryBooleanPathFormula const& f, boost::any const& data) const { boost::any ToPrefixStringVisitor::visit(BinaryBooleanPathFormula const& f, boost::any const& data) const {
std::string left = boost::any_cast<std::string>(f.getLeftSubformula().accept(*this, data)); std::string left = boost::any_cast<std::string>(f.getLeftSubformula().accept(*this, data));
std::string right = boost::any_cast<std::string>(f.getRightSubformula().accept(*this, data)); std::string right = boost::any_cast<std::string>(f.getRightSubformula().accept(*this, data));
@ -58,53 +58,57 @@ namespace storm {
} }
return result; return result;
} }
boost::any ToPrefixStringVisitor::visit(BoundedGloballyFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
}
boost::any ToPrefixStringVisitor::visit(BoundedUntilFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(BoundedUntilFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(ConditionalFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(ConditionalFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(CumulativeRewardFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(CumulativeRewardFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(EventuallyFormula const& f, boost::any const& data) const { boost::any ToPrefixStringVisitor::visit(EventuallyFormula const& f, boost::any const& data) const {
std::string subexpression = boost::any_cast<std::string>(f.getSubformula().accept(*this, data)); std::string subexpression = boost::any_cast<std::string>(f.getSubformula().accept(*this, data));
return std::string("F ") + subexpression; return std::string("F ") + subexpression;
} }
boost::any ToPrefixStringVisitor::visit(TimeOperatorFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(TimeOperatorFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(GloballyFormula const& f, boost::any const& data) const { boost::any ToPrefixStringVisitor::visit(GloballyFormula const& f, boost::any const& data) const {
std::string subexpression = boost::any_cast<std::string>(f.getSubformula().accept(*this, data)); std::string subexpression = boost::any_cast<std::string>(f.getSubformula().accept(*this, data));
return std::string("G ") + subexpression; return std::string("G ") + subexpression;
} }
boost::any ToPrefixStringVisitor::visit(GameFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(GameFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(InstantaneousRewardFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(InstantaneousRewardFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(LongRunAverageOperatorFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(LongRunAverageOperatorFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(LongRunAverageRewardFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(LongRunAverageRewardFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(MultiObjectiveFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(MultiObjectiveFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(QuantileFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(QuantileFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
@ -113,19 +117,19 @@ namespace storm {
std::string subexpression = boost::any_cast<std::string>(f.getSubformula().accept(*this, data)); std::string subexpression = boost::any_cast<std::string>(f.getSubformula().accept(*this, data));
return std::string("X ") + subexpression; return std::string("X ") + subexpression;
} }
boost::any ToPrefixStringVisitor::visit(ProbabilityOperatorFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(ProbabilityOperatorFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(RewardOperatorFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(RewardOperatorFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(TotalRewardFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(TotalRewardFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }
boost::any ToPrefixStringVisitor::visit(UnaryBooleanStateFormula const& f, boost::any const& data) const { boost::any ToPrefixStringVisitor::visit(UnaryBooleanStateFormula const& f, boost::any const& data) const {
std::string subexpression = boost::any_cast<std::string>(f.getSubformula().accept(*this, data)); std::string subexpression = boost::any_cast<std::string>(f.getSubformula().accept(*this, data));
switch (f.getOperator()) { switch (f.getOperator()) {
@ -151,7 +155,7 @@ namespace storm {
std::string right = boost::any_cast<std::string>(f.getRightSubformula().accept(*this, data)); std::string right = boost::any_cast<std::string>(f.getRightSubformula().accept(*this, data));
return std::string("U ") + left + " " + right; return std::string("U ") + left + " " + right;
} }
boost::any ToPrefixStringVisitor::visit(HOAPathFormula const&, boost::any const&) const { boost::any ToPrefixStringVisitor::visit(HOAPathFormula const&, boost::any const&) const {
STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string"); STORM_LOG_THROW(false, storm::exceptions::InvalidOperationException, "Can not convert to prefix string");
} }

8
src/storm/logic/ToPrefixStringVisitor.h

@ -6,16 +6,17 @@
namespace storm { namespace storm {
namespace logic { namespace logic {
class ToPrefixStringVisitor : public FormulaVisitor { class ToPrefixStringVisitor : public FormulaVisitor {
public: public:
std::string toPrefixString(Formula const& f) const; std::string toPrefixString(Formula const& f) const;
virtual boost::any visit(AtomicExpressionFormula const& f, boost::any const& data) const override; virtual boost::any visit(AtomicExpressionFormula const& f, boost::any const& data) const override;
virtual boost::any visit(AtomicLabelFormula const& f, boost::any const& data) const override; virtual boost::any visit(AtomicLabelFormula const& f, boost::any const& data) const override;
virtual boost::any visit(BinaryBooleanStateFormula const& f, boost::any const& data) const override; virtual boost::any visit(BinaryBooleanStateFormula const& f, boost::any const& data) const override;
virtual boost::any visit(BinaryBooleanPathFormula const& f, boost::any const& data) const override; virtual boost::any visit(BinaryBooleanPathFormula const& f, boost::any const& data) const override;
virtual boost::any visit(BooleanLiteralFormula const& f, boost::any const& data) const override; virtual boost::any visit(BooleanLiteralFormula const& f, boost::any const& data) const override;
virtual boost::any visit(BoundedGloballyFormula const& f, boost::any const& data) const override;
virtual boost::any visit(BoundedUntilFormula const& f, boost::any const& data) const override; virtual boost::any visit(BoundedUntilFormula const& f, boost::any const& data) const override;
virtual boost::any visit(ConditionalFormula const& f, boost::any const& data) const override; virtual boost::any visit(ConditionalFormula const& f, boost::any const& data) const override;
virtual boost::any visit(CumulativeRewardFormula const& f, boost::any const& data) const override; virtual boost::any visit(CumulativeRewardFormula const& f, boost::any const& data) const override;
@ -37,7 +38,6 @@ namespace storm {
virtual boost::any visit(UntilFormula const& f, boost::any const& data) const override; virtual boost::any visit(UntilFormula const& f, boost::any const& data) const override;
virtual boost::any visit(HOAPathFormula const& f, boost::any const& data) const override; virtual boost::any visit(HOAPathFormula const& f, boost::any const& data) const override;
}; };
} }
} }

13
src/storm/modelchecker/csl/SparseCtmcCslModelChecker.h

@ -10,25 +10,26 @@
#include "storm/utility/NumberTraits.h" #include "storm/utility/NumberTraits.h"
namespace storm { namespace storm {
namespace modelchecker { namespace modelchecker {
template<class SparseCtmcModelType> template<class SparseCtmcModelType>
class SparseCtmcCslModelChecker : public SparsePropositionalModelChecker<SparseCtmcModelType> { class SparseCtmcCslModelChecker : public SparsePropositionalModelChecker<SparseCtmcModelType> {
public: public:
typedef typename SparseCtmcModelType::ValueType ValueType; typedef typename SparseCtmcModelType::ValueType ValueType;
typedef typename SparseCtmcModelType::RewardModelType RewardModelType; typedef typename SparseCtmcModelType::RewardModelType RewardModelType;
explicit SparseCtmcCslModelChecker(SparseCtmcModelType const& model); explicit SparseCtmcCslModelChecker(SparseCtmcModelType const& model);
// Returns false, if this task can certainly not be handled by this model checker (independent of the concrete model). // Returns false, if this task can certainly not be handled by this model checker (independent of the concrete model).
static bool canHandleStatic(CheckTask<storm::logic::Formula, ValueType> const& checkTask); static bool canHandleStatic(CheckTask<storm::logic::Formula, ValueType> const& checkTask);
// The implemented methods of the AbstractModelChecker interface. // The implemented methods of the AbstractModelChecker interface.
virtual bool canHandle(CheckTask<storm::logic::Formula, ValueType> const& checkTask) const override; virtual bool canHandle(CheckTask<storm::logic::Formula, ValueType> const& checkTask) const override;
virtual std::unique_ptr<CheckResult> computeBoundedUntilProbabilities(Environment const& env, CheckTask<storm::logic::BoundedUntilFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeBoundedUntilProbabilities(Environment const& env, CheckTask<storm::logic::BoundedUntilFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeNextProbabilities(Environment const& env, CheckTask<storm::logic::NextFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeNextProbabilities(Environment const& env, CheckTask<storm::logic::NextFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeUntilProbabilities(Environment const& env, CheckTask<storm::logic::UntilFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeUntilProbabilities(Environment const& env, CheckTask<storm::logic::UntilFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeLTLProbabilities(Environment const& env, CheckTask<storm::logic::PathFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeLongRunAverageProbabilities(Environment const& env, CheckTask<storm::logic::StateFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeLongRunAverageProbabilities(Environment const& env, CheckTask<storm::logic::StateFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeReachabilityTimes(Environment const& env, storm::logic::RewardMeasureType rewardMeasureType, CheckTask<storm::logic::EventuallyFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeReachabilityTimes(Environment const& env, storm::logic::RewardMeasureType rewardMeasureType, CheckTask<storm::logic::EventuallyFormula, ValueType> const& checkTask) override;
@ -50,7 +51,7 @@ namespace storm {
std::unique_ptr<CheckResult> computeSteadyStateDistribution(Environment const& env); std::unique_ptr<CheckResult> computeSteadyStateDistribution(Environment const& env);
}; };
} // namespace modelchecker } // namespace modelchecker
} // namespace storm } // namespace storm

1
src/storm/modelchecker/prctl/SparseDtmcPrctlModelChecker.h

@ -30,6 +30,7 @@ namespace storm {
virtual std::unique_ptr<CheckResult> computeNextProbabilities(Environment const& env, CheckTask<storm::logic::NextFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeNextProbabilities(Environment const& env, CheckTask<storm::logic::NextFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeUntilProbabilities(Environment const& env, CheckTask<storm::logic::UntilFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeUntilProbabilities(Environment const& env, CheckTask<storm::logic::UntilFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeGloballyProbabilities(Environment const& env, CheckTask<storm::logic::GloballyFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeGloballyProbabilities(Environment const& env, CheckTask<storm::logic::GloballyFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeHOAPathProbabilities(Environment const& env, CheckTask<storm::logic::HOAPathFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeConditionalProbabilities(Environment const& env, CheckTask<storm::logic::ConditionalFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeConditionalProbabilities(Environment const& env, CheckTask<storm::logic::ConditionalFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeLongRunAverageProbabilities(Environment const& env, CheckTask<storm::logic::StateFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeLongRunAverageProbabilities(Environment const& env, CheckTask<storm::logic::StateFormula, ValueType> const& checkTask) override;
virtual std::unique_ptr<CheckResult> computeLTLProbabilities(Environment const& env, CheckTask<storm::logic::PathFormula, ValueType> const& checkTask) override; virtual std::unique_ptr<CheckResult> computeLTLProbabilities(Environment const& env, CheckTask<storm::logic::PathFormula, ValueType> const& checkTask) override;

2
src/storm/modelchecker/prctl/helper/SparseMdpPrctlHelper.cpp

@ -635,6 +635,8 @@ namespace storm {
} }
} }
std::vector<ValueType> maybeStateChoiceValues = std::vector<ValueType>(sizeMaybeStateChoiceValues, storm::utility::zero<ValueType>());
// Check whether we need to compute exact probabilities for some states. // Check whether we need to compute exact probabilities for some states.
if ((qualitative || maybeStatesNotRelevant) && !goal.isShieldingTask()) { if ((qualitative || maybeStatesNotRelevant) && !goal.isShieldingTask()) {
// Set the values for all maybe-states to 0.5 to indicate that their probability values are neither 0 nor 1. // Set the values for all maybe-states to 0.5 to indicate that their probability values are neither 0 nor 1.

3
src/storm/storage/Scheduler.cpp

@ -274,7 +274,8 @@ namespace storm {
} }
stateString << "model state' = " << entryIt->getColumn() << ": -> " << "(m' = "<<this->memoryStructure->getSuccessorMemoryState(memoryState, entryIt - model->getTransitionMatrix().begin()) <<")"; stateString << "model state' = " << entryIt->getColumn() << ": -> " << "(m' = "<<this->memoryStructure->getSuccessorMemoryState(memoryState, entryIt - model->getTransitionMatrix().begin()) <<")";
// out << "model state' = " << entryIt->getColumn() << ": (transition = " << entryIt - model->getTransitionMatrix().begin() << ") -> " << "(m' = "<<this->memoryStructure->getSuccessorMemoryState(memoryState, entryIt - model->getTransitionMatrix().begin()) <<")"; // out << "model state' = " << entryIt->getColumn() << ": (transition = " << entryIt - model->getTransitionMatrix().begin() << ") -> " << "(m' = "<<this->memoryStructure->getSuccessorMemoryState(memoryState, entryIt - model->getTransitionMatrix().begin()) <<")";
}
}
}
stateString << std::endl; stateString << std::endl;
} }

1
src/storm/storage/Scheduler.h

@ -154,7 +154,6 @@ namespace storm {
std::vector<storm::storage::BitVector> reachableStates; std::vector<storm::storage::BitVector> reachableStates;
uint_fast64_t numOfUndefinedChoices; // Only consider reachable ones uint_fast64_t numOfUndefinedChoices; // Only consider reachable ones
std::vector<storm::storage::BitVector> dontCareStates; // Their choices are neither considered deterministic nor undefined std::vector<storm::storage::BitVector> dontCareStates; // Their choices are neither considered deterministic nor undefined
uint_fast64_t numOfUndefinedChoices;
uint_fast64_t numOfDeterministicChoices; uint_fast64_t numOfDeterministicChoices;
uint_fast64_t numOfDontCareStates; uint_fast64_t numOfDontCareStates;
}; };

Loading…
Cancel
Save