Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ExplicitModelBuilder.h
Go to the documentation of this file.
1#pragma once
2
3#include <boost/container/flat_map.hpp>
4#include <boost/functional/hash.hpp>
5#include <boost/variant.hpp>
6#include <cstdint>
7#include <deque>
8#include <memory>
9#include <utility>
10#include <vector>
12
22
24
28
29namespace storm {
30
31namespace builder {
32
33using namespace storm::generator;
34
35// Forward-declare classes.
36template<typename ValueType>
39
40template<typename StateType>
42 public:
44 : varInfo(varInfo), stateToId(stateToId) {
45 // intentionally left empty.
46 }
47
53 StateType lookup(std::map<storm::expressions::Variable, storm::expressions::Expression> const& stateDescription) const;
57 uint64_t size() const;
58
59 private:
60 VariableInformation varInfo;
62};
63
64template<typename ValueType, typename RewardModelType = storm::models::sparse::StandardRewardModel<ValueType>, typename StateType = uint32_t>
66 public:
67 struct Options {
71 Options();
72
73 // The order in which to explore the model.
75
76 // If set, deadlocks states will be fixed by adding a self-loop with probability 1.
78
79 // If set, no further states will be explored once the given number is exceeded.
80 std::optional<StateType> explorationStateLimit;
81 };
82
88 ExplicitModelBuilder(std::shared_ptr<storm::generator::NextStateGenerator<ValueType, StateType>> const& generator, Options const& options = Options());
89
97 Options const& builderOptions = Options());
98
106 Options const& builderOptions = Options())
108
116 std::shared_ptr<storm::models::sparse::Model<ValueType, RewardModelType>> build();
117
124
125 private:
135 StateType getOrAddStateIndex(CompressedState const& state);
136
144 void buildMatrices(storm::storage::SparseMatrixBuilder<ValueType>& transitionMatrixBuilder,
145 std::vector<RewardModelBuilder<typename RewardModelType::ValueType>>& rewardModelBuilders,
146 StateAndChoiceInformationBuilder& stateAndChoiceInformationBuilder);
147
154
160 storm::models::sparse::StateLabeling buildStateLabeling();
161
163 std::shared_ptr<storm::generator::NextStateGenerator<ValueType, StateType>> generator;
164
166 Options options;
167
170
172 std::deque<std::pair<CompressedState, StateType>> statesToExplore;
173
176 boost::optional<std::vector<uint_fast64_t>> stateRemapping;
177};
178
179} // namespace builder
180} // namespace storm
ExplicitStateLookup< StateType > exportExplicitStateLookup() const
Export a wrapper that contains (a copy of) the internal information that maps states to ids.
ExplicitModelBuilder(std::shared_ptr< storm::generator::NextStateGenerator< ValueType, StateType > > const &generator, Options const &options=Options())
Creates an explicit model builder that uses the provided generator.
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 class that can be used to build a sparse matrix by adding value by value.
storm::storage::BitVector CompressedState
storm::builder::BuilderOptions NextStateGeneratorOptions
constexpr bool IsIntervalType
Helper to check if a type is an interval.
Options()
Creates an object representing the default building options.