Storm
A Modern Probabilistic Model Checker
|
A base class managing the labeling of items with a number of (atomic) labels. More...
#include <ItemLabeling.h>
Public Member Functions | |
ItemLabeling (uint64_t itemCount=0) | |
Constructs an empty labeling for the given number of items. | |
ItemLabeling (ItemLabeling const &other)=default | |
ItemLabeling & | operator= (ItemLabeling const &other)=default |
virtual | ~ItemLabeling ()=default |
virtual bool | isStateLabeling () const |
virtual bool | isChoiceLabeling () const |
StateLabeling const & | asStateLabeling () const |
StateLabeling & | asStateLabeling () |
ChoiceLabeling const & | asChoiceLabeling () const |
ChoiceLabeling & | asChoiceLabeling () |
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. | |
Protected Member Functions | |
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 | |
uint64_t | itemCount |
std::unordered_map< std::string, uint64_t > | nameToLabelingIndexMap |
std::vector< storm::storage::BitVector > | labelings |
Friends | |
std::ostream & | operator<< (std::ostream &out, ItemLabeling const &labeling) |
A base class managing the labeling of items with a number of (atomic) labels.
Definition at line 21 of file ItemLabeling.h.
|
explicit |
Constructs an empty labeling for the given number of items.
itemCount | The number of items for which this labeling can hold the labels. |
|
default |
|
virtualdefault |
void storm::models::sparse::ItemLabeling::addLabel | ( | std::string const & | label | ) |
Adds a new label to the labelings.
Initially, no item is labeled with this label.
label | The name of the new label. |
Definition at line 63 of file ItemLabeling.cpp.
void storm::models::sparse::ItemLabeling::addLabel | ( | std::string const & | label, |
storage::BitVector && | labeling | ||
) |
Creates a new label and attaches it to the given items.
Note that the dimension of given labeling must match the number of items for which this item labeling is valid.
label | The new label. |
labeling | A bit vector that indicates whether or not the new label is attached to a item. |
Definition at line 134 of file ItemLabeling.cpp.
void storm::models::sparse::ItemLabeling::addLabel | ( | std::string const & | label, |
storage::BitVector const & | labeling | ||
) |
Creates a new label and attaches it to the given items.
Note that the dimension of given labeling must match the number of items for which this item labeling is valid.
label | The new label. |
labeling | A bit vector that indicates whether or not the new label is attached to a item. |
Definition at line 126 of file ItemLabeling.cpp.
|
protectedvirtual |
Adds a label to a given item.
label | The name of the label to add. |
item | The index of the item to label. |
Definition at line 158 of file ItemLabeling.cpp.
std::string storm::models::sparse::ItemLabeling::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.
Note that the dimension of given labeling must match the number of items for which this item labeling is valid.
prefix | A prefix to use for the new label. |
labeling | A bit vector that indicates whether or not the new label is attached to a item. |
Definition at line 148 of file ItemLabeling.cpp.
std::string storm::models::sparse::ItemLabeling::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.
Note that the dimension of given labeling must match the number of items for which this item labeling is valid.
prefix | A prefix to use for the new label. |
labeling | A bit vector that indicates whether or not the new label is attached to a item. |
Definition at line 142 of file ItemLabeling.cpp.
ChoiceLabeling & storm::models::sparse::ItemLabeling::asChoiceLabeling | ( | ) |
Definition at line 33 of file ItemLabeling.cpp.
ChoiceLabeling const & storm::models::sparse::ItemLabeling::asChoiceLabeling | ( | ) | const |
Definition at line 30 of file ItemLabeling.cpp.
StateLabeling & storm::models::sparse::ItemLabeling::asStateLabeling | ( | ) |
Definition at line 27 of file ItemLabeling.cpp.
StateLabeling const & storm::models::sparse::ItemLabeling::asStateLabeling | ( | ) | const |
Definition at line 24 of file ItemLabeling.cpp.
bool storm::models::sparse::ItemLabeling::containsLabel | ( | std::string const & | label | ) | const |
Checks whether a label is registered within this labeling.
Definition at line 154 of file ItemLabeling.cpp.
|
protected |
Generate a unique, previously unused label from the given prefix string.
Definition at line 232 of file ItemLabeling.cpp.
|
protectedvirtual |
Checks whether a given item is labeled with the given label.
label | The name of the label. |
item | The index of the item to check. |
Definition at line 171 of file ItemLabeling.cpp.
|
protectedvirtual |
Returns the labeling of items associated with the given label.
label | The name of the label. |
Definition at line 185 of file ItemLabeling.cpp.
std::set< std::string > storm::models::sparse::ItemLabeling::getLabels | ( | ) | const |
Retrieves the set of labels contained in this labeling.
Definition at line 98 of file ItemLabeling.cpp.
|
protectedvirtual |
Retrieves the set of labels attached to the given item.
item | The item for which to retrieve the labels. |
Definition at line 106 of file ItemLabeling.cpp.
std::size_t storm::models::sparse::ItemLabeling::getNumberOfItems | ( | ) | const |
Returns the number of items managed by this object.
Definition at line 181 of file ItemLabeling.cpp.
std::size_t storm::models::sparse::ItemLabeling::getNumberOfLabels | ( | ) | const |
Returns the number of labels managed by this object.
Definition at line 177 of file ItemLabeling.cpp.
|
protected |
Retrieves the sub labeling that represents the same labeling as the current one for all selected items.
items | The selected set of items. |
Definition at line 55 of file ItemLabeling.cpp.
|
virtual |
Definition at line 223 of file ItemLabeling.cpp.
|
virtual |
Reimplemented in storm::models::sparse::ChoiceLabeling.
Definition at line 20 of file ItemLabeling.cpp.
|
virtual |
Reimplemented in storm::models::sparse::StateLabeling.
Definition at line 17 of file ItemLabeling.cpp.
void storm::models::sparse::ItemLabeling::join | ( | ItemLabeling const & | other | ) |
Adds all labels from the other labeling to this labeling.
It is assumed that both labelings have the same itemcount. If a label is present in both labellings, we take the union of the corresponding item sets.
Definition at line 86 of file ItemLabeling.cpp.
|
default |
bool storm::models::sparse::ItemLabeling::operator== | ( | ItemLabeling const & | other | ) | const |
Checks whether the two labelings are equal.
other | The labeling with which the current one is compared. |
Definition at line 37 of file ItemLabeling.cpp.
void storm::models::sparse::ItemLabeling::permuteItems | ( | std::vector< uint64_t > const & | inversePermutation | ) |
Definition at line 116 of file ItemLabeling.cpp.
void storm::models::sparse::ItemLabeling::printCompleteLabelingInformationToStream | ( | std::ostream & | out = std::cout | ) | const |
Prints the complete labeling to the specified stream.
out | The stream the information is to be printed to. |
Definition at line 212 of file ItemLabeling.cpp.
void storm::models::sparse::ItemLabeling::printLabelingInformationToStream | ( | std::ostream & | out = std::cout | ) | const |
Prints information about the labeling to the specified stream.
out | The stream the information is to be printed to. |
Definition at line 205 of file ItemLabeling.cpp.
void storm::models::sparse::ItemLabeling::removeLabel | ( | std::string const & | label | ) |
Removes a label from the labelings.
label | The name of the label to remove. |
Definition at line 67 of file ItemLabeling.cpp.
|
protectedvirtual |
Removes a label from a given item.
label | The name of the label to remove. |
item | The index of the item. |
Definition at line 164 of file ItemLabeling.cpp.
|
protectedvirtual |
Sets the labeling of items associated with the given label.
label | The name of the label. |
labeling | A bit vector that represents the set of items that will get this label. |
Definition at line 198 of file ItemLabeling.cpp.
|
protectedvirtual |
Sets the labeling of items associated with the given label.
label | The name of the label. |
labeling | A bit vector that represents the set of items that will get this label. |
Definition at line 191 of file ItemLabeling.cpp.
|
friend |
Definition at line 227 of file ItemLabeling.cpp.
|
protected |
Definition at line 226 of file ItemLabeling.h.
|
protected |
Definition at line 232 of file ItemLabeling.h.
|
protected |
Definition at line 229 of file ItemLabeling.h.