Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ExplicitGspnModelBuilder.h
Go to the documentation of this file.
1// #ifndef STORM_BUILDER_EXPLICITGSPNMODELBUILDER_H_
2// #define STORM_BUILDER_EXPLICITGSPNMODELBUILDER_H_
3//
4// #include <string>
5//
6// #include "storm/models/sparse/MarkovAutomaton.h"
7// #include "storm/models/sparse/StandardRewardModel.h"
8// #include "storm/storage/BitVector.h"
9// #include "storm/storage/BitVectorHashMap.h"
10// #include "storm/storage/gspn/GSPN.h"
11// #include "storm/storage/gspn/ImmediateTransition.h"
12// #include "storm/storage/gspn/TimedTransition.h"
13//
14// namespace storm {
15// namespace builder {
16//
17// /*!
18// * This class provides the facilities for building an markov automaton.
19// */
20// template<typename ValueType=double>
21// class ExplicitGspnModelBuilder {
22// public:
23//
24// /*!
25// * Builds an MarkovAutomaton from the given GSPN.
26// *
27// * @param gspn The gspn whose semantic is covered by the MarkovAutomaton
28// * @return The resulting MarkovAutomaton
29// */
30// storm::models::sparse::MarkovAutomaton<ValueType> translateGspn(storm::gspn::GSPN const& gspn, std::string const& formula);
31// private:
32//
33// /*!
34// * Add for each partition a new row in the probability matrix.
35// *
36// * @param partitions The partitioned immediate transitions.
37// * @param currentMarking The current marking which is considered at the moment.
38// */
39// void addRowForPartitions(std::vector<std::vector<std::shared_ptr<storm::gspn::ImmediateTransition<double>>>> const& partitions,
40// storm::gspn::Marking const& currentMarking);
41//
42//
43// /*!
44// * Add row for a markovian state.
45// *
46// * @param enabledTimedTransitions List of enabled timed transitions.
47// * @param currentMarking The current marking which is considered at the moment.
48// * @param accRate The sum of all rates of the enabled timed transisitons
49// */
50// void addRowForTimedTransitions(std::vector<std::shared_ptr<storm::gspn::TimedTransition<double>>> const& enabledTimedTransitions,
51// storm::gspn::Marking const& currentMarking, double const& accRate);
52//
53// /*!
54// * Struct for comparing unsigned integer for maps
55// */
56// struct cmpByIndex {
57// bool operator()(const uint_fast64_t &a, const uint_fast64_t &b) const {
58// return a < b;
59// }
60// };
61//
62// /*!
63// * This method insert the values from a map into the matrix
64// *
65// * @param values The values which are inserted
66// */
67// void addValuesToBuilder(std::map<uint_fast64_t , double, storm::builder::ExplicitGspnModelBuilder<ValueType>::cmpByIndex> const& values);
68//
69//
70// /*!
71// * This method partitions all enabled immediate transitions w.r.t. a marking.
72// * All enabled weighted immediate transitions are in one vector. Between these transitions
73// * is chosen probabilistically by the weights.
74// *
75// * All other enabled non-weighted immediate transitions are in an singleton vector.
76// * Between different vectors is chosen non-deterministically.
77// *
78// * @param marking The current marking which is considered.
79// * @param enabledImmediateTransistions A vector of enabled immediate transitions.
80// * @return The vector of vectors which is described above.
81// */
82// std::vector<std::vector<std::shared_ptr<storm::gspn::ImmediateTransition<double>>>> partitonEnabledImmediateTransitions(storm::gspn::Marking
83// const& marking, std::vector<std::shared_ptr<storm::gspn::ImmediateTransition<double>>> const& enabledImmediateTransitions);
84//
85// /*!
86// * Computes the accumulated weight of immediate transisions which are stored in a list.
87// *
88// * @param vector List of immediate transisitions.
89// */
90// double getAccumulatedWeight(std::vector<std::shared_ptr<storm::gspn::ImmediateTransition<double>>> const& vector) const;
91//
92// /*!
93// * Compute the upper bound for the number of tokens in each place.
94// * Also computes the number of bits which are used to store a marking.
95// *
96// * @param gspn The corresponding gspn.
97// */
98// void computeCapacities(storm::gspn::GSPN const& gspn);
99//
100// /*!
101// * Returns the vector of enabled timed transition with the highest priority.
102// *
103// *
104// * @param marking The current marking which is considered.
105// * @return The vector of enabled timed transitions.
106// */
107// std::vector<std::shared_ptr<storm::gspn::TimedTransition<double>>> getEnabledTimedTransition(
108// storm::gspn::Marking const& marking);
109//
110// /*!
111// * Returns the vector of active immediate transition with the highest priority.
112// *
113// * @param marking The current marking which is considered.
114// * @return The vector of enabled immediate transitions.
115// */
116// std::vector<std::shared_ptr<storm::gspn::ImmediateTransition<double>>> getEnabledImmediateTransition(
117// storm::gspn::Marking const& marking);
118//
119// /*!
120// * Computes the accumulated rate of a vector of timed transitions.
121// *
122// * @param vector The vector of timed transitions.
123// * @return The accumulated rate.
124// */
125// double getAccumulatedRate(std::vector<std::shared_ptr<storm::gspn::TimedTransition<double>>> const& vector);
126//
127// // is only needed for debugging purposes
128// // since markings is injective, we can determine the bitvector
129// storm::storage::BitVector getBitvector(uint_fast64_t const& index);
130//
131// /*!
132// * Adds the bitvector to the marking-map.
133// * If the bitvector corresponds to a new marking the bitvector is added to the todo list.
134// *
135// * @return The rowGroup index for the bitvector.
136// */
137// uint_fast64_t findOrAddBitvectorToMarkings(storm::storage::BitVector const& bitvector);
138//
139// /*!
140// * Computes the state labeling and returns it.
141// * Every state is labeled with its name.
142// *
143// * @return The computed state labeling.
144// */
145// storm::models::sparse::StateLabeling getStateLabeling() const;
146//
147//
148// // contains the number of bits which are used the store the number of tokens at each place
149// std::map<uint_fast64_t, uint_fast64_t> numberOfBits;
150//
151// // contains the number of bits used to create markings
152// uint_fast64_t numberOfTotalBits;
153//
154// // maps bitvectors (markings w.r.t. the capacity) to their rowgroup
155// storm::storage::BitVectorHashMap<uint_fast64_t> markings = storm::storage::BitVectorHashMap<uint_fast64_t>(64, 1);
156//
157// // a list of markings for which the outgoing edges need to be computed
158// std::deque<std::shared_ptr<storm::storage::BitVector>> todo;
159//
160// //the gspn which is transformed
161// storm::gspn::GSPN gspn;
162//
163// // the next index for a new rowgroup
164// uint_fast64_t nextRowGroupIndex = 0;
165//
166// // builder object which is used to create the probability matrix
167// storm::storage::SparseMatrixBuilder<double> builder;
168//
169// // contains the current row index during the computation
170// uint_fast64_t currentRowIndex;
171// };
172// }
173// }
174//
175// #endif //STORM_BUILDER_EXPLICITGSPNMODELBUILDER_H_