Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
storm::models::sparse::ChoiceLabeling Class Reference

This class manages the labeling of the choice space with a number of (atomic) labels. More...

#include <ChoiceLabeling.h>

Inheritance diagram for storm::models::sparse::ChoiceLabeling:
Collaboration diagram for storm::models::sparse::ChoiceLabeling:

Public Member Functions

 ChoiceLabeling (uint_fast64_t choiceCount=0)
 Constructs an empty labeling for the given number of choices.
 
 ChoiceLabeling (ChoiceLabeling const &other)=default
 
 ChoiceLabeling (ItemLabeling const &other)
 
 ChoiceLabeling (ItemLabeling const &&other)
 
ChoiceLabelingoperator= (ChoiceLabeling const &other)=default
 
virtual bool isChoiceLabeling () const override
 
bool operator== (ChoiceLabeling const &other) const
 Checks whether the two labelings are equal.
 
ChoiceLabeling getSubLabeling (storm::storage::BitVector const &choices) const
 Retrieves the sub labeling that represents the same labeling as the current one for all selected choices.
 
std::set< std::string > getLabelsOfChoice (uint64_t choice) const
 Retrieves the set of labels attached to the given choice.
 
void addLabelToChoice (std::string const &label, uint64_t choice)
 Adds a label to a given choice.
 
bool getChoiceHasLabel (std::string const &label, uint64_t choice) const
 Checks whether a given choice is labeled with the given label.
 
storm::storage::BitVector const & getChoices (std::string const &label) const
 Returns the labeling of choices associated with the given label.
 
void setChoices (std::string const &label, storage::BitVector const &labeling)
 Sets the labeling of choices associated with the given label.
 
void setChoices (std::string const &label, storage::BitVector &&labeling)
 Sets the labeling of choices associated with the given label.
 
- Public Member Functions inherited from storm::models::sparse::ItemLabeling
 ItemLabeling (uint64_t itemCount=0)
 Constructs an empty labeling for the given number of items.
 
 ItemLabeling (ItemLabeling const &other)=default
 
ItemLabelingoperator= (ItemLabeling const &other)=default
 
virtual ~ItemLabeling ()=default
 
virtual bool isStateLabeling () const
 
StateLabeling const & asStateLabeling () const
 
StateLabelingasStateLabeling ()
 
ChoiceLabeling const & asChoiceLabeling () const
 
ChoiceLabelingasChoiceLabeling ()
 
bool operator== (ItemLabeling const &other) const
 Checks whether the two labelings are equal.
 
void addLabel (std::string const &label)
 Adds a new label to the labelings.
 
void removeLabel (std::string const &label)
 Removes a label from the labelings.
 
std::set< std::string > getLabels () const
 Retrieves the set of labels contained in this labeling.
 
void addLabel (std::string const &label, storage::BitVector const &labeling)
 Creates a new label and attaches it to the given items.
 
void addLabel (std::string const &label, storage::BitVector &&labeling)
 Creates a new label and attaches it to the given items.
 
std::string addUniqueLabel (std::string const &prefix, storage::BitVector const &labeling)
 Creates a new label with a unique name, derived from the prefix, and attaches it to the given items.
 
std::string addUniqueLabel (std::string const &prefix, storage::BitVector const &&labeling)
 Creates a new label with a unique name, derived from the prefix, and attaches it to the given items.
 
void join (ItemLabeling const &other)
 Adds all labels from the other labeling to this labeling.
 
bool containsLabel (std::string const &label) const
 Checks whether a label is registered within this labeling.
 
std::size_t getNumberOfLabels () const
 Returns the number of labels managed by this object.
 
std::size_t getNumberOfItems () const
 Returns the number of items managed by this object.
 
void permuteItems (std::vector< uint64_t > const &inversePermutation)
 
virtual std::size_t hash () const
 
void printLabelingInformationToStream (std::ostream &out=std::cout) const
 Prints information about the labeling to the specified stream.
 
void printCompleteLabelingInformationToStream (std::ostream &out=std::cout) const
 Prints the complete labeling to the specified stream.
 

Friends

std::ostream & operator<< (std::ostream &out, ChoiceLabeling const &labeling)
 

Additional Inherited Members

- Protected Member Functions inherited from storm::models::sparse::ItemLabeling
ItemLabeling getSubLabeling (storm::storage::BitVector const &items) const
 Retrieves the sub labeling that represents the same labeling as the current one for all selected items.
 
virtual std::set< std::string > getLabelsOfItem (uint64_t item) const
 Retrieves the set of labels attached to the given item.
 
virtual bool getItemHasLabel (std::string const &label, uint64_t item) const
 Checks whether a given item is labeled with the given label.
 
virtual storm::storage::BitVector const & getItems (std::string const &label) const
 Returns the labeling of items associated with the given label.
 
virtual void setItems (std::string const &label, storage::BitVector const &labeling)
 Sets the labeling of items associated with the given label.
 
virtual void setItems (std::string const &label, storage::BitVector &&labeling)
 Sets the labeling of items associated with the given label.
 
virtual void addLabelToItem (std::string const &label, uint64_t item)
 Adds a label to a given item.
 
