Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ExplicitModelBuilder.h
Go to the documentation of this file.
1#ifndef STORM_BUILDER_EXPLICITMODELBUILDER_H
2#define STORM_BUILDER_EXPLICITMODELBUILDER_H
3
4#include <boost/container/flat_map.hpp>
5#include <boost/functional/hash.hpp>
6#include <boost/variant.hpp>
7#include <cstdint>
8#include <deque>
9#include <memory>
10#include <utility>
11#include <vector>
13
23
24#include "storm/utility/prism.h"
25
27
31
32namespace storm {
33
34namespace builder {
35
36using namespace storm::utility::prism;
37using namespace storm::generator;
38
39// Forward-declare classes.
40template<typename ValueType>
41class RewardModelBuilder;
42class StateAndChoiceInformationBuilder;
43
44template<typename StateType>
46 public:
48 : varInfo(varInfo), stateToId(stateToId) {
49 // intentionally left empty.
50 }
51
57 StateType lookup(std::map<storm::expressions::Variable, storm::expressions::Expression> const& stateDescription) const;
61 uint64_t size() const;
62
63 private:
64 VariableInformation varInfo;
66};
67
68template<typename ValueType, typename RewardModelType = storm::models::sparse::StandardRewardModel<ValueType>, typename StateType = uint32_t>
70 public:
71 struct Options {
75 Options();
76
77 // The order in which to explore the model.
79
80 // If set, deadlocks states will be fixed by adding a self-loop with probability 1.
82
83 // If set, no further states will be explored once the given number is exceeded.
84 std::optional<StateType> explorationStateLimit;
85 };
86
92 ExplicitModelBuilder(std::shared_ptr<storm::generator::NextStateGenerator<ValueType, StateType>> const& generator, Options const& options = Options());
93
101 Options const& builderOptions = Options());
102
110 Options const& builderOptions = Options());
111
119 std::shared_ptr<storm::models::sparse::Model<ValueType, RewardModelType>> build();
120
127
128 private:
138 StateType getOrAddStateIndex(CompressedState const& state);
139
147 void buildMatrices(storm::storage::SparseMatrixBuilder<ValueType>& transitionMatrixBuilder,
148 std::vector<RewardModelBuilder<typename RewardModelType::ValueType>>& rewardModelBuilders,
149 StateAndChoiceInformationBuilder& stateAndChoiceInformationBuilder);
150
157
163 storm::models::sparse::StateLabeling buildStateLabeling();
164
166 std::shared_ptr<storm::generator::NextStateGenerator<ValueType, StateType>> generator;
167
169 Options options;
170
173
175 std::deque<std::pair<CompressedState, StateType>> statesToExplore;
176
179 boost::optional<std::vector<uint_fast64_t>> stateRemapping;
180};
181
182} // namespace builder
183} // namespace storm
184
185#endif /* STORM_BUILDER_EXPLICITMODELBUILDER_H */
ExplicitStateLookup< StateType > exportExplicitStateLookup() const
Export a wrapper that contains (a copy of) the internal information that maps states to ids.
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > build()
Convert the program given at construction time to an abstract model.
StateType lookup(std::map< storm::expressions::Variable, storm::expressions::Expression > const &stateDescription) const
Lookup state.
uint64_t size() const
How many states have been stored?
ExplicitStateLookup(VariableInformation const &varInfo, storm::storage::BitVectorHashMap< StateType > const &stateToId)
A structure that is used to keep track of a reward model currently being built.
This class collects information regarding the states and choices during model building.
This class manages the labeling of the state space with a number of (atomic) labels.
This class represents a hash-map whose keys are bit vectors.
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:18
A class that can be used to build a sparse matrix by adding value by value.
LabParser.cpp.
Definition cli.cpp:18
Options()
Creates an object representing the default building options.