3#include <boost/algorithm/string/join.hpp>
4#include <boost/algorithm/string/split.hpp>
28template<
typename ValueType,
typename RewardModelType>
31 transitionMatrix(components.transitionMatrix),
32 stateLabeling(components.stateLabeling),
33 rewardModels(components.rewardModels),
34 choiceLabeling(components.choiceLabeling),
35 stateValuations(components.stateValuations),
36 choiceOrigins(components.choiceOrigins) {
37 assertValidityOfComponents(components);
40template<
typename ValueType,
typename RewardModelType>
43 transitionMatrix(
std::move(components.transitionMatrix)),
44 stateLabeling(
std::move(components.stateLabeling)),
45 rewardModels(
std::move(components.rewardModels)),
46 choiceLabeling(
std::move(components.choiceLabeling)),
47 stateValuations(
std::move(components.stateValuations)),
48 choiceOrigins(
std::move(components.choiceOrigins)) {
49 assertValidityOfComponents(components);
52template<
typename ValueType,
typename RewardModelType>
56 ValueType
const stochasticTolerance =
57 isExact() ? storm::utility::zero<ValueType>()
58 :
storm::utility::convertNumber<
ValueType>(
storm::settings::getModule<
storm::settings::modules::GeneralSettings>().getPrecision());
60 uint64_t stateCount = this->getNumberOfStates();
61 uint64_t choiceCount = this->getTransitionMatrix().getRowCount();
64 STORM_LOG_THROW(this->getTransitionMatrix().getColumnCount() == stateCount, storm::exceptions::IllegalArgumentException,
65 "Invalid column count of transition matrix.");
67 components.
rateTransitions || this->hasParameters() || this->hasUncertainty() || this->getTransitionMatrix().isProbabilistic(stochasticTolerance),
68 "The matrix is not probabilistic.");
69 if (this->hasUncertainty()) {
70 STORM_LOG_ASSERT(this->getTransitionMatrix().hasOnlyPositiveEntries(),
"Not all entries are (strictly) positive.");
72 STORM_LOG_THROW(this->getStateLabeling().getNumberOfItems() == stateCount, storm::exceptions::IllegalArgumentException,
73 "Invalid item count (" << this->getStateLabeling().getNumberOfItems() <<
") of state labeling (states: " << stateCount <<
").");
74 for (
auto const& rewardModel : this->getRewardModels()) {
75 STORM_LOG_THROW(!rewardModel.second.hasStateRewards() || rewardModel.second.getStateRewardVector().size() == stateCount,
76 storm::exceptions::IllegalArgumentException,
77 "Invalid size (" << rewardModel.second.getStateRewardVector().size() <<
") of state reward vector (states:" << stateCount <<
").");
79 !rewardModel.second.hasStateActionRewards() || rewardModel.second.getStateActionRewardVector().size() == choiceCount,
80 storm::exceptions::IllegalArgumentException,
81 "Invalid size (" << rewardModel.second.getStateActionRewardVector().size() <<
") of state action reward vector (expected:" << choiceCount <<
").");
83 !rewardModel.second.hasTransitionRewards() || rewardModel.second.getTransitionRewardMatrix().isSubmatrixOf(this->getTransitionMatrix()),
84 "The transition reward matrix is not a submatrix of the transition matrix, i.e. there are rewards for transitions that do not exist.");
87 !this->hasChoiceLabeling() || this->getChoiceLabeling().getNumberOfItems() == choiceCount, storm::exceptions::IllegalArgumentException,
88 "Invalid choice count of choice labeling (choices: " << choiceCount <<
" vs. labeling:" << this->getChoiceLabeling().getNumberOfItems() <<
").");
90 !this->hasStateValuations() || this->getStateValuations().getNumberOfStates() == stateCount, storm::exceptions::IllegalArgumentException,
91 "Invalid state count for state valuations (states: " << stateCount <<
" vs. valuations:" << this->getStateValuations().getNumberOfStates() <<
").");
93 !this->hasChoiceOrigins() || this->getChoiceOrigins()->getNumberOfChoices() == choiceCount, storm::exceptions::IllegalArgumentException,
94 "Invalid choice count for choice origins. (choices: " << choiceCount <<
" vs. origins:" << this->getChoiceOrigins()->getNumberOfChoices() <<
").");
98 STORM_LOG_THROW(this->getTransitionMatrix().hasTrivialRowGrouping(), storm::exceptions::IllegalArgumentException,
99 "Can not create deterministic model: Transition matrix has non-trivial row grouping.");
100 STORM_LOG_THROW(stateCount == this->getTransitionMatrix().getRowCount(), storm::exceptions::IllegalArgumentException,
101 "Can not create deterministic model: Number of rows of transition matrix does not match state count.");
102 STORM_LOG_THROW(stateCount == this->getTransitionMatrix().getColumnCount(), storm::exceptions::IllegalArgumentException,
103 "Can not create deterministic model: Number of columns of transition matrix does not match state count.");
107 STORM_LOG_THROW(stateCount == this->getTransitionMatrix().getRowGroupCount(), storm::exceptions::IllegalArgumentException,
108 "Can not create nondeterministic model: Number of row groups ("
109 << this->getTransitionMatrix().getRowGroupCount() <<
") of transition matrix does not match state count (" << stateCount <<
").");
110 STORM_LOG_THROW(stateCount == this->getTransitionMatrix().getColumnCount(), storm::exceptions::IllegalArgumentException,
111 "Can not create nondeterministic model: Number of columns of transition matrix does not match state count.");
115 "No player 1 matrix given for stochastic game.");
117 "Can not create stochastic game: There is a row in the p1 matrix with not exactly one entry.");
119 "Can not create stochastic game: Number of row groups of p1 matrix does not match state count.");
121 storm::exceptions::IllegalArgumentException,
122 "Can not create stochastic game: Number of row groups of p2 matrix does not match column count of p1 matrix.");
124 STORM_LOG_THROW(
false, storm::exceptions::IllegalArgumentException,
"Invalid model type.");
130 "Can not create continuous time model: no rates are given.");
132 "Size of exit rate vector does not match state count.");
134 "Can not create Markov Automaton: no Markovian states given.");
137 "Rates specified for discrete-time model. The rates will be ignored.");
140 "Markovian states given for a model that is not a Markov automaton (will be ignored).");
145 "Can not create stochastic multiplayer game: Missing player indications.");
149 "Size of state player indications (" << components.
statePlayerIndications->size() <<
") of SMG does not match state count (" << stateCount <<
").");
152 "statePlayerIndications given for a model that is not a stochastic multiplayer game (will be ignored).");
154 "playerNameToIndexMap given for a model that is not a stochastic multiplayer game (will be ignored).");
158template<
typename ValueType,
typename RewardModelType>
160 return this->getTransitionMatrix().
transpose(
true);
163template<
typename ValueType,
typename RewardModelType>
165 return this->getTransitionMatrix().getColumnCount();
168template<
typename ValueType,
typename RewardModelType>
170 return this->getTransitionMatrix().getNonzeroEntryCount();
173template<
typename ValueType,
typename RewardModelType>
175 return this->getTransitionMatrix().getRowCount();
178template<
typename ValueType,
typename RewardModelType>
180 return this->getStates(
"init");
183template<
typename ValueType,
typename RewardModelType>
185 return this->getStateLabeling().setStates(
"init", states);
188template<
typename ValueType,
typename RewardModelType>
190 return stateLabeling.getStates(label);
193template<
typename ValueType,
typename RewardModelType>
195 return stateLabeling.containsLabel(label);
198template<
typename ValueType,
typename RewardModelType>
200 return transitionMatrix;
203template<
typename ValueType,
typename RewardModelType>
205 return transitionMatrix;
208template<
typename ValueType,
typename RewardModelType>
210 return this->rewardModels.find(rewardModelName) != this->rewardModels.
end();
213template<
typename ValueType,
typename RewardModelType>
215 STORM_LOG_ASSERT(this->hasRewardModel(rewardModelName),
"Model has no reward model.");
216 return this->rewardModels.find(rewardModelName)->second;
219template<
typename ValueType,
typename RewardModelType>
221 auto it = this->rewardModels.find(rewardModelName);
222 if (it == this->rewardModels.end()) {
223 if (rewardModelName.empty()) {
224 if (this->hasUniqueRewardModel()) {
225 return this->getUniqueRewardModel();
228 "Unable to refer to default reward model, because there is no default model or it is not unique.");
231 STORM_LOG_THROW(
false, storm::exceptions::IllegalArgumentException,
"The requested reward model '" << rewardModelName <<
"' does not exist.");
237template<
typename ValueType,
typename RewardModelType>
239 auto it = this->rewardModels.find(rewardModelName);
240 if (it == this->rewardModels.end()) {
241 if (rewardModelName.empty()) {
242 if (this->hasUniqueRewardModel()) {
243 return this->getUniqueRewardModel();
246 "Unable to refer to default reward model, because there is no default model or it is not unique.");
249 STORM_LOG_THROW(
false, storm::exceptions::IllegalArgumentException,
"The requested reward model '" << rewardModelName <<
"' does not exist.");
255template<
typename ValueType,
typename RewardModelType>
257 if (this->hasRewardModel(rewardModelName)) {
258 STORM_LOG_THROW(!(this->hasRewardModel(rewardModelName)), storm::exceptions::IllegalArgumentException,
259 "A reward model with the given name '" << rewardModelName <<
"' already exists.");
261 STORM_LOG_ASSERT(newRewardModel.isCompatible(this->getNumberOfStates(), this->getTransitionMatrix().getRowCount()),
"New reward model is not compatible.");
262 this->rewardModels.emplace(rewardModelName, newRewardModel);
265template<
typename ValueType,
typename RewardModelType>
267 auto it = this->rewardModels.find(rewardModelName);
268 bool res = (it != this->rewardModels.end());
270 this->rewardModels.erase(it->first);
275template<
typename ValueType,
typename RewardModelType>
277 std::set<std::string> removedRewardModels;
278 for (
auto const& rewModel : this->getRewardModels()) {
279 if (keptRewardModels.find(rewModel.first) == keptRewardModels.end()) {
280 removedRewardModels.insert(rewModel.first);
283 for (
auto const& rewModelName : removedRewardModels) {
284 this->removeRewardModel(rewModelName);
288template<
typename ValueType,
typename RewardModelType>
290 return this->getNumberOfRewardModels() == 1;
293template<
typename ValueType,
typename RewardModelType>
295 STORM_LOG_THROW(this->getNumberOfRewardModels() == 1, storm::exceptions::IllegalFunctionCallException,
"The reward model is not unique.");
296 return this->rewardModels.begin()->first;
299template<
typename ValueType,
typename RewardModelType>
301 return !this->rewardModels.empty();
304template<
typename ValueType,
typename RewardModelType>
306 STORM_LOG_THROW(this->getNumberOfRewardModels() == 1, storm::exceptions::IllegalFunctionCallException,
"The reward model is not unique.");
307 return this->rewardModels.cbegin()->second;
310template<
typename ValueType,
typename RewardModelType>
312 STORM_LOG_THROW(this->getNumberOfRewardModels() == 1, storm::exceptions::IllegalFunctionCallException,
"The reward model is not unique.");
313 return this->rewardModels.begin()->second;
316template<
typename ValueType,
typename RewardModelType>
318 return this->rewardModels.size();
320template<
typename ValueType,
typename RewardModelType>
322 return stateLabeling;
325template<
typename ValueType,
typename RewardModelType>
327 return stateLabeling;
330template<
typename ValueType,
typename RewardModelType>
332 return static_cast<bool>(choiceLabeling);
335template<
typename ValueType,
typename RewardModelType>
337 return choiceLabeling.value();
340template<
typename ValueType,
typename RewardModelType>
342 return choiceLabeling;
345template<
typename ValueType,
typename RewardModelType>
347 return choiceLabeling;
350template<
typename ValueType,
typename RewardModelType>
352 return static_cast<bool>(stateValuations);
355template<
typename ValueType,
typename RewardModelType>
357 return stateValuations.value();
360template<
typename ValueType,
typename RewardModelType>
362 return stateValuations;
365template<
typename ValueType,
typename RewardModelType>
367 return stateValuations;
370template<
typename ValueType,
typename RewardModelType>
372 return static_cast<bool>(choiceOrigins);
375template<
typename ValueType,
typename RewardModelType>
377 return choiceOrigins.value();
380template<
typename ValueType,
typename RewardModelType>
382 return choiceOrigins;
385template<
typename ValueType,
typename RewardModelType>
387 return choiceOrigins;
390template<
typename ValueType,
typename RewardModelType>
392 this->printModelInformationHeaderToStream(out);
393 this->printModelInformationFooterToStream(out);
396template<
typename ValueType,
typename RewardModelType>
398 std::size_t seed = 0;
399 boost::hash_combine(seed, transitionMatrix.hash());
400 boost::hash_combine(seed, stateLabeling.hash());
401 for (
auto const& rewModel : rewardModels) {
402 boost::hash_combine(seed, rewModel.second.hash());
404 if (choiceLabeling) {
405 boost::hash_combine(seed, choiceLabeling->hash());
407 if (stateValuations) {
408 boost::hash_combine(seed, stateValuations->hash());
411 boost::hash_combine(seed, choiceOrigins.value()->hash());
416template<
typename ValueType,
typename RewardModelType>
418 out <<
"-------------------------------------------------------------- \n";
419 out <<
"Model type: \t" << this->getType() <<
" (sparse)\n";
420 out <<
"States: \t" << this->getNumberOfStates() <<
'\n';
421 out <<
"Transitions: \t" << this->getNumberOfTransitions() <<
'\n';
424template<
typename ValueType,
typename RewardModelType>
426 this->printRewardModelsInformationToStream(out);
427 out <<
"State Labels: \t";
428 this->getStateLabeling().printLabelingInformationToStream(out);
429 out <<
"Choice Labels: \t";
430 if (this->hasChoiceLabeling()) {
431 this->getChoiceLabeling().printLabelingInformationToStream(out);
435 out <<
"-------------------------------------------------------------- \n";
438template<
typename ValueType,
typename RewardModelType>
440 if (this->rewardModels.size()) {
441 std::vector<std::string> rewardModelNames;
442 std::for_each(this->rewardModels.cbegin(), this->rewardModels.cend(),
443 [&rewardModelNames](
typename std::pair<std::string, RewardModelType>
const& nameRewardModelPair) {
444 if (nameRewardModelPair.first.empty()) {
445 rewardModelNames.push_back(
"(default)");
447 rewardModelNames.push_back(nameRewardModelPair.first);
450 out <<
"Reward Models: " << boost::join(rewardModelNames,
", ") <<
'\n';
452 out <<
"Reward Models: none\n";
456template<
typename ValueType,
typename RewardModelType>
457void Model<ValueType, RewardModelType>::writeDotToStream(std::ostream& outStream,
size_t maxWidthLabel,
bool includeLabeling,
459 std::vector<ValueType>
const* secondValue, std::vector<uint_fast64_t>
const* stateColoring,
460 std::vector<std::string>
const* colors, std::vector<uint_fast64_t>*,
bool finalizeOutput)
const {
461 outStream <<
"digraph model {\n";
464 for (uint_fast64_t state = 0, highestStateIndex = this->getNumberOfStates() - 1; state <= highestStateIndex; ++state) {
465 if (subsystem ==
nullptr || subsystem->
get(state)) {
466 outStream <<
"\t" << state;
467 if (includeLabeling || firstValue !=
nullptr || secondValue !=
nullptr || stateColoring !=
nullptr || hasStateValuations()) {
471 if (includeLabeling || firstValue !=
nullptr || secondValue !=
nullptr || hasStateValuations()) {
472 outStream <<
"label = \"" << state;
473 if (hasStateValuations()) {
474 std::string stateInfo = getStateValuations().getStateInfo(state);
475 std::vector<std::string> results;
476 boost::split(results, stateInfo, [](
char c) {
return c ==
','; });
482 if (includeLabeling) {
488 outStream << this->additionalDotStateInfo(state);
491 if (firstValue !=
nullptr || secondValue !=
nullptr) {
493 if (firstValue !=
nullptr) {
494 outStream << (*firstValue)[state];
495 if (secondValue !=
nullptr) {
499 if (secondValue !=
nullptr) {
500 outStream << (*secondValue)[state];
507 if (stateColoring !=
nullptr && colors !=
nullptr) {
509 outStream <<
" style = filled, fillcolor = " << (*colors)[(*stateColoring)[state]];
519 if (finalizeOutput) {
524template<
typename ValueType,
typename RewardModelType>
526 STORM_LOG_WARN_COND(this->getNumberOfStates() < 10000 && this->getNumberOfTransitions() < 100000,
527 "Exporting a large model to json. This might take some time and will result in a very large file.");
528 using JsonValueType = storm::RationalNumber;
530 for (uint64_t state = 0; state < getNumberOfStates(); ++state) {
532 stateChoicesJson[
"id"] = state;
533 if (hasStateValuations()) {
534 stateChoicesJson[
"s"] = getStateValuations().template toJson<JsonValueType>(state);
536 auto labels = getLabelsOfState(state);
537 stateChoicesJson[
"lab"] = labels;
539 for (
auto const& rm : rewardModels) {
540 if (rm.second.hasStateRewards()) {
541 auto const& r = rm.second.getStateReward(state);
547 if (!stateRewardsJson.empty()) {
548 stateChoicesJson[
"rew"] = std::move(stateRewardsJson);
553 auto rateForProbabilityScaling = storm::utility::one<ValueType>();
555 auto const& ctmc = this->
template as<storm::models::sparse::Ctmc<ValueType, RewardModelType>>();
556 rateForProbabilityScaling = ctmc->getExitRateVector()[state];
559 auto const& ma = this->
template as<storm::models::sparse::MarkovAutomaton<ValueType, RewardModelType>>();
560 if (ma->isMarkovianState(state)) {
566 for (uint64_t choiceIndex = getTransitionMatrix().getRowGroupIndices()[state]; choiceIndex < getTransitionMatrix().getRowGroupIndices()[state + 1];
569 if (hasChoiceOrigins() && getChoiceOrigins()->getIdentifier(choiceIndex) != getChoiceOrigins()->getIdentifierForChoicesWithNoOrigin()) {
570 choiceJson[
"origin"] = getChoiceOrigins()->getChoiceAsJson(choiceIndex);
572 if (hasChoiceLabeling()) {
573 auto choiceLabels = getChoiceLabeling().getLabelsOfChoice(choiceIndex);
574 if (!choiceLabels.empty()) {
575 choiceJson[
"lab"] = choiceLabels;
578 choiceJson[
"id"] = choiceIndex;
580 for (
auto const& rm : rewardModels) {
581 if (rm.second.hasStateActionRewards()) {
582 auto r = rm.second.getStateActionReward(choiceIndex);
588 if (!choiceRewardsJson.empty()) {
589 choiceRewardsJson[
"rew"] = std::move(choiceRewardsJson);
592 for (
auto const& entry : transitionMatrix.getRow(choiceIndex)) {
594 successor[
"id"] = entry.getColumn();
595 successor[
"prob"] = storm::utility::to_string<ValueType>(entry.getValue() / rateForProbabilityScaling);
596 successors.push_back(successor);
598 choiceJson[
"succ"] = std::move(successors);
599 choicesJson.push_back(choiceJson);
601 stateChoicesJson[
"c"] = std::move(choicesJson);
602 output.push_back(std::move(stateChoicesJson));
609 STORM_LOG_THROW(
false, storm::exceptions::NotImplementedException,
"Json export not implemented for this model type.");
612template<
typename ValueType,
typename RewardModelType>
617template<
typename ValueType,
typename RewardModelType>
622template<
typename ValueType,
typename RewardModelType>
624 for (
auto const& entry : this->getTransitionMatrix().getRowGroup(state)) {
625 if (entry.getColumn() != state) {
635template<
typename ValueType,
typename RewardModelType>
640template<
typename ValueType,
typename RewardModelType>
642 return std::is_same<ValueType, storm::RationalFunction>::value;
645template<
typename ValueType,
typename RewardModelType>
647 return std::is_same<ValueType, storm::Interval>::value;
650template<
typename ValueType,
typename RewardModelType>
652 if (!this->supportsParameters()) {
656 for (
auto const& entry : this->getTransitionMatrix()) {
665template<
typename ValueType,
typename RewardModelType>
667 if (!this->supportsUncertainty()) {
671 for (
auto const& entry : this->getTransitionMatrix()) {
680template<
typename ValueType,
typename RewardModelType>
685template<
typename ValueType,
typename RewardModelType>
687 return this->rewardModels;
690template<
typename ValueType,
typename RewardModelType>
692 return this->rewardModels;
700 std::set<storm::RationalFunctionVariable> result;
703 result.insert(tmp.begin(), tmp.end());
710 auto const& ctmc = model.template as<storm::models::sparse::Ctmc<storm::RationalFunction>>();
713 auto const& ma = model.template as<storm::models::sparse::MarkovAutomaton<storm::RationalFunction>>();
723 parameters.insert(rewardParameters.begin(), rewardParameters.end());
725 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.
boost::optional< storm::storage::BitVector > markovianStates
boost::optional< std::vector< storm::storage::PlayerIndex > > statePlayerIndications
boost::optional< storm::storage::SparseMatrix< storm::storage::sparse::state_type > > player1Matrix
boost::optional< std::map< std::string, storm::storage::PlayerIndex > > playerNameToIndexMap
boost::optional< std::vector< ValueType > > exitRates