18#ifndef MCRL2_LTS_PROBABILISTIC_STATE_H
19#define MCRL2_LTS_PROBABILISTIC_STATE_H
47template <
class STATE,
class PROBABILITY >
52 friend std::hash<probabilistic_state>;
57 typedef typename std::vector<state_probability_pair>::iterator
iterator;
58 typedef typename std::vector<state_probability_pair>::const_iterator
const_iterator;
59 typedef typename std::vector<state_probability_pair>::reverse_iterator
reverse_iterator;
108 template <
class STATE_PROBABILITY_PAIR_ITERATOR>
214 void add(
const STATE& s,
const PROBABILITY& p)
229 PROBABILITY sum=PROBABILITY::zero();
232 assert(p.probability()>PROBABILITY::zero());
233 assert(p.probability()<=PROBABILITY::one());
234 sum=sum+p.probability();
322template <
class STATE,
class PROBABILITY >
325 std::stringstream str;
328 str <<
"[ " << l.
get() <<
": 1.0 ]";
344 str << p.state() <<
": " << p.probability();
354template <
class STATE,
class PROBABILITY >
373template <
class STATE,
class PROBABILITY >
374struct hash<
mcrl2::lts::probabilistic_state<STATE, PROBABILITY> >
381 hash<STATE> state_hasher;
382 hash<PROBABILITY> probability_hasher;
385 probability_hasher(PROBABILITY::one())));
387 hash<vector<typename mcrl2::lps::state_probability_pair< STATE, PROBABILITY > > > hasher;
A class that contains a probabilistic state.
void set(const STATE &s)
Set this probabilistic state to a single state with probability one.
const_iterator begin() const
Gets an iterator over pairs of state and probability. This can only be used when the state is stored ...
void construct_internal_vector_representation()
Guarantee that this probabilistic state is internally stored as a vector, such that begin/end,...
probabilistic_state & operator=(const probabilistic_state &other)
Copy assignment constructor.
const_reverse_iterator rbegin() const
Gets a reverse iterator over pairs of state and probability. This can only be used when the state is ...
std::size_t size() const
Gets the number of probabilistic states in the vector representation of this state....
bool operator!=(const probabilistic_state &other) const
Standard equality operator.
iterator begin()
Gets an iterator over pairs of state and probability. This can only be used if the state is internall...
std::vector< state_probability_pair >::const_iterator const_iterator
lps::state_probability_pair< STATE, PROBABILITY > state_probability_pair
STATE get() const
Get a probabilistic state if is is simple, i.e., consists of a single state.
iterator end()
Gets the end iterator over pairs of state and probability.
PROBABILITY probability_t
reverse_iterator rbegin()
Gets a reverse iterator over pairs of state and probability. This can only be used if the state is in...
std::vector< state_probability_pair > m_probabilistic_state
const_iterator end() const
Gets the end iterator over pairs of state and probability.
std::vector< state_probability_pair >::iterator iterator
void swap(probabilistic_state &other)
Swap this probabilistic state.
reverse_iterator rend()
Gets the reverse end iterator over pairs of state and probability.
std::vector< state_probability_pair >::const_reverse_iterator const_reverse_iterator
bool operator==(const probabilistic_state &other) const
Standard equality operator.
void clear()
Makes the probabilistic state empty.
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.
std::vector< state_probability_pair >::reverse_iterator reverse_iterator
probabilistic_state(const probabilistic_state &other)
Copy constructor.
void shrink_to_fit()
If a probabilistic state is ready, shrinking it to minimal size might be useful to reduce its memory ...
probabilistic_state()
Default constructor.
probabilistic_state(const STATE &s)
Constructor of a probabilistic state from a non probabilistic state.
void add(const STATE &s, const PROBABILITY &p)
Add a state with a probability to the probabilistic state.
const_reverse_iterator rend() const
Gets the reverse end iterator over pairs of state and probability.
Standard exception class for reporting runtime errors.
Exception classes for use in libraries and tools.
std::string pp(const abstraction &x)
std::ostream & operator<<(std::ostream &out, const abstraction &x)
std::size_t hash_combine(const std::size_t h1, const std::size_t h2)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
void swap(atermpp::unprotected_aterm_core &t1, atermpp::unprotected_aterm_core &t2) noexcept
Swaps two aterms.
This file contains a class with a state/probability pair.
std::size_t operator()(const mcrl2::lts::probabilistic_state< STATE, PROBABILITY > &p) const