virtual void removeLabelFromItem (std::string const &label, uint64_t item)
 Removes a label from a given item.
 
std::string generateUniqueLabel (const std::string &prefix) const
 Generate a unique, previously unused label from the given prefix string.
 
- Protected Attributes inherited from storm::models::sparse::ItemLabeling
uint64_t itemCount
 
std::unordered_map< std::string, uint64_t > nameToLabelingIndexMap
 
std::vector< storm::storage::BitVectorlabelings
 

Detailed Description

This class manages the labeling of the choice space with a number of (atomic) labels.

Definition at line 12 of file ChoiceLabeling.h.

Constructor & Destructor Documentation

◆ ChoiceLabeling() [1/4]

storm::models::sparse::ChoiceLabeling::ChoiceLabeling ( uint_fast64_t  choiceCount = 0)

Constructs an empty labeling for the given number of choices.

Parameters
choiceCountThe number of choices for which this labeling can hold the labels.

Definition at line 9 of file ChoiceLabeling.cpp.

◆ ChoiceLabeling() [2/4]

storm::models::sparse::ChoiceLabeling::ChoiceLabeling ( ChoiceLabeling const &  other)
default

◆ ChoiceLabeling() [3/4]

storm::models::sparse::ChoiceLabeling::ChoiceLabeling ( ItemLabeling const &  other)

Definition at line 13 of file ChoiceLabeling.cpp.

◆ ChoiceLabeling() [4/4]

storm::models::sparse::ChoiceLabeling::ChoiceLabeling ( ItemLabeling const &&  other)

Definition at line 17 of file ChoiceLabeling.cpp.

Member Function Documentation

◆ addLabelToChoice()

void storm::models::sparse::ChoiceLabeling::addLabelToChoice ( std::string const &  label,
uint64_t  choice 
)

Adds a label to a given choice.

Parameters
labelThe name of the label to add.
choiceThe index of the choice to label.

Definition at line 51 of file ChoiceLabeling.cpp.

◆ getChoiceHasLabel()

bool storm::models::sparse::ChoiceLabeling::getChoiceHasLabel ( std::string const &  label,
uint64_t  choice 
) const

Checks whether a given choice is labeled with the given label.

Parameters
labelThe name of the label.
choiceThe index of the choice to check.
Returns
True if the node is labeled with the label, false otherwise.

Definition at line 55 of file ChoiceLabeling.cpp.

◆ getChoices()

storm::storage::BitVector const & storm::models::sparse::ChoiceLabeling::getChoices ( std::string const &  label) const

Returns the labeling of choices associated with the given label.

Parameters
labelThe name of the label.
Returns
A bit vector that represents the labeling of the choices with the given label.

Definition at line 59 of file ChoiceLabeling.cpp.

◆ getLabelsOfChoice()

std::set< std::string > storm::models::sparse::ChoiceLabeling::getLabelsOfChoice ( uint64_t  choice) const

Retrieves the set of labels attached to the given choice.

Parameters
choiceThe choice for which to retrieve the labels.
Returns
The labels attached to the given choice.

Definition at line 47 of file ChoiceLabeling.cpp.

◆ getSubLabeling()

ChoiceLabeling storm::models::sparse::ChoiceLabeling::getSubLabeling ( storm::storage::BitVector const &  choices) const

Retrieves the sub labeling that represents the same labeling as the current one for all selected choices.

Parameters
choicesThe selected set of choices.

Definition at line 43 of file ChoiceLabeling.cpp.

◆ isChoiceLabeling()

bool storm::models::sparse::ChoiceLabeling::isChoiceLabeling ( ) const
overridevirtual

Reimplemented from storm::models::sparse::ItemLabeling.

Definition at line 21 of file ChoiceLabeling.cpp.

◆ operator=()

ChoiceLabeling & storm::models::sparse::ChoiceLabeling::operator= ( ChoiceLabeling const &  other)
default

◆ operator==()

bool storm::models::sparse::ChoiceLabeling::operator== ( ChoiceLabeling const &  other) const

Checks whether the two labelings are equal.

Parameters
otherThe labeling with which the current one is compared.
Returns
True iff the labelings are equal.

Definition at line 25 of file ChoiceLabeling.cpp.

◆ setChoices() [1/2]

void storm::models::sparse::ChoiceLabeling::setChoices ( std::string const &  label,
storage::BitVector &&  labeling 
)

Sets the labeling of choices associated with the given label.

Parameters
labelThe name of the label.
labelingA bit vector that represents the set of choices that will get this label.

Definition at line 67 of file ChoiceLabeling.cpp.

◆ setChoices() [2/2]

void storm::models::sparse::ChoiceLabeling::setChoices ( std::string const &  label,
storage::BitVector const &  labeling 
)

Sets the labeling of choices associated with the given label.

Parameters
labelThe name of the label.
labelingA bit vector that represents the set of choices that will get this label.

Definition at line 63 of file ChoiceLabeling.cpp.

Friends And Related Symbol Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
ChoiceLabeling const &  labeling 
)
friend

Definition at line 71 of file ChoiceLabeling.cpp.


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