Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::generator::Choice< ValueType, StateType > Struct Template Reference

#include <Choice.h>

Public Member Functions

 Choice (uint_fast64_t actionIndex=0, bool markovian=false)
 Choice (Choice const &other)=default
Choice & operator= (Choice const &other)=default
 Choice (Choice &&other)=default
Choice & operator= (Choice &&other)=default
void add (Choice const &other)
 Adds the given choice to the current one.
void reset (uint_fast64_t actionIndex=0, bool markovian=false)
 Resets this choice to an empty choice with the given action index (i.e., as if it was newly constructed).
StateType sampleFromDistribution (ValueType const &quantile) const
 Given a value q, find the event in the ordered distribution that corresponds to this prob.
storm::storage::Distribution< ValueType, StateType >::iterator begin ()
 Returns an iterator to the distribution associated with this choice.
storm::storage::Distribution< ValueType, StateType >::const_iterator begin () const
 Returns an iterator to the distribution associated with this choice.
storm::storage::Distribution< ValueType, StateType >::iterator end ()
 Returns an iterator past the end of the distribution associated with this choice.
storm::storage::Distribution< ValueType, StateType >::const_iterator end () const
 Returns an iterator past the end of the distribution associated with this choice.
void addLabel (std::string const &label)
 Adds the given label to the labels associated with this choice.
void addLabels (std::set< std::string > const &labels)
 Adds the given label set to the labels associated with this choice.
bool hasLabels () const
 Returns whether there are labels defined for this choice.
std::set< std::string > const & getLabels () const
 Retrieves the set of labels associated with this choice.
void setPlayerIndex (storm::storage::PlayerIndex const &playerIndex)
 Sets the players index.
bool hasPlayerIndex () const
 Returns whether there is an index for the player defined for this choice.
storm::storage::PlayerIndex const & getPlayerIndex () const
 Retrieves the players index associated with this choice.
void addOriginData (boost::any const &data)
 Adds the given data that specifies the origin of this choice w.r.t.
bool hasOriginData () const
 Returns whether there is origin data defined for this choice.
boost::any const & getOriginData () const
 Returns the origin data associated with this choice.
uint_fast64_t getActionIndex () const
 Retrieves the index of the action of this choice.
ValueType getTotalMass () const
 Retrieves the total mass of this choice.
void addProbability (StateType const &state, ValueType const &value)
 Adds the given probability value to the given state in the underlying distribution.
void addReward (ValueType const &value)
 Adds the given value to the reward associated with this choice.
void addRewards (std::vector< ValueType > &&values)
 Adds the given choices rewards to this choice.
std::vector< ValueType > const & getRewards () const
 Retrieves the rewards for this choice under selected reward models.
std::vector< ValueType > & getRewards ()
 Retrieves the rewards for this choice under selected reward models.
bool isMarkovian () const
 Retrieves whether the choice is Markovian.
std::size_t size () const
 Retrieves the size of the distribution associated with this choice.
void reserve (std::size_t const &size)
 If the size is already known, reserves space in the underlying distribution.

Friends

template<typename ValueTypePrime, typename StateTypePrime>
std::ostream & operator<< (std::ostream &out, Choice< ValueTypePrime, StateTypePrime > const &choice)
 Inserts the contents of this object to the given output stream.

Detailed Description

template<typename ValueType, typename StateType = uint32_t>
struct storm::generator::Choice< ValueType, StateType >

Definition at line 18 of file Choice.h.

Constructor & Destructor Documentation

◆ Choice() [1/3]

template<typename ValueType, typename StateType>
storm::generator::Choice< ValueType, StateType >::Choice ( uint_fast64_t actionIndex = 0,
bool markovian = false )

Definition at line 16 of file Choice.cpp.

◆ Choice() [2/3]

template<typename ValueType, typename StateType = uint32_t>
storm::generator::Choice< ValueType, StateType >::Choice ( Choice< ValueType, StateType > const & other)
default

◆ Choice() [3/3]

template<typename ValueType, typename StateType = uint32_t>
storm::generator::Choice< ValueType, StateType >::Choice ( Choice< ValueType, StateType > && other)
default

