3#include <boost/algorithm/string/join.hpp>
4#include <boost/algorithm/string/split.hpp>
24template<
typename ValueType,
typename RewardModelType>
27 transitionMatrix(components.transitionMatrix),
28 stateLabeling(components.stateLabeling),
29 rewardModels(components.rewardModels),
30 choiceLabeling(components.choiceLabeling),
31 stateValuations(components.stateValuations),
32 choiceOrigins(components.choiceOrigins) {
33 assertValidityOfComponents(components);
36template<
typename ValueType,
typename RewardModelType>
39 transitionMatrix(
std::move(components.transitionMatrix)),
40 stateLabeling(
std::move(components.stateLabeling)),
41 rewardModels(
std::move(components.rewardModels)),
42 choiceLabeling(
std::move(components.choiceLabeling)),
43 stateValuations(
std::move(components.stateValuations)),
44 choiceOrigins(
std::move(components.choiceOrigins)) {
45 assertValidityOfComponents(components);
48template<
typename ValueType,
typename RewardModelType>
53 uint_fast64_t stateCount = this->getNumberOfStates();
54 uint_fast64_t choiceCount = this->getTransitionMatrix().getRowCount();
57 STORM_LOG_THROW(this->getTransitionMatrix().getColumnCount() == stateCount, storm::exceptions::IllegalArgumentException,
58 "Invalid column count of transition matrix.");
59 STORM_LOG_ASSERT(components.rateTransitions || this->hasParameters() || this->hasUncertainty() || this->getTransitionMatrix().isProbabilistic(),
60 "The matrix is not probabilistic.");
61 if (this->hasUncertainty()) {
62 STORM_LOG_ASSERT(this->getTransitionMatrix().hasOnlyPositiveEntries(),
"Not all entries are (strictly) positive.");
64 STORM_LOG_THROW(this->getStateLabeling().getNumberOfItems() == stateCount, storm::exceptions::IllegalArgumentException,
65 "Invalid item count (" << this->getStateLabeling().getNumberOfItems() <<
") of state labeling (states: " << stateCount <<
").");
66 for (
auto const& rewardModel : this->getRewardModels()) {
67 STORM_LOG_THROW(!rewardModel.second.hasStateRewards() || rewardModel.second.getStateRewardVector().size() == stateCount,
68 storm::exceptions::IllegalArgumentException,
69 "Invalid size (" << rewardModel.second.getStateRewardVector().size() <<
") of state reward vector (states:" << stateCount <<
").");
71 !rewardModel.second.hasStateActionRewards() || rewardModel.second.getStateActionRewardVector().size() == choiceCount,
72 storm::exceptions::IllegalArgumentException,
73 "Invalid size (" << rewardModel.second.getStateActionRewardVector().size() <<
") of state action reward vector (expected:" << choiceCount <<
").");
75 !rewardModel.second.hasTransitionRewards() || rewardModel.second.getTransitionRewardMatrix().isSubmatrixOf(this->getTransitionMatrix()),
76 "The transition reward matrix is not a submatrix of the transition matrix, i.e. there are rewards for transitions that do not exist.");
79 !this->hasChoiceLabeling() || this->getChoiceLabeling().getNumberOfItems() == choiceCount, storm::exceptions::IllegalArgumentException,
80 "Invalid choice count of choice labeling (choices: " << choiceCount <<
" vs. labeling:" << this->getChoiceLabeling().getNumberOfItems() <<
").");
82 !this->hasStateValuations() || this->getStateValuations().getNumberOfStates() == stateCount, storm::exceptions::IllegalArgumentException,
83 "Invalid state count for state valuations (states: " << stateCount <<
" vs. valuations:" << this->getStateValuations().getNumberOfStates() <<
").");
85 !this->hasChoiceOrigins() || this->getChoiceOrigins()->getNumberOfChoices() == choiceCount, storm::exceptions::IllegalArgumentException,
86 "Invalid choice count for choice origins. (choices: " << choiceCount <<
" vs. origins:" << this->getChoiceOrigins()->getNumberOfChoices() <<
").");
90 STORM_LOG_THROW(this->getTransitionMatrix().hasTrivialRowGrouping(), storm::exceptions::IllegalArgumentException,
91 "Can not create deterministic model: Transition matrix has non-trivial row grouping.");
92 STORM_LOG_THROW(stateCount == this->getTransitionMatrix().getRowCount(), storm::exceptions::IllegalArgumentException,
93 "Can not create deterministic model: Number of rows of transition matrix does not match state count.");
94 STORM_LOG_THROW(stateCount == this->getTransitionMatrix().getColumnCount(), storm::exceptions::IllegalArgumentException,
95 "Can not create deterministic model: Number of columns of transition matrix does not match state count.");
96 STORM_LOG_ERROR_COND(!components.player1Matrix.is_initialized(),
"Player 1 matrix given for a model that is no stochastic game (will be ignored).");
99 STORM_LOG_THROW(stateCount == this->getTransitionMatrix().getRowGroupCount(), storm::exceptions::IllegalArgumentException,
100 "Can not create nondeterministic model: Number of row groups ("
101 << this->getTransitionMatrix().getRowGroupCount() <<
") of transition matrix does not match state count (" << stateCount <<
").");
102 STORM_LOG_THROW(stateCount == this->getTransitionMatrix().getColumnCount(), storm::exceptions::IllegalArgumentException,
103 "Can not create nondeterministic model: Number of columns of transition matrix does not match state count.");
104 STORM_LOG_ERROR_COND(!components.player1Matrix.is_initialized(),
"Player 1 matrix given for a model that is no stochastic game (will be ignored).");
106 STORM_LOG_THROW(components.player1Matrix.is_initialized(), storm::exceptions::IllegalArgumentException,
107 "No player 1 matrix given for stochastic game.");
109 "Can not create stochastic game: There is a row in the p1 matrix with not exactly one entry.");
110 STORM_LOG_THROW(stateCount == components.player1Matrix->getRowGroupCount(), storm::exceptions::IllegalArgumentException,
111 "Can not create stochastic game: Number of row groups of p1 matrix does not match state count.");
112 STORM_LOG_THROW(this->getTransitionMatrix().getRowGroupCount() == components.player1Matrix->getColumnCount(),
113 storm::exceptions::IllegalArgumentException,
114 "Can not create stochastic game: Number of row groups of p2 matrix does not match column count of p1 matrix.");
116 STORM_LOG_THROW(
false, storm::exceptions::IllegalArgumentException,
"Invalid model type.");
121 STORM_LOG_THROW(components.rateTransitions || components.exitRates.is_initialized(), storm::exceptions::IllegalArgumentException,
122 "Can not create continuous time model: no rates are given.");
123 STORM_LOG_THROW(!components.exitRates.is_initialized() || components.exitRates->size() == stateCount, storm::exceptions::IllegalArgumentException,
124 "Size of exit rate vector does not match state count.");
126 "Can not create Markov Automaton: no Markovian states given.");
129 "Rates specified for discrete-time model. The rates will be ignored.");
132 "Markovian states given for a model that is not a Markov automaton (will be ignored).");
136 STORM_LOG_THROW(components.statePlayerIndications.is_initialized(), storm::exceptions::IllegalArgumentException,
137 "Can not create stochastic multiplayer game: Missing player indications.");
140 stateCount == components.statePlayerIndications->size(), storm::exceptions::IllegalArgumentException,
141 "Size of state player indications (" << components.statePlayerIndications->size() <<
") of SMG does not match state count (" << stateCount <<
").");
144 "statePlayerIndications given for a model that is not a stochastic multiplayer game (will be ignored).");
146 "playerNameToIndexMap given for a model that is not a stochastic multiplayer game (will be ignored).");
150template<
typename ValueType,
typename RewardModelType>
152 return this->getTransitionMatrix().
transpose(
true);
155template<
typename ValueType,
typename RewardModelType>
157 return this->getTransitionMatrix().getColumnCount();
160template<
typename ValueType,
typename RewardModelType>
162 return this->getTransitionMatrix().getNonzeroEntryCount();
165template<
typename ValueType,
typename RewardModelType>
167 return this->getTransitionMatrix().getRowCount();
170template<
typename ValueType,
typename RewardModelType>
172 return this->getStates(
"init");
175template<
typename ValueType,
typename RewardModelType>
177 return this->getStateLabeling().setStates(
"init", states);
180template<
typename ValueType,
typename RewardModelType>
182 return stateLabeling.getStates(label);
185template<
typename ValueType,
typename RewardModelType>
187 return stateLabeling.containsLabel(label);
190template<
typename ValueType,
typename RewardModelType>
192 return transitionMatrix;
195template<
typename ValueType,
typename RewardModelType>
197 return transitionMatrix;
200template<
typename ValueType,
typename RewardModelType>
202 return this->rewardModels.find(rewardModelName) != this->rewardModels.
end();
205template<
typename ValueType,
typename RewardModelType>
208 return this->rewardModels.find(rewardModelName)->second;
211template<
typename ValueType,
typename RewardModelType>
213 auto it = this->rewardModels.find(rewardModelName);
214 if (it == this->rewardModels.end()) {
215 if (rewardModelName.empty()) {
216 if (this->hasUniqueRewardModel()) {
217 return this->getUniqueRewardModel();
220 "Unable to refer to default reward model, because there is no default model or it is not unique.");
223 STORM_LOG_THROW(
false, storm::exceptions::IllegalArgumentException,
"The requested reward model '" << rewardModelName <<
"' does not exist.");
229template<
typename ValueType,
typename RewardModelType>
231 auto it = this->rewardModels.find(rewardModelName);
232 if (it == this->rewardModels.end()) {
233 if (rewardModelName.empty()) {
234 if (this->hasUniqueRewardModel()) {
235 return this->getUniqueRewardModel();
238 "Unable to refer to default reward model, because there is no default model or it is not unique.");
241 STORM_LOG_THROW(
false, storm::exceptions::IllegalArgumentException,
"The requested reward model '" << rewardModelName <<
"' does not exist.");
247template<
typename ValueType,
typename RewardModelType>
249 if (this->hasRewardModel(rewardModelName)) {
250 STORM_LOG_THROW(!(this->hasRewardModel(rewardModelName)), storm::exceptions::IllegalArgumentException,
251 "A reward model with the given name '" << rewardModelName <<
"' already exists.");
253 STORM_LOG_ASSERT(newRewardModel.isCompatible(this->getNumberOfStates(), this->getTransitionMatrix().getRowCount()),
"New reward model is not compatible.");
254 this->rewardModels.emplace(rewardModelName, newRewardModel);
257template<
typename ValueType,
typename RewardModelType>
259 auto it = this->rewardModels.find(rewardModelName);
260 bool res = (it != this->rewardModels.end());
262 this->rewardModels.erase(it->first);
267template<
typename ValueType,
typename RewardModelType>
269 std::set<std::string> removedRewardModels;
270 for (
auto const& rewModel : this->getRewardModels()) {
271 if (keptRewardModels.find(rewModel.first) == keptRewardModels.end()) {
272 removedRewardModels.insert(rewModel.first);
275 for (
auto const& rewModelName : removedRewardModels) {
276 this->removeRewardModel(rewModelName);
280template<
typename ValueType,
typename RewardModelType>
282 return this->getNumberOfRewardModels() == 1;
285template<
typename ValueType,
typename RewardModelType>
287 STORM_LOG_THROW(this->getNumberOfRewardModels() == 1, storm::exceptions::IllegalFunctionCallException,
"The reward model is not unique.");
288 return this->rewardModels.begin()->first;
291template<
typename ValueType,
typename RewardModelType>
293 return !this->rewardModels.empty();
296template<
typename ValueType,
typename RewardModelType>
298 STORM_LOG_THROW(this->getNumberOfRewardModels() == 1, storm::exceptions::IllegalFunctionCallException,
"The reward model is not unique.");
299 return this->rewardModels.cbegin()->second;
302template<
typename ValueType,
typename RewardModelType>
304 STORM_LOG_THROW(this->getNumberOfRewardModels() == 1, storm::exceptions::IllegalFunctionCallException,
"The reward model is not unique.");
305 return this->rewardModels.begin()->second;
308template<
typename ValueType,
typename RewardModelType>
310 return this->rewardModels.size();
312template<
typename ValueType,
typename RewardModelType>
314 return stateLabeling;
317template<
typename ValueType,
typename RewardModelType>
319 return stateLabeling;
322template<
typename ValueType,
typename RewardModelType>
324 return static_cast<bool>(choiceLabeling);
327template<
typename ValueType,
typename RewardModelType>
329 return choiceLabeling.value();
332template<
typename ValueType,
typename RewardModelType>
334 return choiceLabeling;
337template<
typename ValueType,
typename RewardModelType>
339 return choiceLabeling;
342template<
typename ValueType,
typename RewardModelType>
344 return static_cast<bool>(stateValuations);
347template<
typename ValueType,
typename RewardModelType>
349 return stateValuations.value();
352template<
typename ValueType,
typename RewardModelType>
354 return stateValuations;
357template<
typename ValueType,
typename RewardModelType>
359 return stateValuations;
362template<
typename ValueType,
typename RewardModelType>
364 return static_cast<bool>(choiceOrigins);
367template<
typename ValueType,
typename RewardModelType>
369 return choiceOrigins.value();
372template<
typename ValueType,
typename RewardModelType>
374 return choiceOrigins;
377template<
typename ValueType,
typename RewardModelType>
379 return choiceOrigins;
382template<
typename ValueType,
typename RewardModelType>
384 this->printModelInformationHeaderToStream(out);
385 this->printModelInformationFooterToStream(out);
388template<
typename ValueType,
typename RewardModelType>
390 std::size_t seed = 0;
391 boost::hash_combine(seed, transitionMatrix.hash());
392 boost::hash_combine(seed, stateLabeling.hash());
393 for (
auto const& rewModel : rewardModels) {
394 boost::hash_combine(seed, rewModel.second.hash());
396 if (choiceLabeling) {
397 boost::hash_combine(seed, choiceLabeling->hash());
399 if (stateValuations) {
400 boost::hash_combine(seed, stateValuations->hash());
403 boost::hash_combine(seed, choiceOrigins.value()->hash());
408template<
typename ValueType,
typename RewardModelType>
410 out <<
"-------------------------------------------------------------- \n";
411 out <<
"Model type: \t" << this->getType() <<
" (sparse)\n";
412 out <<
"States: \t" << this->getNumberOfStates() <<
'\n';
413 out <<
"Transitions: \t" << this->getNumberOfTransitions() <<
'\n';
416template<
typename ValueType,
typename RewardModelType>
418 this->printRewardModelsInformationToStream(out);
419 out <<
"State Labels: \t";
420 this->getStateLabeling().printLabelingInformationToStream(out);
421 out <<
"Choice Labels: \t";
422 if (this->hasChoiceLabeling()) {
423 this->getChoiceLabeling().printLabelingInformationToStream(out);
427 out <<
"-------------------------------------------------------------- \n";
430template<
typename ValueType,
typename RewardModelType>
432 if (this->rewardModels.size()) {
433 std::vector<std::string> rewardModelNames;
434 std::for_each(this->rewardModels.cbegin(), this->rewardModels.cend(),
435 [&rewardModelNames](
typename std::pair<std::string, RewardModelType>
const& nameRewardModelPair) {
436 if (nameRewardModelPair.first.empty()) {
437 rewardModelNames.push_back(
"(default)");
439 rewardModelNames.push_back(nameRewardModelPair.first);
442 out <<
"Reward Models: " << boost::join(rewardModelNames,
", ") <<
'\n';
444 out <<
"Reward Models: none\n";
448template<
typename ValueType,
typename RewardModelType>
449void Model<ValueType, RewardModelType>::writeDotToStream(std::ostream& outStream,
size_t maxWidthLabel,
bool includeLabeling,
451 std::vector<ValueType>
const* secondValue, std::vector<uint_fast64_t>
const* stateColoring,
452 std::vector<std::string>
const* colors, std::vector<uint_fast64_t>*,
bool finalizeOutput)
const {
453 outStream <<
"digraph model {\n";
456 for (uint_fast64_t state = 0, highestStateIndex = this->getNumberOfStates() - 1; state <= highestStateIndex; ++state) {
457 if (subsystem ==
nullptr || subsystem->
get(state)) {
458 outStream <<
"\t" << state;
459 if (includeLabeling || firstValue !=
nullptr || secondValue !=
nullptr || stateColoring !=
nullptr || hasStateValuations()) {
463 if (includeLabeling || firstValue !=
nullptr || secondValue !=
nullptr || hasStateValuations()) {
464 outStream <<
"label = \"" << state;
465 if (hasStateValuations()) {
466 std::string stateInfo = getStateValuations().getStateInfo(state);
467 std::vector<std::string> results;
468 boost::split(results, stateInfo, [](
char c) {
return c ==
','; });
474 if (includeLabeling) {
480 outStream << this->additionalDotStateInfo(state);
483 if (firstValue !=
nullptr || secondValue !=
nullptr) {
485 if (firstValue !=
nullptr) {
486 outStream << (*firstValue)[state];
487 if (secondValue !=
nullptr) {
491 if (secondValue !=
nullptr) {
492 outStream << (*secondValue)[state];
499 if (stateColoring !=
nullptr && colors !=
nullptr) {
501 outStream <<
" style = filled, fillcolor = " << (*colors)[(*stateColoring)[state]];
511 if (finalizeOutput) {
516template<
typename ValueType,
typename RewardModelType>
518 STORM_LOG_WARN_COND(this->getNumberOfStates() < 10000 && this->getNumberOfTransitions() < 100000,
519 "Exporting a large model to json. This might take some time and will result in a very large file.");
520 using JsonValueType = storm::RationalNumber;
522 for (uint64_t state = 0; state < getNumberOfStates(); ++state) {
524 stateChoicesJson[
"id"] = state;
525 if (hasStateValuations()) {
526 stateChoicesJson[
"s"] = getStateValuations().template toJson<JsonValueType>(state);
528 auto labels = getLabelsOfState(state);
529 stateChoicesJson[
"lab"] = labels;
531 for (
auto const& rm : rewardModels) {
532 if (rm.second.hasStateRewards()) {
533 auto const& r = rm.second.getStateReward(state);
539 if (!stateRewardsJson.empty()) {
540 stateChoicesJson[
"rew"] = std::move(stateRewardsJson);
545 auto rateForProbabilityScaling = storm::utility::one<ValueType>();
547 auto const& ctmc = this->
template as<storm::models::sparse::Ctmc<ValueType, RewardModelType>>();
548 rateForProbabilityScaling = ctmc->getExitRateVector()[state];
551 auto const& ma = this->
template as<storm::models::sparse::MarkovAutomaton<ValueType, RewardModelType>>();
552 if (ma->isMarkovianState(state)) {
558 for (uint64_t choiceIndex = getTransitionMatrix().getRowGroupIndices()[state]; choiceIndex < getTransitionMatrix().getRowGroupIndices()[state + 1];
561 if (hasChoiceOrigins() && getChoiceOrigins()->getIdentifier(choiceIndex) != getChoiceOrigins()->getIdentifierForChoicesWithNoOrigin()) {
562 choiceJson[
"origin"] = getChoiceOrigins()->getChoiceAsJson(choiceIndex);
564 if (hasChoiceLabeling()) {
565 auto choiceLabels = getChoiceLabeling().getLabelsOfChoice(choiceIndex);
566 if (!choiceLabels.empty()) {
567 choiceJson[
"lab"] = choiceLabels;
570 choiceJson[
"id"] = choiceIndex;
572 for (
auto const& rm : rewardModels) {
573 if (rm.second.hasStateActionRewards()) {
574 auto r = rm.second.getStateActionReward(choiceIndex);
580 if (!choiceRewardsJson.empty()) {
581 choiceRewardsJson[
"rew"] = std::move(choiceRewardsJson);
584 for (
auto const& entry : transitionMatrix.getRow(choiceIndex)) {
586 successor[
"id"] = entry.getColumn();
587 successor[
"prob"] = storm::utility::to_string<ValueType>(entry.getValue() / rateForProbabilityScaling);
588 successors.push_back(successor);
590 choiceJson[
"succ"] = std::move(successors);
591 choicesJson.push_back(choiceJson);
593 stateChoicesJson[
"c"] = std::move(choicesJson);
594 output.push_back(std::move(stateChoicesJson));
601 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Json export not implemented for this model type.");
604template<
typename ValueType,
typename RewardModelType>
609template<
typename ValueType,
typename RewardModelType>
614template<
typename ValueType,
typename RewardModelType>
616 for (
auto const& entry : this->getTransitionMatrix().getRowGroup(state)) {
617 if (entry.getColumn() != state) {
627template<
typename ValueType,
typename RewardModelType>
632template<
typename ValueType,
typename RewardModelType>
634 return std::is_same<ValueType, storm::RationalFunction>::value;
637template<
typename ValueType,
typename RewardModelType>
639 return std::is_same<ValueType, storm::Interval>::value;
642template<
typename ValueType,
typename RewardModelType>
644 if (!this->supportsParameters()) {
648 for (
auto const& entry : this->getTransitionMatrix()) {
657template<
typename ValueType,
typename RewardModelType>
659 if (!this->supportsUncertainty()) {
663 for (
auto const& entry : this->getTransitionMatrix()) {
672template<
typename ValueType,
typename RewardModelType>
677template<
typename ValueType,
typename RewardModelType>
679 return this->rewardModels;
682template<
typename ValueType,
typename RewardModelType>
684 return this->rewardModels;
692 std::set<storm::RationalFunctionVariable> result;
695 result.insert(tmp.begin(), tmp.end());
702 auto const& ctmc = model.template as<storm::models::sparse::Ctmc<storm::RationalFunction>>();
705 auto const& ma = model.template as<storm::models::sparse::MarkovAutomaton<storm::RationalFunction>>();
715 parameters.insert(rewardParameters.begin(), rewardParameters.end());
717 parameters.insert(rateParameters.begin(), rateParameters.end());
virtual bool isExact() const
Checks whether the model is exact.
virtual bool hasParameters() const
Checks whether the model has parameters.
virtual bool isSparseModel() const
Checks whether the model is a sparse model.
bool isOfType(storm::models::ModelType const &modelType) const
Checks whether the model is of the given type.
virtual bool supportsUncertainty() const
Does it support uncertainty (e.g., via interval-valued entries).
virtual bool supportsParameters() const
Checks whether the model supports parameters.
This class manages the labeling of the choice space with a number of (atomic) labels.
Base class for all sparse models.
storm::models::sparse::ChoiceLabeling const & getChoiceLabeling() const
Retrieves the labels for the choices of the model.
RewardModelType const & getUniqueRewardModel() const
Retrieves the unique reward model, if there exists exactly one.
bool hasRewardModel() const
Retrieves whether the model has at least one reward model.
storm::storage::SparseMatrix< ValueType > const & getTransitionMatrix() const
Retrieves the matrix representing the transitions of the model.
virtual std::size_t hash() const
Model(Model< ValueType, RewardModelType > const &other)=default
void setInitialStates(storm::storage::BitVector const &states)
Overwrites the initial states of the model.
void printModelInformationFooterToStream(std::ostream &out) const
Prints the information footer (reward models, labels and size in memory) of the model to the specifie...
virtual void printModelInformationToStream(std::ostream &out) const override
Prints information about the model to the specified stream.
std::unordered_map< std::string, RewardModelType > const & getRewardModels() const
Retrieves the reward models.
void restrictRewardModels(std::set< std::string > const &keptRewardModels)
Removes all reward models whose name is not in the given set.
bool hasStateValuations() const
Retrieves whether this model was build with state valuations.
storm::storage::BitVector const & getStates(std::string const &label) const
Returns the sets of states labeled with the given label.
bool removeRewardModel(std::string const &rewardModelName)
Removes the reward model with the given name from the model.
void printRewardModelsInformationToStream(std::ostream &out) const
Prints information about the reward models to the specified stream.
std::set< std::string > getLabelsOfState(storm::storage::sparse::state_type state) const
Retrieves the set of labels attached to the given state.
std::optional< std::shared_ptr< storm::storage::sparse::ChoiceOrigins > > const & getOptionalChoiceOrigins() const
Retrieves an optional value that contains the choice origins if there are some.
RewardModelType & rewardModel(std::string const &rewardModelName)
virtual uint_fast64_t getNumberOfChoices() const override
Returns the number of choices ine the model.
storm::storage::sparse::StateValuations const & getStateValuations() const
Retrieves the valuations of the states of the model.
void addRewardModel(std::string const &rewardModelName, RewardModelType const &rewModel)
Adds a reward model to the model.
std::shared_ptr< storm::storage::sparse::ChoiceOrigins > const & getChoiceOrigins() const
Retrieves the origins of the choices of the model.
storm::storage::SparseMatrix< ValueType > getBackwardTransitions() const
Retrieves the backward transition relation of the model, i.e.
bool hasChoiceLabeling() const
Retrieves whether this model has a labeling of the choices.
uint_fast64_t getNumberOfRewardModels() const
Retrieves the number of reward models associated with this model.
storm::models::sparse::StateLabeling const & getStateLabeling() const
Returns the state labeling associated with this model.
void printModelInformationHeaderToStream(std::ostream &out) const
Prints the information header (number of states and transitions) of the model to the specified stream...
std::optional< storm::models::sparse::ChoiceLabeling > const & getOptionalChoiceLabeling() const
Retrieves an optional value that contains the choice labeling if there is one.
CRewardModelType RewardModelType
virtual bool hasUniqueRewardModel() const override
Retrieves whether the model has a unique reward model.
std::optional< storm::storage::sparse::StateValuations > const & getOptionalStateValuations() const
Retrieves an optional value that contains the state valuations if there are some.
virtual uint_fast64_t getNumberOfTransitions() const override
Returns the number of (non-zero) transitions of the model.
bool hasChoiceOrigins() const
Retrieves whether this model was build with choice origins.
virtual uint_fast64_t getNumberOfStates() const override
Returns the number of states of the model.
bool hasLabel(std::string const &label) const
Retrieves whether the given label is a valid label in this model.
RewardModelType const & getRewardModel(std::string const &rewardModelName) const
Retrieves the reward model with the given name, if one exists.
virtual std::string const & getUniqueRewardModelName() const override
Retrieves the name of the unique reward model, if there exists exactly one.
storm::storage::BitVector const & getInitialStates() const
Retrieves the initial states of the model.
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.
bool get(uint64_t index) const
Retrieves the truth value of the bit at the given index and performs a bound check.
A class that holds a possibly non-square matrix in the compressed row storage format.
const_iterator end(index_type row) const
Retrieves an iterator that points past the end of the given row.
storm::storage::SparseMatrix< value_type > transpose(bool joinGroups=false, bool keepZeros=false) const
Transposes the matrix.
#define STORM_LOG_ASSERT(cond, message)
#define STORM_LOG_WARN_COND(cond, message)
#define STORM_LOG_ERROR_COND(cond, message)
#define STORM_LOG_THROW(cond, exception, message)
void outputFixedWidth(std::ostream &stream, Container const &output, size_t maxWidth=30)
Output list of strings with linebreaks according to fixed width.
std::set< storm::RationalFunctionVariable > getRateParameters(Model< storm::RationalFunction > const &model)
Get all parameters occurring in rates.
std::set< storm::RationalFunctionVariable > getRewardParameters(Model< storm::RationalFunction > const &model)
Get all parameters occurring in rewards.
std::set< storm::RationalFunctionVariable > getRewardModelParameters(StandardRewardModel< storm::RationalFunction > const &rewModel)
std::set< storm::RationalFunctionVariable > getProbabilityParameters(Model< storm::RationalFunction > const &model)
Get all probability parameters occurring on transitions.
std::set< storm::RationalFunctionVariable > getAllParameters(Model< storm::RationalFunction > const &model)
Get all parameters (probability, rewards, and rates) occurring in the model.
std::set< storm::RationalFunctionVariable > getVariables(SparseMatrix< storm::RationalFunction > const &matrix)
std::set< storm::RationalFunctionVariable > getVariables(std::vector< storm::RationalFunction > const &vector)
bool isOne(ValueType const &a)
bool isConstant(ValueType const &)
bool isZero(ValueType const &a)
std::string to_string(ValueType const &value)
nlohmann::basic_json< std::map, std::vector, std::string, bool, int64_t, uint64_t, ValueType > json
std::string dumpJson(storm::json< ValueType > const &j, bool compact)
Dumps the given json object, producing a String.