Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
PrismNextStateGenerator.h
Go to the documentation of this file.
1#pragma once
2
4
7
8namespace storm {
9namespace generator {
10template<typename StateType, typename ValueType>
11class Distribution;
12
13template<typename ValueType, typename StateType = uint32_t>
14class PrismNextStateGenerator : public NextStateGenerator<ValueType, StateType> {
15 public:
19
21 std::shared_ptr<ActionMask<ValueType, StateType>> const& = nullptr);
22
28 static bool canHandle(storm::prism::Program const& program);
29
30 virtual ModelType getModelType() const override;
31 virtual bool isDeterministicModel() const override;
32 virtual bool isDiscreteTimeModel() const override;
33 virtual bool isPartiallyObservable() const override;
34 virtual std::vector<StateType> getInitialStates(StateToIdCallback const& stateToIdCallback) override;
35
36 virtual StateBehavior<ValueType, StateType> expand(StateToIdCallback const& stateToIdCallback) override;
38
39 virtual std::size_t getNumberOfRewardModels() const override;
40 virtual storm::builder::RewardModelInformation getRewardModelInformation(uint64_t const& index) const override;
41 virtual std::map<std::string, storm::storage::PlayerIndex> getPlayerNameToIndexMap() const override;
42
44 std::vector<StateType> const& initialStateIndices = {},
45 std::vector<StateType> const& deadlockStateIndices = {},
46 std::vector<StateType> const& unexploredStateIndices = {}) override;
47
48 virtual std::shared_ptr<storm::storage::sparse::ChoiceOrigins> generateChoiceOrigins(std::vector<boost::any>& dataForChoiceOrigins) const override;
49
50 private:
52 void checkValid() const;
53
59 PrismNextStateGenerator(storm::prism::Program const& program, NextStateGeneratorOptions const& options,
60 std::shared_ptr<ActionMask<ValueType, StateType>> const&, bool flag);
61
69 CompressedState applyUpdate(CompressedState const& state, storm::prism::Update const& update);
70
87 boost::optional<std::vector<std::vector<std::reference_wrapper<storm::prism::Command const>>>> getActiveCommandsByActionIndex(
88 uint_fast64_t const& actionIndex, CommandFilter const& commandFilter = CommandFilter::All);
89
96 std::vector<Choice<ValueType>> getAsynchronousChoices(CompressedState const& state, StateToIdCallback stateToIdCallback,
97 CommandFilter const& commandFilter = CommandFilter::All);
98
107 void addSynchronousChoices(std::vector<Choice<ValueType>>& choices, CompressedState const& state, StateToIdCallback stateToIdCallback,
108 CommandFilter const& commandFilter = CommandFilter::All);
109
116 std::vector<Choice<ValueType>> getSelfLoopsForAllActions(CompressedState const& state, StateToIdCallback stateToIdCallback,
117 CommandFilter const& commandFilter = CommandFilter::All);
118
122 virtual void extendStateInformation(storm::json<BaseValueType>& stateInfo) const override;
123
127 storm::storage::BitVector evaluateObservationLabels(CompressedState const& state) const override;
128
132 void generateSynchronizedDistribution(storm::storage::BitVector const& state, ValueType const& probability, uint64_t position,
133 std::vector<std::vector<std::reference_wrapper<storm::prism::Command const>>::const_iterator> const& iteratorList,
134 storm::generator::Distribution<StateType, ValueType>& distribution, StateToIdCallback stateToIdCallback);
135
136 bool isCommandPotentiallySynchronizing(prism::Command const& command) const;
137
138 // The program used for the generation of next states.
139 storm::prism::Program program;
140
141 // The reward models that need to be considered.
142 std::vector<std::reference_wrapper<storm::prism::RewardModel const>> rewardModels;
143
144 // A flag that stores whether at least one of the selected reward models has state-action rewards.
145 bool hasStateActionRewards;
146
147 // Mappings from module/action indices to the programs players
148 std::vector<storm::storage::PlayerIndex> moduleIndexToPlayerIndexMap;
149 std::map<uint_fast64_t, storm::storage::PlayerIndex> actionIndexToPlayerIndexMap;
150};
151
152} // namespace generator
153} // namespace storm
Action masks are arguments you can give to the state generator that limit which states are generated.
NextStateGenerator(storm::expressions::ExpressionManager const &expressionManager, VariableInformation const &variableInformation, NextStateGeneratorOptions const &options, std::shared_ptr< ActionMask< ValueType, uint32_t > > const &=nullptr)
std::function< StateType(CompressedState const &)> StateToIdCallback
storm::storage::FlatSet< uint_fast64_t > CommandSet
virtual std::vector< StateType > getInitialStates(StateToIdCallback const &stateToIdCallback) override
NextStateGenerator< ValueType, StateType >::StateToIdCallback StateToIdCallback
virtual StateBehavior< ValueType, StateType > expand(StateToIdCallback const &stateToIdCallback) override
virtual ModelType getModelType() const override
virtual storm::models::sparse::StateLabeling label(storm::storage::sparse::StateStorage< StateType > const &stateStorage, std::vector< StateType > const &initialStateIndices={}, std::vector< StateType > const &deadlockStateIndices={}, std::vector< StateType > const &unexploredStateIndices={}) override
PrismNextStateGenerator(storm::prism::Program const &program, NextStateGeneratorOptions const &options=NextStateGeneratorOptions(), std::shared_ptr< ActionMask< ValueType, StateType > > const &=nullptr)
virtual std::size_t getNumberOfRewardModels() const override
virtual std::shared_ptr< storm::storage::sparse::ChoiceOrigins > generateChoiceOrigins(std::vector< boost::any > &dataForChoiceOrigins) const override
static bool canHandle(storm::prism::Program const &program)
A quick check to detect whether the given model is not supported.
bool evaluateBooleanExpressionInCurrentState(storm::expressions::Expression const &) const
virtual std::map< std::string, storm::storage::PlayerIndex > getPlayerNameToIndexMap() const override
virtual storm::builder::RewardModelInformation getRewardModelInformation(uint64_t const &index) const override
This class manages the labeling of the state space with a number of (atomic) labels.
storm::storage::BitVector CompressedState
storm::builder::BuilderOptions NextStateGeneratorOptions
boost::container::flat_set< Key, std::less< Key >, boost::container::new_allocator< Key > > FlatSet
Redefinition of flat_set was needed, because from Boost 1.70 on the default allocator is set to void.
Definition BoostTypes.h:13
nlohmann::basic_json< std::map, std::vector, std::string, bool, int64_t, uint64_t, ValueType > json
Definition JsonForward.h:11