Storm
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
15class PrismChoiceOrigins;
16class JaniChoiceOrigins;
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
42 /*
43 * Returns the number of considered identifier.
44 * This can be used to, e.g., loop over all identifiers.
45 */
46 virtual uint_fast64_t getNumberOfIdentifiers() const = 0;
47
48 /*
49 * Returns the number of considered choice indices.
50 */
51 uint_fast64_t getNumberOfChoices() const;
52
53 /*
54 * Returns the identifier that is used for choices without an origin in the input specification
55 * E.g., Selfloops introduced on deadlock states
56 */
57 static uint_fast64_t getIdentifierForChoicesWithNoOrigin();
58
59 /*
60 * Returns the information for the given choice origin identifier as a (human readable) string
61 */
62 std::string const& getIdentifierInfo(uint_fast64_t identifier) const;
63
64 /*
65 * Returns the choice origin information as a (human readable) string.
66 */
67 std::string const& getChoiceInfo(uint_fast64_t choiceIndex) const;
68
69 /*
70 * Returns the information for the given choice origin identifier as a (human readable) string
71 */
72 Json const& getIdentifierAsJson(uint_fast64_t identifier) const;
73
74 /*
75 * Returns the choice origin information as a (human readable) string.
76 */
77 Json const& getChoiceAsJson(uint_fast64_t choiceIndex) const;
78
79 /*
80 * Derive new choice origins from this by selecting the given choices.
81 */
82 std::shared_ptr<ChoiceOrigins> selectChoices(storm::storage::BitVector const& selectedChoices) const;
83
84 /*
85 * Removes origin information of the given choice.
86 */
87 void clearOriginOfChoice(uint_fast64_t choiceIndex);
88
89 /*
90 * Derive new choice origins from this by selecting the given choices.
91 * If an invalid choice index is selected, the corresponding choice will get the identifier for choices with no origin.
92 */
93 std::shared_ptr<ChoiceOrigins> selectChoices(std::vector<uint_fast64_t> const& selectedChoiceIndices) const;
94
96
97 virtual std::size_t hash() const = 0;
98
99 protected:
100 ChoiceOrigins(std::vector<uint_fast64_t> const& indexToIdentifierMapping);
101 ChoiceOrigins(std::vector<uint_fast64_t>&& indexToIdentifierMapping);
102
103 /*
104 * Returns a copy of this object where the mapping of choice indices to origin identifiers is replaced by the given one.
105 */
106 virtual std::shared_ptr<ChoiceOrigins> cloneWithNewIndexToIdentifierMapping(std::vector<uint_fast64_t>&& indexToIdentifierMapping) const = 0;
107
108 /*
109 * Computes the identifier infos (i.e., human readable strings representing the choice origins).
110 */
111 virtual void computeIdentifierInfos() const = 0;
112
113 /*
114 * Computes the identifier infos (i.e., human readable strings representing the choice origins).
115 */
116 virtual void computeIdentifierJson() const = 0;
117
118 std::vector<uint_fast64_t> indexToIdentifier;
119
120 // cached identifier infos might be empty if identifiers have not been generated yet.
121 mutable std::vector<std::string> identifierToInfo;
122
123 // cached identifier infos might be empty if identifiers have not been generated yet.
124 mutable std::vector<Json> identifierToJson;
125};
126} // namespace sparse
127} // namespace storage
128} // 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:18
This class represents the origin of the choices of a model in terms of the input model specification ...
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
Json const & getChoiceAsJson(uint_fast64_t choiceIndex) const
Json const & getIdentifierAsJson(uint_fast64_t identifier) 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.
LabParser.cpp.
Definition cli.cpp:18
nlohmann::basic_json< std::map, std::vector, std::string, bool, int64_t, uint64_t, ValueType > json
Definition JsonForward.h:10