Storm
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ChoiceLabeling.cpp
Go to the documentation of this file.
2
5
6namespace storm {
7namespace models {
8namespace sparse {
9ChoiceLabeling::ChoiceLabeling(uint_fast64_t choiceCount) : ItemLabeling(choiceCount) {
10 // Intentionally left empty.
11}
12
14 // Intentionally left empty.
15}
16
18 // Intentionally left empty.
19}
20
22 return true;
23}
24
26 if (itemCount != other.itemCount) {
27 return false;
28 }
29 if (this->getNumberOfLabels() != other.getNumberOfLabels()) {
30 return false;
31 }
32 for (auto const& labelIndexPair : this->nameToLabelingIndexMap) {
33 if (!other.containsLabel(labelIndexPair.first)) {
34 return false;
35 }
36 if (labelings[labelIndexPair.second] != other.getChoices(labelIndexPair.first)) {
37 return false;
38 }
39 }
40 return true;
41}
42
46
47std::set<std::string> ChoiceLabeling::getLabelsOfChoice(uint64_t choice) const {
48 return this->getLabelsOfItem(choice);
49}
50
51void ChoiceLabeling::addLabelToChoice(std::string const& label, uint64_t choice) {
52 return ItemLabeling::addLabelToItem(label, choice);
53}
54
55bool ChoiceLabeling::getChoiceHasLabel(std::string const& label, uint64_t choice) const {
56 return this->getItemHasLabel(label, choice);
57}
58
59storm::storage::BitVector const& ChoiceLabeling::getChoices(std::string const& label) const {
60 return this->getItems(label);
61}
62
63void ChoiceLabeling::setChoices(std::string const& label, storage::BitVector const& labeling) {
64 this->setItems(label, labeling);
65}
66
67void ChoiceLabeling::setChoices(std::string const& label, storage::BitVector&& labeling) {
68 this->setItems(label, labeling);
69}
70
71std::ostream& operator<<(std::ostream& out, ChoiceLabeling const& labeling) {
72 out << "Choice ";
74 return out;
75}
76
77} // namespace sparse
78} // namespace models
79} // namespace storm
This class manages the labeling of the choice space with a number of (atomic) labels.
virtual bool isChoiceLabeling() const override
storm::storage::BitVector const & getChoices(std::string const &label) const
Returns the labeling of choices associated with the given label.
bool getChoiceHasLabel(std::string const &label, uint64_t choice) const
Checks whether a given choice is labeled with the given label.
ChoiceLabeling(uint_fast64_t choiceCount=0)
Constructs an empty labeling for the given number of choices.
void addLabelToChoice(std::string const &label, uint64_t choice)
Adds a label to a given choice.
ChoiceLabeling getSubLabeling(storm::storage::BitVector const &choices) const
Retrieves the sub labeling that represents the same labeling as the current one for all selected choi...
void setChoices(std::string const &label, storage::BitVector const &labeling)
Sets the labeling of choices associated with the given label.
std::set< std::string > getLabelsOfChoice(uint64_t choice) const
Retrieves the set of labels attached to the given choice.
bool operator==(ChoiceLabeling const &other) const
Checks whether the two labelings are equal.
A base class managing the labeling of items with a number of (atomic) labels.
virtual std::set< std::string > getLabelsOfItem(uint64_t item) const
Retrieves the set of labels attached to the given item.
virtual void setItems(std::string const &label, storage::BitVector const &labeling)
Sets the labeling of items associated with the given label.
virtual bool getItemHasLabel(std::string const &label, uint64_t item) const
Checks whether a given item is labeled with the given label.
ItemLabeling getSubLabeling(storm::storage::BitVector const &items) const
Retrieves the sub labeling that represents the same labeling as the current one for all selected item...
bool containsLabel(std::string const &label) const
Checks whether a label is registered within this labeling.
std::unordered_map< std::string, uint64_t > nameToLabelingIndexMap
virtual storm::storage::BitVector const & getItems(std::string const &label) const
Returns 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.
void printLabelingInformationToStream(std::ostream &out=std::cout) const
Prints information about the labeling to the specified stream.
std::vector< storm::storage::BitVector > labelings
std::size_t getNumberOfLabels() const
Returns the number of labels managed by this object.
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:18
std::ostream & operator<<(std::ostream &out, ChoiceLabeling const &labeling)
LabParser.cpp.
Definition cli.cpp:18