Storm 1.11.1.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ModelBase.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <optional>
5
8
9namespace storm {
10namespace models {
11
12class ModelBase : public std::enable_shared_from_this<ModelBase> {
13 public:
19 ModelBase(ModelType const& modelType) : modelType(modelType) {
20 // Intentionally left empty.
21 }
22
23 /*
24 * Make destructor virtual to allow deleting objects through pointer to base classe(s).
25 */
26 virtual ~ModelBase() {
27 // Intentionally left empty.
28 }
29
36 template<typename ModelType>
37 std::shared_ptr<ModelType> as() {
38 return std::dynamic_pointer_cast<ModelType>(this->shared_from_this());
39 }
40
47 template<typename ModelType>
48 std::shared_ptr<ModelType const> as() const {
49 return std::dynamic_pointer_cast<ModelType const>(this->shared_from_this());
50 }
51
59 virtual ModelType getType() const;
60
66 virtual uint_fast64_t getNumberOfStates() const = 0;
67
73 virtual uint_fast64_t getNumberOfTransitions() const = 0;
74
80 virtual uint_fast64_t getNumberOfChoices() const = 0;
81
87 virtual void printModelInformationToStream(std::ostream& out) const = 0;
88
94 virtual bool isSparseModel() const;
95
101 virtual bool isSymbolicModel() const;
102
106 virtual std::optional<storm::dd::DdType> getDdType() const;
107
114 virtual bool supportsUncertainty() const;
115
122 bool isOfType(storm::models::ModelType const& modelType) const;
123
129 bool isNondeterministicModel() const;
130
134 bool isDiscreteTimeModel() const;
135
141 virtual bool supportsParameters() const;
142
148 virtual bool hasParameters() const;
149
155 virtual bool isExact() const;
156
157 /*
158 * Checks whether the model is partially observable
159 */
160 virtual bool isPartiallyObservable() const;
161
168 virtual void reduceToStateBasedRewards() = 0;
169
175 virtual bool hasRewardModel(std::string const& rewardModelName) const = 0;
176
177 virtual bool hasUniqueRewardModel() const = 0;
178 virtual std::string const& getUniqueRewardModelName() const = 0;
179
180 private:
181 // The type of the model.
182 ModelType modelType;
183};
184
185} // namespace models
186} // namespace storm
ModelBase(ModelType const &modelType)
Constructs a model of the given type.
Definition ModelBase.h:19
virtual bool isExact() const
Checks whether the model is exact.
Definition ModelBase.cpp:62
virtual bool isSymbolicModel() const
Checks whether the model is a symbolic model.
Definition ModelBase.cpp:15
virtual std::string const & getUniqueRewardModelName() const =0
bool isNondeterministicModel() const
Returns true if the model is a nondeterministic model.
Definition ModelBase.cpp:31
virtual std::optional< storm::dd::DdType > getDdType() const
Definition ModelBase.cpp:19
virtual bool hasUniqueRewardModel() const =0
virtual uint_fast64_t getNumberOfStates() const =0
Returns the number of states of the model.
bool isDiscreteTimeModel() const
Returns true if the model is a descrete-time model.
Definition ModelBase.cpp:41
virtual uint_fast64_t getNumberOfChoices() const =0
Returns the number of choices ine the model.
virtual void reduceToStateBasedRewards()=0
Converts the transition rewards of all reward models to state-based rewards.
virtual bool hasParameters() const
Checks whether the model has parameters.
Definition ModelBase.cpp:58
virtual ModelType getType() const
Return the actual type of the model.
Definition ModelBase.cpp:7
virtual bool isSparseModel() const
Checks whether the model is a sparse model.
Definition ModelBase.cpp:11
virtual void printModelInformationToStream(std::ostream &out) const =0
Prints information about the model to the specified stream.
std::shared_ptr< ModelType > as()
Casts the model into the model type given by the template parameter.
Definition ModelBase.h:37
virtual bool hasRewardModel(std::string const &rewardModelName) const =0
Retrieves whether the model has a reward model with the given name.
std::shared_ptr< ModelType const > as() const
Casts the model into the model type given by the template parameter.
Definition ModelBase.h:48
bool isOfType(storm::models::ModelType const &modelType) const
Checks whether the model is of the given type.
Definition ModelBase.cpp:27
virtual bool isPartiallyObservable() const
Definition ModelBase.cpp:50
virtual bool supportsUncertainty() const
Does it support uncertainty (e.g., via interval-valued entries).
Definition ModelBase.cpp:23
virtual uint_fast64_t getNumberOfTransitions() const =0
Returns the number of (non-zero) transitions of the model.
virtual bool supportsParameters() const
Checks whether the model supports parameters.
Definition ModelBase.cpp:54