Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
PrismNextStateGenerator.h
Go to the documentation of this file.
1#ifndef STORM_GENERATOR_PRISMNEXTSTATEGENERATOR_H_
2#define STORM_GENERATOR_PRISMNEXTSTATEGENERATOR_H_
3
5
8
9namespace storm {
10namespace generator {
11template<typename StateType, typename ValueType>
12class Distribution;
13
14template<typename ValueType, typename StateType = uint32_t>
15class PrismNextStateGenerator : public NextStateGenerator<ValueType, StateType> {
16 public:
20
22 std::shared_ptr<ActionMask<ValueType, StateType>> const& = nullptr);
23
29 static bool canHandle(storm::prism::Program const& program);
30
31 virtual ModelType getModelType() const override;
32 virtual bool isDeterministicModel() const override;
33 virtual bool isDiscreteTimeModel() const override;
34 virtual bool isPartiallyObservable() const override;
35 virtual std::vector<StateType> getInitialStates(StateToIdCallback const& stateToIdCallback) override;
36
37 virtual StateBehavior<ValueType, StateType> expand(StateToIdCallback const& stateToIdCallback) override;
39
40 virtual std::size_t getNumberOfRewardModels() const override;
41 virtual storm::builder::RewardModelInformation getRewardModelInformation(uint64_t const& index) const override;
42 virtual std::map<std::string, storm::storage::PlayerIndex> getPlayerNameToIndexMap() const override;
43
45 std::vector<StateType> const& initialStateIndices = {},
46 std::vector<StateType> const& deadlockStateIndices = {},
47 std::vector<StateType> const& unexploredStateIndices = {}) override;
48
49 virtual std::shared_ptr<storm::storage::sparse::ChoiceOrigins> generateChoiceOrigins(std::vector<boost::any>& dataForChoiceOrigins) const override;
50
51 private:
52 void checkValid() const;
53
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<ValueType>& 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,
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
154
155#endif /* STORM_GENERATOR_PRISMNEXTSTATEGENERATOR_H_ */
Action masks are arguments you can give to the state generator that limit which states are generated.
std::function< StateType(CompressedState const &)> StateToIdCallback
CompressedState const * state
The currently loaded state.
NextStateGeneratorOptions options
The options to be used for next-state generation.
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.
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:18
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
LabParser.cpp.
Definition cli.cpp:18
nlohmann::basic_json< std::map, std::vector, std::string, bool, int64_t, uint64_t, ValueType > json
Definition JsonForward.h:10