21template<
class SparseModelType>
24 "The subformula " << propositionalGoalStateFormula <<
" should be propositional.");
28 mc.
check(propositionalGoalStateFormula)->template asExplicitQualitativeCheckResult<typename SparseModelType::ValueType>().getTruthValuesVector();
31 if (model.getInitialStates().isSubsetOf(goalStates)) {
32 STORM_LOG_INFO(
"One objective is already satisfied for all initial states.");
34 typename SparseModelType::RewardModelType>::buildTrivialMemoryStructure(model);
39 builder.setTransition(0, 0, ~goalStates);
40 builder.setTransition(0, 1, goalStates);
42 for (
auto initState : model.getInitialStates()) {
43 builder.setInitialMemoryState(initState, goalStates.
get(initState) ? 1 : 0);
48template<
class SparseModelType>
51 auto notLeftOrRight = std::make_shared<storm::logic::BinaryBooleanStateFormula>(
52 storm::logic::BinaryBooleanStateFormula::OperatorType::Or,
53 std::make_shared<storm::logic::UnaryBooleanStateFormula>(storm::logic::UnaryBooleanStateFormula::OperatorType::Not, leftSubFormula.
asSharedPointer()),
58template<
class SparseModelType>
60 std::vector<std::shared_ptr<storm::logic::Formula const>>
const& formulas) {
65 for (
auto const& subFormula : formulas) {
66 STORM_LOG_THROW(subFormula->isOperatorFormula(), storm::exceptions::NotSupportedException,
"The given Formula " << *subFormula <<
" is not supported.");
67 auto const& subsubFormula = subFormula->asOperatorFormula().getSubformula();
68 if (subsubFormula.isEventuallyFormula()) {
69 memory = memory.
product(
getGoalMemory(model, subsubFormula.asEventuallyFormula().getSubformula()));
70 }
else if (subsubFormula.isUntilFormula()) {
72 getUntilFormulaMemory(model, subsubFormula.asUntilFormula().getLeftSubformula(), subsubFormula.asUntilFormula().getRightSubformula()));
73 }
else if (subsubFormula.isBoundedUntilFormula()) {
75 auto const& buf = subsubFormula.asBoundedUntilFormula();
76 if (!buf.isMultiDimensional() && !buf.getTimeBoundReference().isRewardBound() &&
77 (!buf.hasLowerBound() || (!buf.isLowerBoundStrict() &&
storm::utility::isZero(buf.template getLowerBound<storm::RationalNumber>())))) {
80 }
else if (subsubFormula.isGloballyFormula()) {
81 auto notPhi = std::make_shared<storm::logic::UnaryBooleanStateFormula>(storm::logic::UnaryBooleanStateFormula::OperatorType::Not,
82 subsubFormula.asGloballyFormula().getSubformula().asSharedPointer());
85 STORM_LOG_THROW(subFormula->isLongRunAverageOperatorFormula() || subsubFormula.isTotalRewardFormula() ||
86 subsubFormula.isCumulativeRewardFormula() || subsubFormula.isLongRunAverageRewardFormula(),
87 storm::exceptions::NotSupportedException,
"The given Formula " << subsubFormula <<
" is not supported.");
94template<
class SparseModelType>
96 SparseModelType
const& model, std::vector<std::shared_ptr<storm::logic::Formula const>>
const& formulas) {
98 auto product = memory.product(model);
99 return product.build()->template as<SparseModelType>();
102template<
class SparseModelType>
105 std::vector<std::shared_ptr<storm::logic::Formula const>>
const& formulas) {
107 auto product = memory.product(model);
108 auto result = product.build();
109 return std::make_pair(result->template as<SparseModelType>(), product.computeReverseData());
112template<
class SparseModelType>
118template<
class SparseModelType>
virtual std::unique_ptr< CheckResult > check(Environment const &env, CheckTask< storm::logic::Formula, SolutionType > const &checkTask)
Checks the provided formula.
A bit vector that is internally represented as a vector of 64-bit values.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
static MemoryStructure buildTrivialMemoryStructure(storm::models::sparse::Model< ValueType, RewardModelType > const &model)
Builds a trivial memory structure for the given model (consisting of a single memory state).
This class represents a (deterministic) memory structure that can be used to encode certain events (s...
MemoryStructure product(MemoryStructure const &rhs) const
Builds the product of this memory structure and the given memory structure.
NondeterministicMemoryStructure build(NondeterministicMemoryStructurePattern pattern, uint64_t numStates) const
Data to restore memory incorporation applied with SparseModelMemoryProduct.
std::shared_ptr< SparseModelType > build() const
#define STORM_LOG_INFO(message)
#define STORM_LOG_THROW(cond, exception, message)
FragmentSpecification propositional()
bool isZero(ValueType const &a)