Storm 1.13.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ModelIndex.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <optional>
5#include <string>
6
12
13namespace storm::umb {
14
15struct ModelIndex {
17
18 struct ModelData {
19 std::optional<std::string> name, version;
20 std::optional<std::vector<std::string>> authors;
21 std::optional<std::string> description, comment, doi, url;
22 static auto constexpr JsonKeys = {"name", "version", "authors", "description", "comment", "doi", "url"};
24 };
25 std::optional<ModelData> modelData;
26
27 struct FileData {
28 std::optional<std::string> tool, toolVersion;
29 std::optional<uint64_t> creationDate;
30 std::optional<storm::json<storm::RationalNumber>> parameters;
31 auto static constexpr JsonKeys = {"tool", "tool-version", "creation-date", "parameters"};
33
34 std::string creationDateAsString() const;
36 };
37 std::optional<FileData> fileData;
38
42 using Values = Time;
43 auto static constexpr Keys = {"discrete", "stochastic", "urgent-stochastic"};
44 };
46
47 auto static constexpr InvalidNumber = std::numeric_limits<uint64_t>::max(); // initial value for counts
50
54 auto static constexpr Keys = {"states", "branches"};
55 };
56 std::optional<storm::SerializedEnum<ObservationsApplyToDeclaration>> observationsApplyTo;
57
59
60 std::optional<std::vector<std::string>> playerNames;
61
62 auto static constexpr JsonKeys = {"time",
63 "#players",
64 "#states",
65 "#initial-states",
66 "#choices",
67 "#choice-actions",
68 "#branches",
69 "#branch-actions",
70 "#observations",
71 "observations-apply-to",
72 "branch-probability-type",
73 "exit-rate-type",
74 "observation-probability-type",
75 "player-names"};
78
79 struct Annotation {
80 std::optional<std::string> alias, description;
84 auto static constexpr Keys = {"states", "choices", "branches", "observations", "players"};
85 };
86 std::vector<storm::SerializedEnum<AppliesToDeclaration>> appliesTo;
88 std::optional<int64_t> lower, upper;
89 std::optional<uint64_t> numStrings;
90 std::optional<SizedType> probabilityType;
91 std::optional<uint64_t> numProbabilities;
92 auto static constexpr JsonKeys = {"alias", "description", "applies-to", "type", "lower", "upper", "#strings", "probability-type", "#probabilities"};
94
100 static std::string getValidIdentifierFromAlias(std::string const& alias);
101
102 bool appliesToStates() const;
103 bool appliesToChoices() const;
104 bool appliesToBranches() const;
105 bool appliesToObservations() const;
106 bool appliesToPlayers() const;
107 };
108 using AnnotationMap = std::map<std::string, Annotation>;
109 std::optional<std::map<std::string, AnnotationMap>> annotations;
110
111 struct Valuations {
112 std::optional<ValuationDescription> states, choices, branches, observations, players;
113 auto static constexpr JsonKeys = {"states", "choices", "branches", "observations", "players"};
115 };
116 std::optional<Valuations> valuations;
117
118 auto static constexpr JsonKeys = {"format-version", "format-revision", "model-data", "file-data", "transition-system", "annotations", "valuations"};
120
121 // conveniently access aps, rewards, or a custom annotation (return a NullRef iff the annotation is not present)
122 storm::OptionalRef<AnnotationMap> aps(bool createIfMissing = false);
124 storm::OptionalRef<AnnotationMap> rewards(bool createIfMissing = false);
126 storm::OptionalRef<AnnotationMap> annotation(std::string const& annotationsType, bool createIfMissing = false);
127 storm::OptionalRef<AnnotationMap const> annotation(std::string const& annotationsType) const;
128
134 std::optional<std::string> findAPName(std::string const& id) const;
135 std::optional<std::string> findRewardName(std::string const& id) const;
136 std::optional<std::string> findAnnotationName(std::string const& annotationsType, std::string const& id) const;
137};
138
139} // namespace storm::umb
Helper class that optionally holds a reference to an object of type T.
Definition OptionalRef.h:48
Helper struct to enable json serialization.
static auto constexpr JsonKeys
Definition ModelIndex.h:92
storm::JsonSerialization JsonSerialization
Definition ModelIndex.h:93
std::optional< uint64_t > numProbabilities
Definition ModelIndex.h:91
std::optional< int64_t > lower
Definition ModelIndex.h:88
std::optional< int64_t > upper
Definition ModelIndex.h:88
std::optional< SizedType > probabilityType
Definition ModelIndex.h:90
std::vector< storm::SerializedEnum< AppliesToDeclaration > > appliesTo
Definition ModelIndex.h:86
static std::string getValidIdentifierFromAlias(std::string const &alias)
Takes an alias (which can be an arbitrary string) and converts it to a valid identifier in [0-9a-z_-]...
std::optional< std::string > description
Definition ModelIndex.h:80
std::optional< std::string > alias
Definition ModelIndex.h:80
std::optional< uint64_t > numStrings
Definition ModelIndex.h:89
std::optional< std::string > toolVersion
Definition ModelIndex.h:28
std::string creationDateAsString() const
std::optional< uint64_t > creationDate
Definition ModelIndex.h:29
std::optional< storm::json< storm::RationalNumber > > parameters
Definition ModelIndex.h:30
static auto constexpr JsonKeys
Definition ModelIndex.h:31
std::optional< std::string > tool
Definition ModelIndex.h:28
storm::JsonSerialization JsonSerialization
Definition ModelIndex.h:32
std::optional< std::string > url
Definition ModelIndex.h:21
storm::JsonSerialization JsonSerialization
Definition ModelIndex.h:23
std::optional< std::string > doi
Definition ModelIndex.h:21
std::optional< std::string > description
Definition ModelIndex.h:21
std::optional< std::string > version
Definition ModelIndex.h:19
std::optional< std::string > comment
Definition ModelIndex.h:21
std::optional< std::vector< std::string > > authors
Definition ModelIndex.h:20
static auto constexpr JsonKeys
Definition ModelIndex.h:22
std::optional< std::string > name
Definition ModelIndex.h:19
storm::SerializedEnum< TimeDeclaration > time
Definition ModelIndex.h:45
std::optional< SizedType > exitRateType
Definition ModelIndex.h:58
std::optional< SizedType > branchProbabilityType
Definition ModelIndex.h:58
std::optional< storm::SerializedEnum< ObservationsApplyToDeclaration > > observationsApplyTo
Definition ModelIndex.h:56
std::optional< std::vector< std::string > > playerNames
Definition ModelIndex.h:60
storm::JsonSerialization JsonSerialization
Definition ModelIndex.h:76
std::optional< SizedType > observationProbabilityType
Definition ModelIndex.h:58
std::optional< ValuationDescription > states
Definition ModelIndex.h:112
static auto constexpr JsonKeys
Definition ModelIndex.h:113
storm::JsonSerialization JsonSerialization
Definition ModelIndex.h:114
std::optional< ValuationDescription > players
Definition ModelIndex.h:112
std::optional< ValuationDescription > choices
Definition ModelIndex.h:112
std::optional< ValuationDescription > branches
Definition ModelIndex.h:112
std::optional< ValuationDescription > observations
Definition ModelIndex.h:112
std::optional< ModelData > modelData
Definition ModelIndex.h:25
struct storm::umb::ModelIndex::TransitionSystem transitionSystem
storm::JsonSerialization JsonSerialization
Definition ModelIndex.h:119
std::optional< std::map< std::string, AnnotationMap > > annotations
Definition ModelIndex.h:109
static auto constexpr JsonKeys
Definition ModelIndex.h:118
storm::OptionalRef< AnnotationMap const > rewards() const
std::optional< std::string > findAPName(std::string const &id) const
Finds a name of the annotation (i.e.
std::map< std::string, Annotation > AnnotationMap
Definition ModelIndex.h:108
storm::OptionalRef< AnnotationMap > annotation(std::string const &annotationsType, bool createIfMissing=false)
std::optional< Valuations > valuations
Definition ModelIndex.h:116
std::optional< std::string > findAnnotationName(std::string const &annotationsType, std::string const &id) const
std::optional< FileData > fileData
Definition ModelIndex.h:37
storm::OptionalRef< AnnotationMap const > aps() const
std::optional< std::string > findRewardName(std::string const &id) const