Member Function Documentation

◆ add()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::add ( Choice< ValueType, StateType > const & other)

Adds the given choice to the current one.

Definition at line 34 of file Choice.cpp.

◆ addLabel()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::addLabel ( std::string const & label)

Adds the given label to the labels associated with this choice.

Parameters
labelThe label to associate with this choice.

Definition at line 87 of file Choice.cpp.

◆ addLabels()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::addLabels ( std::set< std::string > const & labels)

Adds the given label set to the labels associated with this choice.

Parameters
labelSetThe label set to associate with this choice.

Definition at line 95 of file Choice.cpp.

◆ addOriginData()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::addOriginData ( boost::any const & data)

Adds the given data that specifies the origin of this choice w.r.t.

the model specification

Definition at line 129 of file Choice.cpp.

◆ addProbability()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::addProbability ( StateType const & state,
ValueType const & value )

Adds the given probability value to the given state in the underlying distribution.

Definition at line 171 of file Choice.cpp.

◆ addReward()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::addReward ( ValueType const & value)

Adds the given value to the reward associated with this choice.

Definition at line 177 of file Choice.cpp.

◆ addRewards()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::addRewards ( std::vector< ValueType > && values)

Adds the given choices rewards to this choice.

Definition at line 182 of file Choice.cpp.

◆ begin() [1/2]

template<typename ValueType, typename StateType>
storm::storage::Distribution< ValueType, StateType >::iterator storm::generator::Choice< ValueType, StateType >::begin ( )

Returns an iterator to the distribution associated with this choice.

Returns
An iterator to the first element of the distribution.

Definition at line 67 of file Choice.cpp.

◆ begin() [2/2]

template<typename ValueType, typename StateType>
storm::storage::Distribution< ValueType, StateType >::const_iterator storm::generator::Choice< ValueType, StateType >::begin ( ) const

Returns an iterator to the distribution associated with this choice.

Returns
An iterator to the first element of the distribution.

Definition at line 72 of file Choice.cpp.

◆ end() [1/2]

template<typename ValueType, typename StateType>
storm::storage::Distribution< ValueType, StateType >::iterator storm::generator::Choice< ValueType, StateType >::end ( )

Returns an iterator past the end of the distribution associated with this choice.

Returns
An iterator past the end of the distribution.

Definition at line 77 of file Choice.cpp.

◆ end() [2/2]

template<typename ValueType, typename StateType>
storm::storage::Distribution< ValueType, StateType >::const_iterator storm::generator::Choice< ValueType, StateType >::end ( ) const

Returns an iterator past the end of the distribution associated with this choice.

Returns
An iterator past the end of the distribution.

Definition at line 82 of file Choice.cpp.

◆ getActionIndex()

template<typename ValueType, typename StateType>
uint_fast64_t storm::generator::Choice< ValueType, StateType >::getActionIndex ( ) const

Retrieves the index of the action of this choice.

Returns
The index of the action of this choice.

Definition at line 161 of file Choice.cpp.

◆ getLabels()

template<typename ValueType, typename StateType>
std::set< std::string > const & storm::generator::Choice< ValueType, StateType >::getLabels ( ) const

Retrieves the set of labels associated with this choice.

Returns
The set of labels associated with this choice.

Definition at line 109 of file Choice.cpp.

◆ getOriginData()

template<typename ValueType, typename StateType>
boost::any const & storm::generator::Choice< ValueType, StateType >::getOriginData ( ) const

Returns the origin data associated with this choice.

Definition at line 156 of file Choice.cpp.

◆ getPlayerIndex()

template<typename ValueType, typename StateType>
storm::storage::PlayerIndex const & storm::generator::Choice< ValueType, StateType >::getPlayerIndex ( ) const

Retrieves the players index associated with this choice.

Returns
The player index associated with this choice.

Definition at line 124 of file Choice.cpp.

◆ getRewards() [1/2]

template<typename ValueType, typename StateType>
std::vector< ValueType > & storm::generator::Choice< ValueType, StateType >::getRewards ( )

Retrieves the rewards for this choice under selected reward models.

The rewards can be modified in place.

