Storm
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
7
8namespace storm {
9namespace models {
10
11class ModelBase : public std::enable_shared_from_this<ModelBase> {
12 public:
18 ModelBase(ModelType const& modelType) : modelType(modelType) {
19 // Intentionally left empty.
20 }
21
22 /*
23 * Make destructor virtual to allow deleting objects through pointer to base classe(s).
24 */
25 virtual ~ModelBase() {
26 // Intentionally left empty.
27 }
28
35 template<typename ModelType>
36 std::shared_ptr<ModelType> as() {
37 return std::dynamic_pointer_cast<ModelType>(this->shared_from_this());
38 }
39
46 template<typename ModelType>
47 std::shared_ptr<ModelType const> as() const {
48 return std::dynamic_pointer_cast<ModelType const>(this->shared_from_this());
49 }
50
58 virtual ModelType getType() const;
59
65 virtual uint_fast64_t getNumberOfStates() const = 0;
66
72 virtual uint_fast64_t getNumberOfTransitions() const = 0;
73
79 virtual uint_fast64_t getNumberOfChoices() const = 0;
80
86 virtual void printModelInformationToStream(std::ostream& out) const = 0;
87
93 virtual bool isSparseModel() const;
94
100 virtual bool isSymbolicModel() const;
101
108 bool isOfType(storm::models::ModelType const& modelType) const;
109
115 bool isNondeterministicModel() const;
116
120 bool isDiscreteTimeModel() const;
121
127 virtual bool supportsParameters() const;
128
134 virtual bool hasParameters() const;
135
141 virtual bool isExact() const;
142
143 /*
144 * Checks whether the model is partially observable
145 */
146 virtual bool isPartiallyObservable() const;
147
154 virtual void reduceToStateBasedRewards() = 0;
155
161 virtual bool hasRewardModel(std::string const& rewardModelName) const = 0;
162
163 virtual bool hasUniqueRewardModel() const = 0;
164 virtual std::string const& getUniqueRewardModelName() const = 0;
165
166 private:
167 // The type of the model.
168 ModelType modelType;
169};
170
171} // namespace models
172} // namespace storm
173
174#endif /* STORM_MODELS_ABSTRACTMODEL_H_ */
ModelBase(ModelType const &modelType)
Constructs a model of the given type.
Definition ModelBase.h:18
virtual bool isExact() const
Checks whether the model is exact.
Definition ModelBase.cpp:54
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:23
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:33
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:50
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:36
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:47
bool isOfType(storm::models::ModelType const &modelType) const
Checks whether the model is of the given type.
Definition ModelBase.cpp:19
virtual bool isPartiallyObservable() const
Definition ModelBase.cpp:42
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:46
LabParser.cpp.
Definition cli.cpp:18