Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ChoiceOrigins.h
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4#include <vector>
7
10
11namespace storm {
12namespace storage {
13namespace sparse {
14
17
23 public:
25
26 virtual ~ChoiceOrigins() = default;
27
28 virtual bool isPrismChoiceOrigins() const;
29 virtual bool isJaniChoiceOrigins() const;
30
33
36
37 /*
38 * Returns a unique identifier of the origin of the given choice which can be used to e.g. check whether two choices have the same origin
39 */
40 uint_fast64_t getIdentifier(uint_fast64_t choiceIndex) const;
41
45 std::vector<uint_fast64_t> const& getIdentifiers() const;
46
47 /*
48 * Returns the number of considered identifier.
49 * This can be used to, e.g., loop over all identifiers.
50 */
51 virtual uint_fast64_t getNumberOfIdentifiers() const = 0;
52
53 /*
54 * Returns the number of considered choice indices.
55 */
56 uint_fast64_t getNumberOfChoices() const;
57
58 /*
59 * Returns the identifier that is used for choices without an origin in the input specification
60 * E.g., Selfloops introduced on deadlock states
61 */
62 static uint_fast64_t getIdentifierForChoicesWithNoOrigin();
63
64 /*
65 * Returns the information for the given choice origin identifier as a (human readable) string
66 */
67 std::string const& getIdentifierInfo(uint_fast64_t identifier) const;
68
69 /*
70 * Returns the choice origin information as a (human readable) string.
71 */
72 std::string const& getChoiceInfo(uint_fast64_t choiceIndex) const;
73
74 /*
75 * Returns the information for the given choice origin identifier as a (human readable) string
76 */
77 Json const& getIdentifierAsJson(uint_fast64_t identifier) const;
78
79 /*
80 * Returns the choice origin information as a (human readable) string.
81 */
82 Json const& getChoiceAsJson(uint_fast64_t choiceIndex) const;
83
84 /*
85 * Derive new choice origins from this by selecting the given choices.
86 */
87 std::shared_ptr<ChoiceOrigins> selectChoices(storm::storage::BitVector const& selectedChoices) const;
88
89 /*
90 * Removes origin information of the given choice.
91 */
92 void clearOriginOfChoice(uint_fast64_t choiceIndex);
93
94 /*
95 * Derive new choice origins from this by selecting the given choices.
96 * If an invalid choice index is selected, the corresponding choice will get the identifier for choices with no origin.
97 */
98 std::shared_ptr<ChoiceOrigins> selectChoices(std::vector<uint_fast64_t> const& selectedChoiceIndices) const;
99
101
102 virtual std::size_t hash() const = 0;
103
104 protected:
105 ChoiceOrigins(std::vector<uint_fast64_t> const& indexToIdentifierMapping);
106 ChoiceOrigins(std::vector<uint_fast64_t>&& indexToIdentifierMapping);
107
108 /*
109 * Returns a copy of this object where the mapping of choice indices to origin identifiers is replaced by the given one.
110 */
111 virtual std::shared_ptr<ChoiceOrigins> cloneWithNewIndexToIdentifierMapping(std::vector<uint_fast64_t>&& indexToIdentifierMapping) const = 0;
112
113 /*
114 * Computes the identifier infos (i.e., human readable strings representing the choice origins).
115 */
116 virtual void computeIdentifierInfos() const = 0;
117
118 /*
119 * Computes the identifier infos (i.e., human readable strings representing the choice origins).
120 */
121 virtual void computeIdentifierJson() const = 0;
122
123 std::vector<uint_fast64_t> indexToIdentifier;
124
125 // cached identifier infos might be empty if identifiers have not been generated yet.
126 mutable std::vector<std::string> identifierToInfo;
127
128 // cached identifier infos might be empty if identifiers have not been generated yet.
129 mutable std::vector<Json> identifierToJson;
130};
131} // namespace sparse
132} // namespace storage
133} // namespace storm
This class manages the labeling of the choice space with a number of (atomic) labels.
A bit vector that is internally represented as a vector of 64-bit values.
Definition BitVector.h:16
virtual std::shared_ptr< ChoiceOrigins > cloneWithNewIndexToIdentifierMapping(std::vector< uint_fast64_t > &&indexToIdentifierMapping) const =0
std::vector< uint_fast64_t > indexToIdentifier
virtual uint_fast64_t getNumberOfIdentifiers() const =0
std::string const & getChoiceInfo(uint_fast64_t choiceIndex) const
void clearOriginOfChoice(uint_fast64_t choiceIndex)
virtual std::size_t hash() const =0
virtual void computeIdentifierInfos() const =0
uint_fast64_t getIdentifier(uint_fast64_t choiceIndex) const
JaniChoiceOrigins & asJaniChoiceOrigins()
virtual void computeIdentifierJson() const =0
storm::models::sparse::ChoiceLabeling toChoiceLabeling() const
PrismChoiceOrigins & asPrismChoiceOrigins()
std::vector< std::string > identifierToInfo
static uint_fast64_t getIdentifierForChoicesWithNoOrigin()
storm::json< storm::RationalNumber > Json
std::shared_ptr< ChoiceOrigins > selectChoices(storm::storage::BitVector const &selectedChoices) const
ChoiceOrigins(std::vector< uint_fast64_t > const &indexToIdentifierMapping)
Json const & getChoiceAsJson(uint_fast64_t choiceIndex) const
Json const & getIdentifierAsJson(uint_fast64_t identifier) const
std::vector< uint_fast64_t > const & getIdentifiers() const
std::string const & getIdentifierInfo(uint_fast64_t identifier) const
This class represents for each choice the origin in the jani specification // TODO complete this.
This class represents for each choice the set of prism commands that induced the choice.
nlohmann::basic_json< std::map, std::vector, std::string, bool, int64_t, uint64_t, ValueType > json
Definition JsonForward.h:11