Definition at line 192 of file Choice.cpp.

◆ getRewards() [2/2]

template<typename ValueType, typename StateType>
std::vector< ValueType > const & storm::generator::Choice< ValueType, StateType >::getRewards ( ) const

Retrieves the rewards for this choice under selected reward models.

Definition at line 187 of file Choice.cpp.

◆ getTotalMass()

template<typename ValueType, typename StateType>
ValueType storm::generator::Choice< ValueType, StateType >::getTotalMass ( ) const

Retrieves the total mass of this choice.

Returns
The total mass.

Definition at line 166 of file Choice.cpp.

◆ hasLabels()

template<typename ValueType, typename StateType>
bool storm::generator::Choice< ValueType, StateType >::hasLabels ( ) const

Returns whether there are labels defined for this choice.

Definition at line 104 of file Choice.cpp.

◆ hasOriginData()

template<typename ValueType, typename StateType>
bool storm::generator::Choice< ValueType, StateType >::hasOriginData ( ) const

Returns whether there is origin data defined for this choice.

Definition at line 151 of file Choice.cpp.

◆ hasPlayerIndex()

template<typename ValueType, typename StateType>
bool storm::generator::Choice< ValueType, StateType >::hasPlayerIndex ( ) const

Returns whether there is an index for the player defined for this choice.

Definition at line 119 of file Choice.cpp.

◆ isMarkovian()

template<typename ValueType, typename StateType>
bool storm::generator::Choice< ValueType, StateType >::isMarkovian ( ) const

Retrieves whether the choice is Markovian.

Definition at line 197 of file Choice.cpp.

◆ operator=() [1/2]

template<typename ValueType, typename StateType = uint32_t>
Choice & storm::generator::Choice< ValueType, StateType >::operator= ( Choice< ValueType, StateType > && other)
default

◆ operator=() [2/2]

template<typename ValueType, typename StateType = uint32_t>
Choice & storm::generator::Choice< ValueType, StateType >::operator= ( Choice< ValueType, StateType > const & other)
default

◆ reserve()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::reserve ( std::size_t const & size)

If the size is already known, reserves space in the underlying distribution.

Definition at line 207 of file Choice.cpp.

◆ reset()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::reset ( uint_fast64_t actionIndex = 0,
bool markovian = false )

Resets this choice to an empty choice with the given action index (i.e., as if it was newly constructed).

In contrast to assigning a new Choice, this keeps the allocated memory (e.g., for the distribution and the rewards) for reuse.

Definition at line 22 of file Choice.cpp.

◆ sampleFromDistribution()

template<typename ValueType, typename StateType>
StateType storm::generator::Choice< ValueType, StateType >::sampleFromDistribution ( ValueType const & quantile) const

Given a value q, find the event in the ordered distribution that corresponds to this prob.

Example: Given a (sub)distribution { x -> 0.4, y -> 0.3, z -> 0.2 }, A value q in [0,0.4] yields x, q in [0.4, 0.7] yields y, and q in [0.7, 0.9] yields z. Any other value for q yields undefined behavior.

Parameters
quantileq, a value in the CDF.
Returns
A state

Definition at line 62 of file Choice.cpp.

◆ setPlayerIndex()

template<typename ValueType, typename StateType>
void storm::generator::Choice< ValueType, StateType >::setPlayerIndex ( storm::storage::PlayerIndex const & playerIndex)

Sets the players index.

Parameters
Theplayer index associated with this choice.

Definition at line 114 of file Choice.cpp.

◆ size()

template<typename ValueType, typename StateType>
std::size_t storm::generator::Choice< ValueType, StateType >::size ( ) const

Retrieves the size of the distribution associated with this choice.

Definition at line 202 of file Choice.cpp.

◆ operator<<

template<typename ValueType, typename StateType = uint32_t>
template<typename ValueTypePrime, typename StateTypePrime>
std::ostream & operator<< ( std::ostream & out,
Choice< ValueTypePrime, StateTypePrime > const & choice )
friend

Inserts the contents of this object to the given output stream.

Parameters
outThe stream in which to insert the contents.

The documentation for this struct was generated from the following files: