21namespace transformer {
23template<
class SparseModelType>
26 "The subformula " << propositionalGoalStateFormula <<
" should be propositional.");
32 if (model.getInitialStates().isSubsetOf(goalStates)) {
33 STORM_LOG_INFO(
"One objective is already satisfied for all initial states.");
35 typename SparseModelType::RewardModelType>::buildTrivialMemoryStructure(model);
43 for (
auto initState : model.getInitialStates()) {
46 return builder.
build();
49template<
class SparseModelType>
52 auto notLeftOrRight = std::make_shared<storm::logic::BinaryBooleanStateFormula>(
53 storm::logic::BinaryBooleanStateFormula::OperatorType::Or,
54 std::make_shared<storm::logic::UnaryBooleanStateFormula>(storm::logic::UnaryBooleanStateFormula::OperatorType::Not, leftSubFormula.
asSharedPointer()),
56 return getGoalMemory<SparseModelType>(model, *notLeftOrRight);
59template<
class SparseModelType>
61 SparseModelType
const& model, std::vector<std::shared_ptr<storm::logic::Formula const>>
const& formulas) {
64 for (
auto const& subFormula : formulas) {
65 STORM_LOG_THROW(subFormula->isOperatorFormula(), storm::exceptions::NotSupportedException,
"The given Formula " << *subFormula <<
" is not supported.");
66 auto const& subsubFormula = subFormula->asOperatorFormula().getSubformula();
67 if (subsubFormula.isEventuallyFormula()) {
68 memory = memory.
product(
getGoalMemory(model, subsubFormula.asEventuallyFormula().getSubformula()));
69 }
else if (subsubFormula.isUntilFormula()) {
71 getUntilFormulaMemory(model, subsubFormula.asUntilFormula().getLeftSubformula(), subsubFormula.asUntilFormula().getRightSubformula()));
72 }
else if (subsubFormula.isBoundedUntilFormula()) {
74 auto const& buf = subsubFormula.asBoundedUntilFormula();
75 if (!buf.isMultiDimensional() && !buf.getTimeBoundReference().isRewardBound() &&
76 (!buf.hasLowerBound() || (!buf.isLowerBoundStrict() &&
storm::utility::isZero(buf.template getLowerBound<storm::RationalNumber>())))) {
79 }
else if (subsubFormula.isGloballyFormula()) {
80 auto notPhi = std::make_shared<storm::logic::UnaryBooleanStateFormula>(storm::logic::UnaryBooleanStateFormula::OperatorType::Not,
81 subsubFormula.asGloballyFormula().getSubformula().asSharedPointer());
84 STORM_LOG_THROW(subFormula->isLongRunAverageOperatorFormula() || subsubFormula.isTotalRewardFormula() ||
85 subsubFormula.isCumulativeRewardFormula() || subsubFormula.isLongRunAverageRewardFormula(),
86 storm::exceptions::NotSupportedException,
"The given Formula " << subsubFormula <<
" is not supported.");
91 return std::dynamic_pointer_cast<SparseModelType>(product.
build());
94template<
class SparseModelType>
100template<
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(uint_fast64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
void setInitialMemoryState(uint_fast64_t initialModelState, uint_fast64_t initialMemoryState)
Specifies for the given state of the model the corresponding initial memory state.
MemoryStructure build()
Builds the memory structure.
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)
void setTransition(uint_fast64_t const &startState, uint_fast64_t const &goalState, storm::storage::BitVector const &modelStates, boost::optional< storm::storage::BitVector > const &modelChoices=boost::none)
Specifies a transition of the memory structure.
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
This class builds the product of the given sparse model and the given memory structure.
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > build()
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)