diff --git a/src/storm/models/sparse/Smg.cpp b/src/storm/models/sparse/Smg.cpp new file mode 100644 index 000000000..e0419844c --- /dev/null +++ b/src/storm/models/sparse/Smg.cpp @@ -0,0 +1,49 @@ +#include "storm/models/sparse/Smg.h" + +#include "storm/exceptions/InvalidArgumentException.h" +#include "storm/utility/constants.h" +#include "storm/utility/vector.h" +#include "storm/adapters/RationalFunctionAdapter.h" + +#include "storm/models/sparse/StandardRewardModel.h" + +namespace storm { + namespace models { + namespace sparse { + + template + Smg::Smg(storm::storage::SparseMatrix const& transitionMatrix, storm::models::sparse::StateLabeling const& stateLabeling, + std::unordered_map const& rewardModels, ModelType type) + : Smg(storm::storage::sparse::ModelComponents(transitionMatrix, stateLabeling, rewardModels), type) { + // Intentionally left empty + } + + template + Smg::Smg(storm::storage::SparseMatrix&& transitionMatrix, storm::models::sparse::StateLabeling&& stateLabeling, + std::unordered_map&& rewardModels, ModelType type) + : Smg(storm::storage::sparse::ModelComponents(std::move(transitionMatrix), std::move(stateLabeling), std::move(rewardModels)), type) { + // Intentionally left empty + } + + template + Smg::Smg(storm::storage::sparse::ModelComponents const& components, ModelType type) + : NondeterministicModel(type, components) { + assert(type == storm::models::ModelType::Smg); + // Intentionally left empty + } + + template + Smg::Smg(storm::storage::sparse::ModelComponents&& components, ModelType type) + : NondeterministicModel(type, std::move(components)) { + assert(type == storm::models::ModelType::Smg); + // Intentionally left empty + } + + template class Smg; + template class Smg; + + template class Smg>; + template class Smg; + } // namespace sparse + } // namespace models +} // namespace storm diff --git a/src/storm/models/sparse/Smg.h b/src/storm/models/sparse/Smg.h new file mode 100644 index 000000000..663817418 --- /dev/null +++ b/src/storm/models/sparse/Smg.h @@ -0,0 +1,57 @@ +#ifndef STORM_MODELS_SPARSE_SMG_H_ +#define STORM_MODELS_SPARSE_SMG_H_ + +#include "storm/models/sparse/NondeterministicModel.h" + +namespace storm { + namespace models { + namespace sparse { + + /*! + * This class represents a stochastic multiplayer game. + */ + template> + class Smg : public NondeterministicModel { + public: + /*! + * Constructs a model from the given data. + * + * @param transitionMatrix The matrix representing the transitions in the model. + * @param stateLabeling The labeling of the states. + * @param rewardModels A mapping of reward model names to reward models. + */ + Smg(storm::storage::SparseMatrix const& transitionMatrix, + storm::models::sparse::StateLabeling const& stateLabeling, + std::unordered_map const& rewardModels = std::unordered_map(), ModelType type = ModelType::Smg); + + /*! + * Constructs a model by moving the given data. + * + * @param transitionMatrix The matrix representing the transitions in the model. + * @param stateLabeling The labeling of the states. + * @param rewardModels A mapping of reward model names to reward models. + */ + Smg(storm::storage::SparseMatrix&& transitionMatrix, + storm::models::sparse::StateLabeling&& stateLabeling, + std::unordered_map&& rewardModels = std::unordered_map(), ModelType type = ModelType::Smg); + + /*! + * Constructs a model from the given data. + * + * @param components The components for this model. + */ + Smg(storm::storage::sparse::ModelComponents const& components, ModelType type = ModelType::Smg); + Smg(storm::storage::sparse::ModelComponents&& components, ModelType type = ModelType::Smg); + + Smg(Smg const& other) = default; + Smg& operator=(Smg const& other) = default; + + Smg(Smg&& other) = default; + Smg& operator=(Smg&& other) = default; + }; + + } // namespace sparse + } // namespace models +} // namespace storm + +#endif /* STORM_MODELS_SPARSE_SMG_H_ */