Browse Source

fixing more of Lindas issues

main
dehnert 7 years ago
parent
commit
6ab7859c84
  1. 26
      src/storm-cli-utilities/model-handling.h
  2. 2
      src/storm-dft/api/storm-dft.cpp
  3. 7
      src/storm-gspn/builder/JaniGSPNBuilder.cpp
  4. 16
      src/storm-parsers/parser/FormulaParserGrammar.cpp
  5. 3
      src/storm-parsers/parser/FormulaParserGrammar.h
  6. 2
      src/storm-parsers/parser/JaniParser.cpp
  7. 8
      src/storm/logic/BoundedUntilFormula.cpp
  8. 3
      src/storm/logic/OperatorFormula.cpp
  9. 2
      src/storm/logic/RewardAccumulationEliminationVisitor.cpp
  10. 4
      src/storm/settings/modules/AbstractionSettings.cpp
  11. 31
      src/storm/storage/jani/Property.cpp
  12. 9
      src/storm/storage/jani/Property.h

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

@ -131,6 +131,19 @@ namespace storm {
} }
} }
// Make sure there are no undefined constants remaining in any property.
for (auto const& property : output.properties) {
std::set<storm::expressions::Variable> usedUndefinedConstants = property.getUndefinedConstants();
if (!usedUndefinedConstants.empty()) {
std::vector<std::string> undefinedConstantsNames;
for (auto const& constant : usedUndefinedConstants) {
undefinedConstantsNames.emplace_back(constant.getName());
}
STORM_LOG_THROW(false, storm::exceptions::InvalidArgumentException, "The property '" << property << " still refers to the undefined constants " << boost::algorithm::join(undefinedConstantsNames, ",") << ".");
}
}
// Check whether conversion for PRISM to JANI is requested or necessary. // Check whether conversion for PRISM to JANI is requested or necessary.
if (input.model && input.model.get().isPrismProgram()) { if (input.model && input.model.get().isPrismProgram()) {
bool transformToJani = ioSettings.isPrismToJaniSet(); bool transformToJani = ioSettings.isPrismToJaniSet();
@ -567,6 +580,10 @@ namespace storm {
expressionParser.setIdentifierMapping(variableMapping); expressionParser.setIdentifierMapping(variableMapping);
for (auto const& constraintString : constraintsAsStrings) { for (auto const& constraintString : constraintsAsStrings) {
if (constraintString.empty()) {
continue;
}
storm::expressions::Expression constraint = expressionParser.parseFromString(constraintString); storm::expressions::Expression constraint = expressionParser.parseFromString(constraintString);
STORM_LOG_TRACE("Adding special (user-provided) constraint " << constraint << "."); STORM_LOG_TRACE("Adding special (user-provided) constraint " << constraint << ".");
constraints.emplace_back(constraint); constraints.emplace_back(constraint);
@ -588,24 +605,33 @@ namespace storm {
std::vector<std::string> predicateGroupsAsStrings; std::vector<std::string> predicateGroupsAsStrings;
boost::split(predicateGroupsAsStrings, refinementPredicatesString, boost::is_any_of(";")); boost::split(predicateGroupsAsStrings, refinementPredicatesString, boost::is_any_of(";"));
if (!predicateGroupsAsStrings.empty()) {
for (auto const& predicateGroupString : predicateGroupsAsStrings) { for (auto const& predicateGroupString : predicateGroupsAsStrings) {
if (predicateGroupString.empty()) {
continue;
}
std::vector<std::string> predicatesAsStrings; std::vector<std::string> predicatesAsStrings;
boost::split(predicatesAsStrings, predicateGroupString, boost::is_any_of(":")); boost::split(predicatesAsStrings, predicateGroupString, boost::is_any_of(":"));
if (!predicatesAsStrings.empty()) {
injectedRefinementPredicates.emplace_back(); injectedRefinementPredicates.emplace_back();
for (auto const& predicateString : predicatesAsStrings) { for (auto const& predicateString : predicatesAsStrings) {
storm::expressions::Expression predicate = expressionParser.parseFromString(predicateString); storm::expressions::Expression predicate = expressionParser.parseFromString(predicateString);
STORM_LOG_TRACE("Adding special (user-provided) refinement predicate " << predicateString << "."); STORM_LOG_TRACE("Adding special (user-provided) refinement predicate " << predicateString << ".");
injectedRefinementPredicates.back().emplace_back(predicate); injectedRefinementPredicates.back().emplace_back(predicate);
} }
STORM_LOG_THROW(!injectedRefinementPredicates.back().empty(), storm::exceptions::InvalidArgumentException, "Expecting non-empty list of predicates to inject for each (mentioned) refinement step."); STORM_LOG_THROW(!injectedRefinementPredicates.back().empty(), storm::exceptions::InvalidArgumentException, "Expecting non-empty list of predicates to inject for each (mentioned) refinement step.");
// Finally reverse the list, because we take the predicates from the back. // Finally reverse the list, because we take the predicates from the back.
std::reverse(injectedRefinementPredicates.back().begin(), injectedRefinementPredicates.back().end()); std::reverse(injectedRefinementPredicates.back().begin(), injectedRefinementPredicates.back().end());
} }
}
// Finally reverse the list, because we take the predicates from the back. // Finally reverse the list, because we take the predicates from the back.
std::reverse(injectedRefinementPredicates.begin(), injectedRefinementPredicates.end()); std::reverse(injectedRefinementPredicates.begin(), injectedRefinementPredicates.end());
}
return injectedRefinementPredicates; return injectedRefinementPredicates;
} }

2
src/storm-dft/api/storm-dft.cpp

@ -57,7 +57,7 @@ namespace storm {
auto evFormula = std::make_shared<storm::logic::EventuallyFormula>(evtlFormula, storm::logic::FormulaContext::Time); auto evFormula = std::make_shared<storm::logic::EventuallyFormula>(evtlFormula, storm::logic::FormulaContext::Time);
auto rewFormula = std::make_shared<storm::logic::TimeOperatorFormula>(evFormula, storm::logic::OperatorInformation(), storm::logic::RewardMeasureType::Expectation); auto rewFormula = std::make_shared<storm::logic::TimeOperatorFormula>(evFormula, storm::logic::OperatorInformation(), storm::logic::RewardMeasureType::Expectation);
std::vector<storm::jani::Property> res({storm::jani::Property("time-bounded", tbUntil), storm::jani::Property("mttf", rewFormula)});
std::vector<storm::jani::Property> res({storm::jani::Property("time-bounded", tbUntil, {}), storm::jani::Property("mttf", rewFormula, {})});
return res; return res;
} }
); );

7
src/storm-gspn/builder/JaniGSPNBuilder.cpp

@ -275,11 +275,12 @@ namespace storm {
auto const& deadlockVar = addDeadlockTransientVariable(model, getUniqueVarName(*expressionManager, "deadl")); auto const& deadlockVar = addDeadlockTransientVariable(model, getUniqueVarName(*expressionManager, "deadl"));
auto deadlock = std::make_shared<storm::logic::AtomicExpressionFormula>(deadlockVar.getExpressionVariable().getExpression()); auto deadlock = std::make_shared<storm::logic::AtomicExpressionFormula>(deadlockVar.getExpressionVariable().getExpression());
auto trueFormula = std::make_shared<storm::logic::BooleanLiteralFormula>(true); auto trueFormula = std::make_shared<storm::logic::BooleanLiteralFormula>(true);
std::set<storm::expressions::Variable> emptyVariableSet;
auto maxReachDeadlock = std::make_shared<storm::logic::ProbabilityOperatorFormula>( auto maxReachDeadlock = std::make_shared<storm::logic::ProbabilityOperatorFormula>(
std::make_shared<storm::logic::EventuallyFormula>(deadlock, storm::logic::FormulaContext::Probability), std::make_shared<storm::logic::EventuallyFormula>(deadlock, storm::logic::FormulaContext::Probability),
storm::logic::OperatorInformation(storm::solver::OptimizationDirection::Maximize)); storm::logic::OperatorInformation(storm::solver::OptimizationDirection::Maximize));
standardProperties.emplace_back("MaxPrReachDeadlock", maxReachDeadlock, "The maximal probability to eventually reach a deadlock.");
standardProperties.emplace_back("MaxPrReachDeadlock", maxReachDeadlock, emptyVariableSet, "The maximal probability to eventually reach a deadlock.");
auto exprTB = expressionManager->declareRationalVariable(getUniqueVarName(*expressionManager, "TIME_BOUND")); auto exprTB = expressionManager->declareRationalVariable(getUniqueVarName(*expressionManager, "TIME_BOUND"));
auto janiTB = storm::jani::Constant(exprTB.getName(), exprTB); auto janiTB = storm::jani::Constant(exprTB.getName(), exprTB);
@ -289,12 +290,12 @@ namespace storm {
auto maxReachDeadlockTimeBounded = std::make_shared<storm::logic::ProbabilityOperatorFormula>( auto maxReachDeadlockTimeBounded = std::make_shared<storm::logic::ProbabilityOperatorFormula>(
std::make_shared<storm::logic::BoundedUntilFormula>(trueFormula, deadlock, boost::none, tb, tbr), std::make_shared<storm::logic::BoundedUntilFormula>(trueFormula, deadlock, boost::none, tb, tbr),
storm::logic::OperatorInformation(storm::solver::OptimizationDirection::Maximize)); storm::logic::OperatorInformation(storm::solver::OptimizationDirection::Maximize));
standardProperties.emplace_back("MaxPrReachDeadlockTB", maxReachDeadlockTimeBounded, "The maximal probability to reach a deadlock within 'TIME_BOUND' steps.");
standardProperties.emplace_back("MaxPrReachDeadlockTB", maxReachDeadlockTimeBounded, emptyVariableSet, "The maximal probability to reach a deadlock within 'TIME_BOUND' steps.");
auto expTimeDeadlock = std::make_shared<storm::logic::TimeOperatorFormula>( auto expTimeDeadlock = std::make_shared<storm::logic::TimeOperatorFormula>(
std::make_shared<storm::logic::EventuallyFormula>(deadlock, storm::logic::FormulaContext::Time), std::make_shared<storm::logic::EventuallyFormula>(deadlock, storm::logic::FormulaContext::Time),
storm::logic::OperatorInformation(storm::solver::OptimizationDirection::Maximize)); storm::logic::OperatorInformation(storm::solver::OptimizationDirection::Maximize));
standardProperties.emplace_back("MinExpTimeDeadlock", expTimeDeadlock, "The minimal expected time to reach a deadlock.");
standardProperties.emplace_back("MinExpTimeDeadlock", expTimeDeadlock, emptyVariableSet, "The minimal expected time to reach a deadlock.");
} }

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

@ -224,6 +224,7 @@ namespace storm {
if (expression) { if (expression) {
addIdentifierExpression(name, expression.get()); addIdentifierExpression(name, expression.get());
} else { } else {
undefinedConstants.insert(newVariable);
addIdentifierExpression(name, newVariable); addIdentifierExpression(name, newVariable);
} }
} }
@ -418,23 +419,30 @@ namespace storm {
} }
} }
std::set<storm::expressions::Variable> FormulaParserGrammar::getUndefinedConstants(std::shared_ptr<storm::logic::Formula const> const& formula) const {
std::set<storm::expressions::Variable> result;
std::set<storm::expressions::Variable> usedVariables = formula->getUsedVariables();
std::set_intersection(usedVariables.begin(), usedVariables.end(), undefinedConstants.begin(), undefinedConstants.end(), std::inserter(result, result.begin()));
return result;
}
storm::jani::Property FormulaParserGrammar::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 FormulaParserGrammar::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::FilterExpression filterExpression(formula, filterType, states); storm::jani::FilterExpression filterExpression(formula, filterType, states);
++propertyCount; ++propertyCount;
if (propertyName) { if (propertyName) {
return storm::jani::Property(propertyName.get(), filterExpression);
return storm::jani::Property(propertyName.get(), filterExpression, this->getUndefinedConstants(formula));
} else { } else {
return storm::jani::Property(std::to_string(propertyCount -1 ), filterExpression);
return storm::jani::Property(std::to_string(propertyCount - 1), filterExpression, this->getUndefinedConstants(formula));
} }
} }
storm::jani::Property FormulaParserGrammar::createPropertyWithDefaultFilterTypeAndStates(boost::optional<std::string> const& propertyName, std::shared_ptr<storm::logic::Formula const> const& formula) { storm::jani::Property FormulaParserGrammar::createPropertyWithDefaultFilterTypeAndStates(boost::optional<std::string> const& propertyName, std::shared_ptr<storm::logic::Formula const> const& formula) {
++propertyCount; ++propertyCount;
if (propertyName) { if (propertyName) {
return storm::jani::Property(propertyName.get(), formula);
return storm::jani::Property(propertyName.get(), formula, this->getUndefinedConstants(formula));
} else { } else {
return storm::jani::Property(std::to_string(propertyCount), formula);
return storm::jani::Property(std::to_string(propertyCount), formula, this->getUndefinedConstants(formula));
} }
} }

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

