|
mCRL2
|
A class that contains a probabilistic state. More...
#include <probabilistic_state.h>
Public Types | |
| using | state_probability_pair = typename lps::state_probability_pair< STATE, PROBABILITY > |
| using | state_t = STATE |
| using | probability_t = PROBABILITY |
| using | iterator = typename std::vector< state_probability_pair >::iterator |
| using | const_iterator = typename std::vector< state_probability_pair >::const_iterator |
| using | reverse_iterator = typename std::vector< state_probability_pair >::reverse_iterator |
| using | const_reverse_iterator = typename std::vector< state_probability_pair >::const_reverse_iterator |
Public Member Functions | |
| probabilistic_state () | |
| Default constructor. | |
| probabilistic_state (const STATE &s) | |
| Constructor of a probabilistic state from a non probabilistic state. | |
| probabilistic_state (const probabilistic_state &other) | |
| Copy constructor. | |
| probabilistic_state & | operator= (const probabilistic_state &other) |
| Copy assignment constructor. | |
| probabilistic_state (probabilistic_state &&other)=default | |
| Move constructor. | |
| probabilistic_state & | operator= (probabilistic_state &&other)=default |
| Move assignment operator. | |
| template<class STATE_PROBABILITY_PAIR_ITERATOR > | |
| probabilistic_state (const STATE_PROBABILITY_PAIR_ITERATOR begin, const STATE_PROBABILITY_PAIR_ITERATOR end) | |
| Creates a probabilistic state on the basis of state_probability_pairs. | |
| bool | operator== (const probabilistic_state &other) const |
| Standard equality operator. | |
| bool | operator!= (const probabilistic_state &other) const |
| Standard equality operator. | |
| void | swap (probabilistic_state &other) noexcept |
| Swap this probabilistic state. | |
| void | construct_internal_vector_representation () |
| Guarantee that this probabilistic state is internally stored as a vector, such that begin/end, cbegin/cend and size are properly defined. | |
| void | set (const STATE &s) |
| Set this probabilistic state to a single state with probability one. | |
| STATE | get () const |
| Get a probabilistic state if is is simple, i.e., consists of a single state. | |
| void | add (const STATE &s, const PROBABILITY &p) |
| Add a state with a probability to the probabilistic state. | |
| void | shrink_to_fit () |
| If a probabilistic state is ready, shrinking it to minimal size might be useful to reduce its memory usage. A requirement is that the sum of the probabilities must be one. | |
| std::size_t | size () const |
| Gets the number of probabilistic states in the vector representation of this state. If the state is stored as a simple number this size returns 0. So, 0 means that there is one state, which should then be obtained using get(). If the size is larger than 0 the state is stored in a vector, and it must be accessed throught the iterators begin() and n. | |
| void | clear () |
| Makes the probabilistic state empty. | |
| STATE | maximal_state () const |
| Provides the maximal state index in a probabilistic state. | |
| const_iterator | begin () const |
| Gets an iterator over pairs of state and probability. This can only be used when the state is stored internally as a vector. | |
| const_iterator | end () const |
| Gets the end iterator over pairs of state and probability. | |
| iterator | begin () |
| Gets an iterator over pairs of state and probability. This can only be used if the state is internally stored as a vector. | |
| iterator | end () |
| Gets the end iterator over pairs of state and probability. | |
| const_reverse_iterator | rbegin () const |
| Gets a reverse iterator over pairs of state and probability. This can only be used when the state is stored internally as a vector. | |
| const_reverse_iterator | rend () const |
| Gets the reverse end iterator over pairs of state and probability. | |
| reverse_iterator | rbegin () |
| Gets a reverse iterator over pairs of state and probability. This can only be used if the state is internally stored as a vector. | |
| reverse_iterator | rend () |
| Gets the reverse end iterator over pairs of state and probability. | |
Protected Attributes | |
| STATE | m_single_state |
| std::vector< state_probability_pair > | m_probabilistic_state |
A class that contains a probabilistic state.
A probabilistic state is essentially a sequence of pairs of a state and a probability. The probability indicates the likelyhood with which that particular state can be reached. The sum of all probabilities in a probabilistic state is one. Internally, it is either stored as single state, or as a vector of states. When using a probabilistic state, a user should be aware which of the two internal representations are used. After calling "construct_internal_vector_representation" it is guaranteed that the state is stored as a vector, and iterators over begin/end, and cbegin/cend can be used.
Definition at line 45 of file probabilistic_state.h.
| using mcrl2::lts::probabilistic_state< STATE, PROBABILITY >::const_iterator = typename std::vector<state_probability_pair>::const_iterator |
Definition at line 55 of file probabilistic_state.h.
| using mcrl2::lts::probabilistic_state< STATE, PROBABILITY >::const_reverse_iterator = typename std::vector<state_probability_pair>::const_reverse_iterator |
Definition at line 57 of file probabilistic_state.h.
| using mcrl2::lts::probabilistic_state< STATE, PROBABILITY >::iterator = typename std::vector<state_probability_pair>::iterator |
Definition at line 54 of file probabilistic_state.h.
| using mcrl2::lts::probabilistic_state< STATE, PROBABILITY >::probability_t = PROBABILITY |
Definition at line 53 of file probabilistic_state.h.
| using mcrl2::lts::probabilistic_state< STATE, PROBABILITY >::reverse_iterator = typename std::vector<state_probability_pair>::reverse_iterator |
Definition at line 56 of file probabilistic_state.h.
| using mcrl2::lts::probabilistic_state< STATE, PROBABILITY >::state_probability_pair = typename lps::state_probability_pair<STATE, PROBABILITY> |
Definition at line 51 of file probabilistic_state.h.
| using mcrl2::lts::probabilistic_state< STATE, PROBABILITY >::state_t = STATE |
Definition at line 52 of file probabilistic_state.h.
|
inline |
Default constructor.
Definition at line 70 of file probabilistic_state.h.
|
inlineexplicit |
Constructor of a probabilistic state from a non probabilistic state.
| [in] | s | A state. |
Definition at line 78 of file probabilistic_state.h.
|
inline |
Copy constructor.
Definition at line 84 of file probabilistic_state.h.
|
default |
Move constructor.
|
inline |
Creates a probabilistic state on the basis of state_probability_pairs.
| [in] | begin | Iterator to the first state_probability_pair. |
| [in] | end | Iterator to the last state_probability_pair. |
Definition at line 110 of file probabilistic_state.h.
|
inline |
Add a state with a probability to the probabilistic state.
| [in] | s | The state to be added. |
| [in] | p | The probability of this state. |
Definition at line 214 of file probabilistic_state.h.
|
inline |
Gets an iterator over pairs of state and probability. This can only be used if the state is internally stored as a vector.
Definition at line 299 of file probabilistic_state.h.
|
inline |
Gets an iterator over pairs of state and probability. This can only be used when the state is stored internally as a vector.
Definition at line 285 of file probabilistic_state.h.
|
inline |
Makes the probabilistic state empty.
Definition at line 254 of file probabilistic_state.h.
|
inline |
Guarantee that this probabilistic state is internally stored as a vector, such that begin/end, cbegin/cend and size are properly defined.
Definition at line 172 of file probabilistic_state.h.
|
inline |
Gets the end iterator over pairs of state and probability.
Definition at line 306 of file probabilistic_state.h.
|
inline |
Gets the end iterator over pairs of state and probability.
Definition at line 292 of file probabilistic_state.h.
|
inline |
Get a probabilistic state if is is simple, i.e., consists of a single state.
It is assumed that the given state probability pair does not have any element.
Definition at line 195 of file probabilistic_state.h.
|
inline |
Provides the maximal state index in a probabilistic state.
Definition at line 262 of file probabilistic_state.h.
|
inline |
Standard equality operator.
Definition at line 156 of file probabilistic_state.h.
|
inline |
Copy assignment constructor.
Definition at line 92 of file probabilistic_state.h.
|
default |
Move assignment operator.
|
inline |
Standard equality operator.
Definition at line 121 of file probabilistic_state.h.
|
inline |
Gets a reverse iterator over pairs of state and probability. This can only be used if the state is internally stored as a vector.
Definition at line 328 of file probabilistic_state.h.
|
inline |
Gets a reverse iterator over pairs of state and probability. This can only be used when the state is stored internally as a vector.
Definition at line 314 of file probabilistic_state.h.
|
inline |
Gets the reverse end iterator over pairs of state and probability.
Definition at line 335 of file probabilistic_state.h.
|
inline |
Gets the reverse end iterator over pairs of state and probability.
Definition at line 321 of file probabilistic_state.h.
|
inline |
Set this probabilistic state to a single state with probability one.
It is assumed that the given state probability pair does not have any element.
| [in] | s | The state. |
Definition at line 186 of file probabilistic_state.h.
|
inline |
If a probabilistic state is ready, shrinking it to minimal size might be useful to reduce its memory usage. A requirement is that the sum of the probabilities must be one.
Definition at line 223 of file probabilistic_state.h.
|
inline |
Gets the number of probabilistic states in the vector representation of this state. If the state is stored as a simple number this size returns 0. So, 0 means that there is one state, which should then be obtained using get(). If the size is larger than 0 the state is stored in a vector, and it must be accessed throught the iterators begin() and n.
Definition at line 247 of file probabilistic_state.h.
|
inlinenoexcept |
Swap this probabilistic state.
| [in] | other | A probabilistic state. |
Definition at line 163 of file probabilistic_state.h.
|
protected |
Definition at line 63 of file probabilistic_state.h.
|
protected |
Definition at line 61 of file probabilistic_state.h.