Storm 1.10.0.1
A Modern Probabilistic Model Checker
Loading...
Searching...
No Matches
ModelBase.h
Go to the documentation of this file.
1#ifndef STORM_MODELS_ABSTRACTMODEL_H_
2#define STORM_MODELS_ABSTRACTMODEL_H_
3
4#include <memory>
5#include <optional>
6
9
10namespace storm {
11namespace models {
12
13class ModelBase : public std::enable_shared_from_this<ModelBase> {
14 public:
20 ModelBase(ModelType const& modelType) : modelType(modelType) {
21 // Intentionally left empty.
22 }
23
24 /*
25 * Make destructor virtual to allow deleting objects through pointer to base classe(s).
26 */
27 virtual ~ModelBase() {
28 // Intentionally left empty.
29 }
30
37 template<typename ModelType>
38 std::shared_ptr<ModelType> as() {
39 return std::dynamic_pointer_cast<ModelType>(this->shared_from_this());
40 }
41
48 template<typename ModelType>
49 std::shared_ptr<ModelType const> as() const {
50 return std::dynamic_pointer_cast<ModelType const>(this->shared_from_this());
51 }
52
60 virtual ModelType getType() const;
61
67 virtual uint_fast64_t getNumberOfStates() const = 0;
68
74 virtual uint_fast64_t getNumberOfTransitions() const = 0;
75
81 virtual uint_fast64_t getNumberOfChoices() const = 0;
82
88 virtual void printModelInformationToStream(std::ostream& out) const = 0;
89
95 virtual bool isSparseModel() const;
96
102 virtual bool isSymbolicModel() const;
103
107 virtual std::optional<storm::dd::DdType> getDdType() const;
108
115 virtual bool supportsUncertainty() const;
116
123 bool isOfType(storm::models::ModelType const& modelType) const;
124
130 bool isNondeterministicModel() const;
131
135 bool isDiscreteTimeModel() const;
136
142 virtual bool supportsParameters() const;
143
149 virtual bool hasParameters() const;
150
156 virtual bool isExact() const;
157
158 /*
159 * Checks whether the model is partially observable
160 */
161 virtual bool isPartiallyObservable() const;
162
169 virtual void reduceToStateBasedRewards() = 0;
170
176 virtual bool hasRewardModel(std::string const& rewardModelName) const = 0;
177
178 virtual bool hasUniqueRewardModel() const = 0;
179 virtual std::string const& getUniqueRewardModelName() const = 0;
180
181 private:
182 // The type of the model.
183 ModelType modelType;
184};
185
186} // namespace models
187} // namespace storm
188
189#endif /* STORM_MODELS_ABSTRACTMODEL_H_ */
ModelBase(ModelType const &modelType)
Constructs a model of the given type.
Definition ModelBase.h:20
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:38
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:49
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
LabParser.cpp.