Storm 1.14.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
SparseModelFromUmb.cpp
Go to the documentation of this file.
2
3#include <ranges>
4#include <utility>
5
20
21namespace storm::umb {
22
23namespace detail {
24
25auto csrRange(auto&& csr, uint64_t i) {
26 if (csr) {
27 STORM_LOG_ASSERT(i + 1 < csr->size(), "CSR index out of bounds: " << (i + 1) << " >= " << csr->size());
28 return std::ranges::iota_view(csr.value()[i], csr.value()[i + 1]);
29 } else {
30 // assume 1:1 mapping
31 return std::ranges::iota_view(i, i + 1);
32 }
33}
34
35template<typename ValueType>
36storm::storage::SparseMatrix<ValueType> createBranchMatrix(storm::umb::UmbModel const& umbModel, std::ranges::input_range auto&& branchValues) {
37 auto const& tsIndex = umbModel.index.transitionSystem;
38 bool const hasRowGroups = tsIndex.numPlayers >= 1;
39 storm::storage::SparseMatrixBuilder<ValueType> builder(tsIndex.numChoices, tsIndex.numStates, tsIndex.numBranches, true, hasRowGroups,
40 hasRowGroups ? tsIndex.numStates : 0u);
41 for (uint64_t stateIndex{0}; stateIndex < tsIndex.numStates; ++stateIndex) {
42 auto choices = csrRange(umbModel.stateToChoices, stateIndex);
43 if (hasRowGroups) {
44 builder.newRowGroup(*choices.begin());
45 }
46 for (auto const choiceIndex : choices) {
47 STORM_LOG_ASSERT(choiceIndex < tsIndex.numChoices, "Choice index out of bounds.");
48 for (auto const branchIndex : csrRange(umbModel.choiceToBranches, choiceIndex)) {
49 auto const branchTarget = umbModel.branchToTarget.has_value() ? umbModel.branchToTarget.value()[branchIndex] : 0ul;
50 STORM_LOG_ASSERT(branchTarget < tsIndex.numStates, "Branch target index out of bounds: " << branchTarget << " >= " << tsIndex.numStates);
51 builder.addNextValue(choiceIndex, branchTarget, branchValues[branchIndex]);
52 }
53 }
54 }
55 return builder.build();
56}
57
58template<typename ValueType>
60 storm::umb::SizedType const& sourceType) {
61 return ValueEncoding::applyDecodedVector<ValueType>([&umbModel](auto&& input) { return createBranchMatrix<ValueType>(umbModel, input); }, branchValues,
62 sourceType);
63}
64
65template<typename ValueType>
67 auto const defaultView = std::ranges::iota_view(0ull, umbModel.index.transitionSystem.numBranches) |
68 std::ranges::views::transform([&defaultValue](auto) -> ValueType { return defaultValue; });
69 return createBranchMatrix<ValueType>(umbModel, defaultView);
70}
71
73 STORM_LOG_THROW(umbBitVector.size() >= size, storm::exceptions::WrongFormatException,
74 "Bit vector has unexpected size: " << umbBitVector.size() << " < " << size << ".");
75 storm::storage::BitVector result(umbBitVector);
76 result.resize(size);
77 return result;
78}
79
81 STORM_LOG_THROW(umbBitVector.has_value(), storm::exceptions::WrongFormatException, "BitVector is not given but expected.");
82 return createBitVector(umbBitVector.value(), size);
83}
84
86 auto const& numStates = umbModel.index.transitionSystem.numStates;
87 storm::models::sparse::StateLabeling stateLabelling(numStates);
88 if (umbModel.stateIsInitial) {
89 stateLabelling.addLabel("init", createBitVector(umbModel.stateIsInitial, numStates));
90 } else {
91 STORM_LOG_WARN("No initial states given in UMB model.");
92 stateLabelling.addLabel("init", storm::storage::BitVector(numStates, false)); // default to all states not being initial
93 }
94 if (umbModel.index.aps().has_value()) {
95 auto aps = umbModel.index.aps();
96 for (auto const& [apName, apIndex] : aps.value()) {
97 STORM_LOG_THROW(umbModel.aps().has_value() && umbModel.aps()->contains(apName), storm::exceptions::WrongFormatException,
98 "Atomic proposition '" << apName << "' mentioned in index but no files were found.");
99 STORM_LOG_THROW(isBooleanType(apIndex.type.type), storm::exceptions::WrongFormatException,
100 "Atomic proposition '" << apName << "' must be of boolean type.");
101 STORM_LOG_THROW(apIndex.appliesTo.size() == 1 && apIndex.appliesToStates(), storm::exceptions::WrongFormatException,
102 "Atomic proposition '" << apName << "' must apply only to states.");
103 auto const& ap = umbModel.aps()->at(apName);
104 auto labelName = apIndex.alias.value_or(apName); // prefer alias as label name if it exists
105 STORM_LOG_THROW(ap.states.has_value(), storm::exceptions::WrongFormatException, "Atomic proposition '" << apName << "' has no states values.");
106 STORM_LOG_THROW(!stateLabelling.containsLabel(labelName), storm::exceptions::WrongFormatException,
107 "Label '" << labelName << "' already exists in state labeling.");
108 stateLabelling.addLabel(labelName, createBitVector(ap.states->values.template get<bool>(), numStates));
109 }
110 }
111 return stateLabelling;
112}
113
115 auto const& numChoices = umbModel.index.transitionSystem.numChoices;
116 auto const& numActions = umbModel.index.transitionSystem.numChoiceActions;
117
118 storm::models::sparse::ChoiceLabeling choiceLabeling(numChoices);
119
120 auto const actionStrings = storm::umb::stringVectorView(umbModel.choiceActions->strings, umbModel.choiceActions->stringMapping);
121 bool const hasActionStrings = !actionStrings.empty();
122 STORM_LOG_THROW(!hasActionStrings || actionStrings.size() == numActions, storm::exceptions::WrongFormatException,
123 "Number of action strings does not match number of actions.");
124
125 // choices where the action has the empty label will not be labeled at all. If there are no string labels, this case is not relevant.
126 uint64_t const emptyActionIndex = hasActionStrings ? std::ranges::find(actionStrings, "") - actionStrings.begin() : numActions;
127
128 // for each choice, find the corresponding action index and set the bit accordingly
129 auto const& choiceToChoiceAction = umbModel.choiceActions->values.value();
130 std::vector<storm::storage::BitVector> actionToLabels(numActions, storm::storage::BitVector(numChoices, false));
131 for (uint64_t choiceIndex = 0; choiceIndex < numChoices; ++choiceIndex) {
132 auto const actionIndex = choiceToChoiceAction[choiceIndex];
133 STORM_LOG_ASSERT(actionIndex < numActions, "Choice to action mapping out of bounds.");
134 if (hasActionStrings && actionIndex == emptyActionIndex) {
135 continue; // skip choices with empty action. They will not be labeled.
136 }
137 actionToLabels[actionIndex].set(choiceIndex);
138 }
139
140 // add the action labels to the labeling
141 if (hasActionStrings) {
142 for (uint64_t actionIndex = 0; actionIndex < numActions; ++actionIndex) {
143 if (actionIndex == emptyActionIndex) {
144 continue;
145 }
146 choiceLabeling.addLabel(std::string(actionStrings[actionIndex]), std::move(actionToLabels[actionIndex]));
147 }
148 } else {
149 // use generic action names
150 for (uint64_t actionIndex = 0; actionIndex < numActions; ++actionIndex) {
151 choiceLabeling.addLabel("a" + std::to_string(actionIndex), std::move(actionToLabels[actionIndex]));
152 }
153 }
154 return choiceLabeling;
155}
156
157template<typename ValueType>
160 std::unordered_map<std::string, RewardModel> rewardModels;
161 if (umbModel.index.rewards().has_value()) {
162 auto rewards = umbModel.index.rewards();
163 for (auto const& [rewName, rewIndex] : rewards.value()) {
164 STORM_LOG_THROW(umbModel.rewards().has_value() && umbModel.rewards()->contains(rewName), storm::exceptions::WrongFormatException,
165 "Reward " << rewName << "' mentioned in index but no files were found.");
166 auto const& rew = umbModel.rewards()->at(rewName);
167 auto usedRewName = rewIndex.alias.value_or(rewName); // prefer alias as reward name if it exists
168 STORM_LOG_THROW(!rewardModels.contains(usedRewName), storm::exceptions::WrongFormatException,
169 "Reward '" << usedRewName << "' already exists in reward models.");
170 STORM_LOG_THROW(isNumericType(rewIndex.type.type), storm::exceptions::WrongFormatException,
171 "Reward type for reward '" << rewName << "' must be numeric.");
172 std::optional<std::vector<ValueType>> stateRewards, stateActionRewards;
173 std::optional<storm::storage::SparseMatrix<ValueType>> transitionRewards;
174 if (rewIndex.appliesToStates() && rew.states.has_value()) {
175 stateRewards = ValueEncoding::createDecodedVector<ValueType>(rew.states->values, rewIndex.type);
176 }
177 if (rewIndex.appliesToChoices() && rew.choices.has_value()) {
178 stateActionRewards = ValueEncoding::createDecodedVector<ValueType>(rew.choices->values, rewIndex.type);
179 }
180 if (rewIndex.appliesToBranches() && rew.branches.has_value()) {
181 transitionRewards = createBranchMatrix<ValueType>(umbModel, rew.branches->values, rewIndex.type);
182 }
183 STORM_LOG_THROW(!rewIndex.appliesToObservations(), storm::exceptions::NotSupportedException,
184 "Observation rewards are not supported for reward '" << rewName << "'.");
185 STORM_LOG_THROW(!rewIndex.appliesToPlayers(), storm::exceptions::NotSupportedException,
186 "Player rewards are not supported for reward '" << rewName << "'.");
187 rewardModels.emplace(std::move(usedRewName), RewardModel(std::move(stateRewards), std::move(stateActionRewards), std::move(transitionRewards)));
188 }
189 }
190 return rewardModels;
191}
192
193template<typename ValueType>
195 if (umbModel.branchToProbability.hasValue()) {
196 auto const probType = umbModel.index.transitionSystem.branchProbabilityType.value();
197 auto result = createBranchMatrix<ValueType>(umbModel, umbModel.branchToProbability, probType);
199 if (umbModel.branchToProbability.isType<double>() || umbModel.branchToProbability.isType<storm::Interval>()) {
200 // If the branch probabilities are imprecise, we might need to adapt the matrix rows to ensure they sum up to 1.
201 uint64_t numNormalized{0};
203 auto updateNormStats = [&numNormalized, &maxDiff](auto const& rowSum) {
204 maxDiff = std::max(
206 ++numNormalized;
207 };
208
209 for (uint64_t rowIndex = 0; rowIndex < result.getRowCount(); ++rowIndex) {
210 auto const rowSum = result.getRowSum(rowIndex);
211 if constexpr (storm::IsIntervalType<ValueType>) {
212 if (rowSum.lower() > storm::utility::one<ValueType>()) {
213 updateNormStats(rowSum.lower());
214 for (auto& entry : result.getRow(rowIndex)) {
215 entry.setValue({entry.getValue().lower() / rowSum.lower(), entry.getValue().upper()});
216 }
217 } else if (rowSum.upper() < storm::utility::one<ValueType>()) {
218 updateNormStats(rowSum.upper());
219 for (auto& entry : result.getRow(rowIndex)) {
220 entry.setValue({entry.getValue().lower(), entry.getValue().upper() / rowSum.upper()});
221 }
222 }
223 } else {
224 if (!storm::utility::isOne(rowSum)) {
225 updateNormStats(rowSum);
226 for (auto& entry : result.getRow(rowIndex)) {
227 entry.setValue(entry.getValue() / rowSum);
228 }
229 }
230 }
231 }
232 STORM_LOG_WARN_COND(numNormalized == 0,
233 "Branch probabilities are given in an imprecise type but an exact model was requested. Probabilities for "
234 << numNormalized << " choices were normalized to ensure they sum up to 1. Maximum diff to 1 was " << maxDiff << ".");
235 }
236 }
237 return result;
238 } else {
240 }
241}
242
243template<typename ValueType>
244std::shared_ptr<storm::models::sparse::Model<ValueType>> constructSparseModel(storm::umb::UmbModel const& umbModel, ImportOptions const& options) {
245 umbModel.validateOrThrow();
246
247 // transitions, labelings, rewards
248 auto stateLabelling = constructStateLabeling(umbModel);
249 STORM_LOG_THROW(umbModel.index.transitionSystem.branchProbabilityType.has_value(), storm::exceptions::WrongFormatException,
250 "Branch probability type must be given in the UMB model index.");
251 auto transitionMatrix = constructTransitionMatrix<ValueType>(umbModel);
252 storm::storage::sparse::ModelComponents<ValueType> components(std::move(transitionMatrix), std::move(stateLabelling),
254 // choice labeling
255 if (options.buildChoiceLabeling && umbModel.index.transitionSystem.numChoiceActions > 0) {
256 STORM_LOG_THROW(umbModel.choiceActions.has_value() && umbModel.choiceActions->values.has_value(), storm::exceptions::WrongFormatException,
257 "Choice actions mentioned in the index but no files given.");
258 components.choiceLabeling = constructChoiceLabeling(umbModel);
259 }
260 // state valuations
261 if (options.buildStateValuations && umbModel.index.valuations.has_value() && umbModel.index.valuations->states.has_value()) {
262 STORM_LOG_THROW(umbModel.valuations.states.has_value() && umbModel.valuations.states->valuations.has_value(), storm::exceptions::WrongFormatException,
263 "State valuations mentioned in the index but no files given.");
264 auto const& svIndex = umbModel.index.valuations->states.value();
265 auto const& svData = umbModel.valuations.states.value();
266 STORM_LOG_ASSERT(svIndex.numStrings.has_value() == svData.stringMapping.has_value() && svIndex.numStrings.has_value() == svData.strings.has_value(),
267 "String mapping and strings must be given iff there are #strings mentioned in index.");
268 storm::storage::sparse::ValuationsStorage val(umbModel.index.transitionSystem.numStates, svIndex.classes, svData.valuations.value(),
269 svData.stringMapping.value_or(std::vector<uint64_t>()), svData.strings.value_or(std::vector<char>()),
270 svData.valuationToClass);
271 components.stateValuations.emplace(std::move(val));
272 } else {
273 STORM_LOG_WARN_COND(!options.buildStateValuations, "State valuations requested but the UMB model does not have any.");
274 }
275
276 // model type-specific components
277 using enum storm::models::ModelType;
278 auto const modelType = deriveModelType(umbModel.index);
279 if (modelType == Ctmc || modelType == MarkovAutomaton) {
280 STORM_LOG_THROW(umbModel.stateToExitRate.hasValue(), storm::exceptions::WrongFormatException,
281 "Exit rates are required for CTMC and Markov automaton models but not present in the UMB model.");
283 if (modelType == MarkovAutomaton) {
284 if (umbModel.stateIsMarkovian) {
286 } else {
287 // Default to no Markovian state
288 components.markovianStates.emplace(umbModel.index.transitionSystem.numStates, false);
289 }
290 }
291 } else if (modelType == Pomdp) {
293 storm::exceptions::NotSupportedException, "Only state observations are currently supported for POMDP models.");
294 STORM_LOG_THROW(!umbModel.index.transitionSystem.observationProbabilityType.has_value(), storm::exceptions::NotSupportedException,
295 "Only deterministic state observations are currently supported for POMDP models.");
296 STORM_LOG_THROW(umbModel.stateObservations.has_value(), storm::exceptions::WrongFormatException,
297 "State observations are required for POMDP models but not present in the UMB model.");
298 components.observabilityClasses.emplace(umbModel.stateObservations->values->begin(), umbModel.stateObservations->values->end());
299 // observation valuations
300 if (options.buildObservationValuations && umbModel.index.valuations.has_value() && umbModel.index.valuations->observations.has_value()) {
301 STORM_LOG_THROW(umbModel.valuations.observations.has_value() && umbModel.valuations.observations->valuations.has_value(),
302 storm::exceptions::WrongFormatException, "Observation valuations mentioned in the index but no files given.");
303 auto const& ovIndex = umbModel.index.valuations->observations.value();
304 auto const& ovData = umbModel.valuations.observations.value();
305 STORM_LOG_ASSERT(ovIndex.numStrings.has_value() == ovData.stringMapping.has_value() && ovIndex.numStrings.has_value() == ovData.strings.has_value(),
306 "String mapping and strings must be given iff there are #strings mentioned in index.");
307 storm::storage::sparse::ValuationsStorage val(umbModel.index.transitionSystem.numObservations, ovIndex.classes, ovData.valuations.value(),
308 ovData.stringMapping.value_or(std::vector<uint64_t>()), ovData.strings.value_or(std::vector<char>()),
309 ovData.valuationToClass);
310 components.observationValuations.emplace(std::move(val));
311 } else {
312 STORM_LOG_WARN_COND(!options.buildStateValuations, "State valuations requested but the UMB model does not have any.");
313 }
314 } else if (modelType == Smg) {
315 if (umbModel.stateToPlayer.has_value()) {
316 auto const& stateToPlayer = umbModel.stateToPlayer.value();
317 components.statePlayerIndications.emplace(stateToPlayer.begin(), stateToPlayer.end());
318 } else {
319 // Default to all states belonging to player 0
320 components.statePlayerIndications.emplace(umbModel.index.transitionSystem.numStates, 0);
321 }
322 if (umbModel.index.transitionSystem.playerNames.has_value()) {
323 auto const& names = umbModel.index.transitionSystem.playerNames.value();
324 STORM_LOG_THROW(names.size() == umbModel.index.transitionSystem.numPlayers, storm::exceptions::WrongFormatException,
325 "Number of player names does not match number of players in the UMB model index.");
326 components.playerNameToIndexMap.emplace();
327 for (uint64_t i = 0; i < names.size(); ++i) {
328 components.playerNameToIndexMap->emplace(names[i], i);
329 }
330 }
331 } else {
332 STORM_LOG_THROW(modelType == Dtmc || modelType == Mdp, storm::exceptions::NotSupportedException,
333 "Unexpected model type for UMB import: " << modelType << ".");
334 }
335 return storm::utility::builder::buildModelFromComponents(deriveModelType(umbModel.index), std::move(components));
336}
337
338} // namespace detail
339
341 using enum storm::models::ModelType;
342
343 auto const& ts = index.transitionSystem;
344
345 STORM_LOG_THROW(ts.branchProbabilityType.has_value(), storm::exceptions::NotSupportedException, "Models without branch values are not supported.");
348 case Discrete:
349 switch (ts.numPlayers) {
350 case 0:
351 return Dtmc;
352 case 1:
353 return ts.numObservations == 0 ? Mdp : Pomdp;
354 default:
355 STORM_LOG_THROW(ts.numObservations == 0, storm::exceptions::NotSupportedException,
356 "Multiplayer partially observable models are not supported.");
357 return Smg;
358 }
359 case Stochastic:
360 STORM_LOG_THROW(ts.numPlayers == 0, storm::exceptions::NotSupportedException, "Stochastic time models with multiple players are not supported.");
361 return Ctmc;
362 case UrgentStochastic:
363 STORM_LOG_THROW(ts.numPlayers == 1, storm::exceptions::NotSupportedException,
364 "Urgent stochastic time models with multiple or no players are not supported.");
365 return MarkovAutomaton;
366 }
367 STORM_LOG_THROW(false, storm::exceptions::UnexpectedException, "Unexpected transition system time type" << ts.time << ".");
368}
369
370template<typename ValueType>
371bool deriveValueType(storm::umb::ModelIndex const& index, ImportOptions const& options) {
372 STORM_LOG_THROW(index.transitionSystem.branchProbabilityType.has_value(), storm::exceptions::NotSupportedException,
373 "Models without branch values are not supported.");
374 bool const haveDouble = index.transitionSystem.branchProbabilityType->type == storm::umb::Type::Double;
375 bool const haveRational = index.transitionSystem.branchProbabilityType->type == storm::umb::Type::Rational;
376 bool const haveDoubleInterval = index.transitionSystem.branchProbabilityType->type == storm::umb::Type::DoubleInterval;
377 bool const haveRationalInterval = index.transitionSystem.branchProbabilityType->type == storm::umb::Type::RationalInterval;
378 bool const haveInterval = haveDoubleInterval || haveRationalInterval;
379 bool const useDefault = options.valueType == ImportOptions::ValueType::Default;
380 bool const useDouble = options.valueType == ImportOptions::ValueType::Double;
381 bool const useRational = options.valueType == ImportOptions::ValueType::Rational;
382
383 STORM_LOG_ASSERT(useDefault || useDouble || useRational, "Unexpected value type option: " << static_cast<int>(options.valueType) << ".");
384
385 if (!haveInterval) {
386 if constexpr (std::is_same_v<ValueType, double>) {
387 return useDouble || (useDefault && haveDouble);
388 } else if constexpr (std::is_same_v<ValueType, storm::RationalNumber>) {
389 return useRational || (useDefault && haveRational);
390 } else {
391 return false;
392 }
393 } else {
394 if constexpr (std::is_same_v<ValueType, storm::Interval>) {
395 return useDouble || (useDefault && haveDoubleInterval);
396 } else if constexpr (std::is_same_v<ValueType, storm::RationalInterval>) {
397 return useRational || (useDefault && haveRationalInterval);
398 } else {
399 return false;
400 }
401 }
402}
403
404template<typename ValueType>
405std::shared_ptr<storm::models::sparse::Model<ValueType>> sparseModelFromUmb(storm::umb::UmbModel const& umbModel, ImportOptions const& options) {
406 return detail::constructSparseModel<ValueType>(umbModel, options);
407}
408
409std::shared_ptr<storm::models::ModelBase> sparseModelFromUmb(storm::umb::UmbModel const& umbModel, ImportOptions const& options) {
410 if (deriveValueType<double>(umbModel.index, options)) {
411 return detail::constructSparseModel<double>(umbModel, options);
412 } else if (deriveValueType<storm::RationalNumber>(umbModel.index, options)) {
414 } else if (deriveValueType<storm::Interval>(umbModel.index, options)) {
415 return detail::constructSparseModel<storm::Interval>(umbModel, options);
416 } else if (deriveValueType<storm::RationalInterval>(umbModel.index, options)) {
418 } else {
419 STORM_LOG_THROW(false, storm::exceptions::NotSupportedException,
420 "Could not derive a supported value type for the UMB model with branch probabilities of type "
421 << umbModel.index.transitionSystem.branchProbabilityType->toString() << ".");
422 }
423}
424
425template std::shared_ptr<storm::models::sparse::Model<double>> sparseModelFromUmb<double>(storm::umb::UmbModel const& umbModel, ImportOptions const& options);
426template std::shared_ptr<storm::models::sparse::Model<storm::RationalNumber>> sparseModelFromUmb<storm::RationalNumber>(storm::umb::UmbModel const& umbModel,
427 ImportOptions const& options);
428template std::shared_ptr<storm::models::sparse::Model<storm::Interval>> sparseModelFromUmb<storm::Interval>(storm::umb::UmbModel const& umbModel,
429 ImportOptions const& options);
430template std::shared_ptr<storm::models::sparse::Model<storm::RationalInterval>> sparseModelFromUmb<storm::RationalInterval>(
431 storm::umb::UmbModel const& umbModel, ImportOptions const& options);
432
433} // namespace storm::umb
storm::models::sparse::Dtmc< double > Dtmc
storm::models::sparse::Mdp< double > Mdp
This class manages the labeling of the choice space with a number of (atomic) labels.
void addLabel(std::string const &label)
Adds a new label to the labelings.
bool containsLabel(std::string const &label) const
Checks whether a label is registered within this labeling.
This class manages the labeling of the state 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
void resize(uint64_t newLength, bool init=false)
Resizes the bit vector to hold the given new number of bits.
A class that can be used to build a sparse matrix by adding value by value.
A class that holds a possibly non-square matrix in the compressed row storage format.
Stores valuations of variables for a set of entities (e.g.
Represents a model in the UMB format.
Definition UmbModel.h:21
TO1< bool > stateIsMarkovian
Definition UmbModel.h:29
void validateOrThrow() const
Validates the UmbModel.
Definition UmbModel.cpp:100
storm::OptionalRef< Annotation > rewards(bool createIfMissing=false)
Definition UmbModel.cpp:88
TO1< AnyValueType > branchToProbability
Definition UmbModel.h:35
std::optional< ActionLabels > choiceActions
Definition UmbModel.h:43
TO1< bool > stateIsInitial
Definition UmbModel.h:28
TO1< AnyValueType > stateToExitRate
Definition UmbModel.h:30
ModelIndex index
Definition UmbModel.h:24
TO1< uint32_t > stateToPlayer
Definition UmbModel.h:27
TO1< uint64_t > branchToTarget
Definition UmbModel.h:34
Valuations valuations
Definition UmbModel.h:77
std::optional< Observations > stateObservations
Definition UmbModel.h:51
storm::OptionalRef< Annotation > aps(bool createIfMissing=false)
Definition UmbModel.cpp:80
static auto applyDecodedVector(auto &&func, storm::umb::GenericVector const &input, storm::umb::SizedType const &sourceType)
returns func(<decoded_input>) where <decoded_input> is a range that (if necessary) decodes and conver...
static std::vector< ValueType > createDecodedVector(storm::umb::GenericVector const &input, storm::umb::SizedType const &sourceType)
#define STORM_LOG_WARN(message)
Definition logging.h:28
#define STORM_LOG_ASSERT(cond, message)
Definition macros.h:9
#define STORM_LOG_WARN_COND(cond, message)
Definition macros.h:36
#define STORM_LOG_THROW(cond, exception, message)
Definition macros.h:28
std::shared_ptr< storm::models::sparse::Model< ValueType > > constructSparseModel(storm::umb::UmbModel const &umbModel, ImportOptions const &options)
auto csrRange(auto &&csr, uint64_t i)
storm::models::sparse::StateLabeling constructStateLabeling(storm::umb::UmbModel const &umbModel)
auto constructRewardModels(storm::umb::UmbModel const &umbModel)
storm::storage::SparseMatrix< ValueType > createBranchMatrix(storm::umb::UmbModel const &umbModel, std::ranges::input_range auto &&branchValues)
storm::storage::SparseMatrix< ValueType > constructTransitionMatrix(storm::umb::UmbModel const &umbModel)
storm::storage::BitVector createBitVector(storm::umb::VectorType< bool > const &umbBitVector, uint64_t size)
storm::models::sparse::ChoiceLabeling constructChoiceLabeling(storm::umb::UmbModel const &umbModel)
Import and export of umb files.
std::optional< VectorType< T > > OptionalVectorType
Definition FileTypes.h:22
template std::shared_ptr< storm::models::sparse::Model< storm::RationalNumber > > sparseModelFromUmb< storm::RationalNumber >(storm::umb::UmbModel const &umbModel, ImportOptions const &options)
bool isNumericType(Type const type)
Definition Type.cpp:38
template std::shared_ptr< storm::models::sparse::Model< storm::Interval > > sparseModelFromUmb< storm::Interval >(storm::umb::UmbModel const &umbModel, ImportOptions const &options)
std::conditional_t< std::is_same_v< T, bool >, storm::storage::BitVector, std::vector< T > > VectorType
Definition FileTypes.h:19
bool deriveValueType(storm::umb::ModelIndex const &index, ImportOptions const &options)
Returns true iff the given umb model with the given options should have ValueType as its ValueType.
bool isBooleanType(Type const type)
Definition Type.cpp:8
std::shared_ptr< storm::models::sparse::Model< ValueType > > sparseModelFromUmb(storm::umb::UmbModel const &umbModel, ImportOptions const &options)
Constructs a sparse model from the given UMB model.
template std::shared_ptr< storm::models::sparse::Model< storm::RationalInterval > > sparseModelFromUmb< storm::RationalInterval >(storm::umb::UmbModel const &umbModel, ImportOptions const &options)
auto stringVectorView(SEQ< char >::value_type const &strings, CSR::value_type const &stringMapping)
template std::shared_ptr< storm::models::sparse::Model< double > > sparseModelFromUmb< double >(storm::umb::UmbModel const &umbModel, ImportOptions const &options)
@ RationalInterval
Definition Type.h:11
storm::models::ModelType deriveModelType(storm::umb::ModelIndex const &index)
Derives the model type from the given UMB model index.
std::shared_ptr< storm::models::sparse::Model< ValueType, RewardModelType > > buildModelFromComponents(storm::models::ModelType modelType, storm::storage::sparse::ModelComponents< ValueType, RewardModelType > &&components)
Definition builder.cpp:20
bool isOne(ValueType const &a)
Definition constants.cpp:37
ValueType abs(ValueType const &number)
ValueType zero()
Definition constants.cpp:24
ValueType one()
Definition constants.cpp:19
carl::Interval< double > Interval
Interval type.
constexpr bool IsIntervalType
Helper to check if a type is an interval.
typename detail::IntervalMetaProgrammingHelper< ValueType >::BaseType IntervalBaseType
Helper to access the type in which interval boundaries are stored.
static const bool IsExact
boost::optional< storm::storage::BitVector > markovianStates
boost::optional< std::vector< storm::storage::PlayerIndex > > statePlayerIndications
std::optional< storm::storage::sparse::Valuations > observationValuations
std::optional< storm::models::sparse::ChoiceLabeling > choiceLabeling
boost::optional< std::map< std::string, storm::storage::PlayerIndex > > playerNameToIndexMap
std::optional< storm::storage::sparse::Valuations > stateValuations
std::optional< std::vector< uint32_t > > observabilityClasses
boost::optional< std::vector< ValueType > > exitRates
bool buildChoiceLabeling
Controls building of choice labelings.
bool buildObservationValuations
Controls building of observation valuations.
bool buildStateValuations
Controls building of state valuations.
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
std::optional< SizedType > observationProbabilityType
Definition ModelIndex.h:58
storm::OptionalRef< AnnotationMap > rewards(bool createIfMissing=false)
struct storm::umb::ModelIndex::TransitionSystem transitionSystem
std::optional< Valuations > valuations
Definition ModelIndex.h:116
storm::OptionalRef< AnnotationMap > aps(bool createIfMissing=false)
std::optional< Values > observations
Definition UmbModel.h:55
std::optional< Values > states
Definition UmbModel.h:55