@ -230,6 +230,7 @@ namespace storm {
std::shared_ptr<storm::logic::Formula const> createUnaryBooleanStateFormula(std::shared_ptr<storm::logic::Formula const> const& subformula, boost::optional<storm::logic::UnaryBooleanStateFormula::OperatorType> const& operatorType); std::shared_ptr<storm::logic::Formula const> createUnaryBooleanStateFormula(std::shared_ptr<storm::logic::Formula const> const& subformula, boost::optional<storm::logic::UnaryBooleanStateFormula::OperatorType> const& operatorType);
std::shared_ptr<storm::logic::Formula const> createMultiFormula(std::vector<std::shared_ptr<storm::logic::Formula const>> const& subformulas); std::shared_ptr<storm::logic::Formula const> createMultiFormula(std::vector<std::shared_ptr<storm::logic::Formula const>> const& subformulas);
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);
@ -237,6 +238,8 @@ namespace storm {
phoenix::function<SpiritErrorHandler> handler; phoenix::function<SpiritErrorHandler> handler;
uint64_t propertyCount; uint64_t propertyCount;
std::set<storm::expressions::Variable> undefinedConstants;
}; };
} }

2
src/storm-parsers/parser/JaniParser.cpp

@ -560,7 +560,7 @@ namespace storm {
STORM_LOG_THROW(statesFormula, storm::exceptions::NotImplementedException, "Could not derive states formula."); STORM_LOG_THROW(statesFormula, storm::exceptions::NotImplementedException, "Could not derive states formula.");
STORM_LOG_THROW(expressionStructure.count("values") == 1, storm::exceptions::InvalidJaniException, "Values as input for a filter must be given"); STORM_LOG_THROW(expressionStructure.count("values") == 1, storm::exceptions::InvalidJaniException, "Values as input for a filter must be given");
auto formula = parseFormula(expressionStructure.at("values"), storm::logic::FormulaContext::Undefined, globalVars, constants, "Values of property " + name); auto formula = parseFormula(expressionStructure.at("values"), storm::logic::FormulaContext::Undefined, globalVars, constants, "Values of property " + name);
return storm::jani::Property(name, storm::jani::FilterExpression(formula, ft, statesFormula), comment);
return storm::jani::Property(name, storm::jani::FilterExpression(formula, ft, statesFormula), {}, comment);
} }
std::shared_ptr<storm::jani::Constant> JaniParser::parseConstant(json const& constantStructure, std::unordered_map<std::string, std::shared_ptr<storm::jani::Constant>> const& constants, std::string const& scopeDescription) { std::shared_ptr<storm::jani::Constant> JaniParser::parseConstant(json const& constantStructure, std::unordered_map<std::string, std::shared_ptr<storm::jani::Constant>> const& constants, std::string const& scopeDescription) {

8
src/storm/logic/BoundedUntilFormula.cpp

@ -89,16 +89,24 @@ namespace storm {
for (unsigned i = 0; i < this->getDimension(); ++i) { for (unsigned i = 0; i < this->getDimension(); ++i) {
this->getLeftSubformula(i).gatherUsedVariables(usedVariables); this->getLeftSubformula(i).gatherUsedVariables(usedVariables);
this->getRightSubformula(i).gatherUsedVariables(usedVariables); this->getRightSubformula(i).gatherUsedVariables(usedVariables);
if (this->hasLowerBound(i)) {
this->getLowerBound(i).gatherVariables(usedVariables); this->getLowerBound(i).gatherVariables(usedVariables);
}
if (this->hasUpperBound(i)) {
this->getUpperBound(i).gatherVariables(usedVariables); this->getUpperBound(i).gatherVariables(usedVariables);
} }
}
} else { } else {
this->getLeftSubformula().gatherUsedVariables(usedVariables); this->getLeftSubformula().gatherUsedVariables(usedVariables);
this->getRightSubformula().gatherUsedVariables(usedVariables); this->getRightSubformula().gatherUsedVariables(usedVariables);
if (this->hasLowerBound()) {
this->getLowerBound().gatherVariables(usedVariables); this->getLowerBound().gatherVariables(usedVariables);
}
if (this->hasUpperBound()) {
this->getUpperBound().gatherVariables(usedVariables); this->getUpperBound().gatherVariables(usedVariables);
} }
} }
}
bool BoundedUntilFormula::hasQualitativeResult() const { bool BoundedUntilFormula::hasQualitativeResult() const {
return false; return false;

3
src/storm/logic/OperatorFormula.cpp

@ -86,8 +86,11 @@ namespace storm {
} }
void OperatorFormula::gatherUsedVariables(std::set<storm::expressions::Variable>& usedVariables) const { void OperatorFormula::gatherUsedVariables(std::set<storm::expressions::Variable>& usedVariables) const {
UnaryStateFormula::gatherUsedVariables(usedVariables);
if (this->hasBound()) {
this->getThreshold().gatherVariables(usedVariables); this->getThreshold().gatherVariables(usedVariables);
} }
}
std::ostream& OperatorFormula::writeToStream(std::ostream& out) const { std::ostream& OperatorFormula::writeToStream(std::ostream& out) const {
if (hasOptimalityType()) { if (hasOptimalityType()) {

2
src/storm/logic/RewardAccumulationEliminationVisitor.cpp

@ -25,7 +25,7 @@ namespace storm {
auto formula = eliminateRewardAccumulations(*p.getFilter().getFormula()); auto formula = eliminateRewardAccumulations(*p.getFilter().getFormula());
auto states = eliminateRewardAccumulations(*p.getFilter().getStatesFormula()); auto states = eliminateRewardAccumulations(*p.getFilter().getStatesFormula());
storm::jani::FilterExpression fe(formula, p.getFilter().getFilterType(), states); storm::jani::FilterExpression fe(formula, p.getFilter().getFilterType(), states);
p = storm::jani::Property(p.getName(), storm::jani::FilterExpression(formula, p.getFilter().getFilterType(), states), p.getComment());
p = storm::jani::Property(p.getName(), storm::jani::FilterExpression(formula, p.getFilter().getFilterType(), states), p.getUndefinedConstants(), p.getComment());
} }
} }

4
src/storm/settings/modules/AbstractionSettings.cpp

@ -111,11 +111,11 @@ namespace storm {
.build()); .build());
this->addOption(storm::settings::OptionBuilder(moduleName, constraintsOptionName, true, "Specifies additional constraints used by the abstraction.") this->addOption(storm::settings::OptionBuilder(moduleName, constraintsOptionName, true, "Specifies additional constraints used by the abstraction.")
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("constraints", "The constraints to use.").build())
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("constraints", "The constraints to use.").setDefaultValueString("").build())
.build()); .build());
this->addOption(storm::settings::OptionBuilder(moduleName, injectRefinementPredicatesOptionName, true, "Specifies predicates used by the refinement instead of the derived predicates.") this->addOption(storm::settings::OptionBuilder(moduleName, injectRefinementPredicatesOptionName, true, "Specifies predicates used by the refinement instead of the derived predicates.")
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("predicates", "The (semicolon-separated) refinement predicates to use.").build())
.addArgument(storm::settings::ArgumentBuilder::createStringArgument("predicates", "The (semicolon-separated) refinement predicates to use.").setDefaultValueString("").build())
.build()); .build());
this->addOption(storm::settings::OptionBuilder(moduleName, fixPlayer1StrategyOptionName, true, "Sets whether to fix player 1 strategies.") this->addOption(storm::settings::OptionBuilder(moduleName, fixPlayer1StrategyOptionName, true, "Sets whether to fix player 1 strategies.")

31
src/storm/storage/jani/Property.cpp

@ -1,20 +1,19 @@
#include "Property.h" #include "Property.h"
namespace storm { namespace storm {
namespace jani { namespace jani {
std::ostream& operator<<(std::ostream& os, FilterExpression const& fe) { std::ostream& operator<<(std::ostream& os, FilterExpression const& fe) {
return os << "Obtain " << toString(fe.getFilterType()) << " of the '" << fe.getStatesFormula() << "'-states with values described by '" << *fe.getFormula() << "'";
return os << "Obtain " << toString(fe.getFilterType()) << " of the '" << *fe.getStatesFormula() << "'-states with values described by '" << *fe.getFormula() << "'";
} }
Property::Property(std::string const& name, std::shared_ptr<storm::logic::Formula const> const& formula, std::string const& comment)
: name(name), comment(comment), filterExpression(FilterExpression(formula)) {
Property::Property(std::string const& name, std::shared_ptr<storm::logic::Formula const> const& formula, std::set<storm::expressions::Variable> const& undefinedConstants, std::string const& comment)
: name(name), comment(comment), filterExpression(FilterExpression(formula)), undefinedConstants(undefinedConstants) {
// Intentionally left empty. // Intentionally left empty.
} }
Property::Property(std::string const& name, FilterExpression const& fe, std::string const& comment)
: name(name), comment(comment), filterExpression(fe) {
Property::Property(std::string const& name, FilterExpression const& fe, std::set<storm::expressions::Variable> const& undefinedConstants, std::string const& comment)
: name(name), comment(comment), filterExpression(fe), undefinedConstants(undefinedConstants) {
// Intentionally left empty. // Intentionally left empty.
} }
@ -27,11 +26,17 @@ namespace storm {
} }
Property Property::substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const { Property Property::substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution) const {
return Property(name, filterExpression.substitute(substitution), comment);
std::set<storm::expressions::Variable> remainingUndefinedConstants;
for (auto const& constant : undefinedConstants) {
if (substitution.find(constant) == substitution.end()) {
remainingUndefinedConstants.insert(constant);
}
}
return Property(name, filterExpression.substitute(substitution), remainingUndefinedConstants, comment);
} }
Property Property::substituteLabels(std::map<std::string, std::string> const& substitution) const { Property Property::substituteLabels(std::map<std::string, std::string> const& substitution) const {
return Property(name, filterExpression.substituteLabels(substitution), comment);
return Property(name, filterExpression.substituteLabels(substitution), undefinedConstants, comment);
} }
FilterExpression const& Property::getFilter() const { FilterExpression const& Property::getFilter() const {
@ -42,6 +47,14 @@ namespace storm {
return this->filterExpression.getFormula(); return this->filterExpression.getFormula();
} }
std::set<storm::expressions::Variable> const& Property::getUndefinedConstants() const {
return undefinedConstants;
}
bool Property::containsUndefinedConstants() const {
return !undefinedConstants.empty();
}
std::ostream& operator<<(std::ostream& os, Property const& p) { std::ostream& operator<<(std::ostream& os, Property const& p) {
return os << "(" << p.getName() << "): " << p.getFilter(); return os << "(" << p.getName() << "): " << p.getFilter();
} }

9
src/storm/storage/jani/Property.h

@ -78,9 +78,10 @@ namespace storm {
* Constructs the property * Constructs the property
* @param name the name * @param name the name
* @param formula the formula representation * @param formula the formula representation
* @param undefinedConstants the undefined constants used in the property
* @param comment An optional comment * @param comment An optional comment
*/ */
Property(std::string const& name, std::shared_ptr<storm::logic::Formula const> const& formula, std::string const& comment = "");
Property(std::string const& name, std::shared_ptr<storm::logic::Formula const> const& formula, std::set<storm::expressions::Variable> const& undefinedConstants, std::string const& comment = "");
/** /**
* Constructs the property * Constructs the property
@ -88,7 +89,7 @@ namespace storm {
* @param formula the formula representation * @param formula the formula representation
* @param comment An optional comment * @param comment An optional comment
*/ */
Property(std::string const& name, FilterExpression const& fe, std::string const& comment = "");
Property(std::string const& name, FilterExpression const& fe, std::set<storm::expressions::Variable> const& undefinedConstants, std::string const& comment = "");
/** /**
* Get the provided name * Get the provided name
@ -107,11 +108,15 @@ namespace storm {
FilterExpression const& getFilter() const; FilterExpression const& getFilter() const;
std::set<storm::expressions::Variable> const& getUndefinedConstants() const;
bool containsUndefinedConstants() const;
std::shared_ptr<storm::logic::Formula const> getRawFormula() const; std::shared_ptr<storm::logic::Formula const> getRawFormula() const;
private: private:
std::string name; std::string name;
std::string comment; std::string comment;
FilterExpression filterExpression; FilterExpression filterExpression;
std::set<storm::expressions::Variable> undefinedConstants;
}; };

Loading…
Cancel
Save