You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.2 KiB

  1. /*
  2. * Ctmc.h
  3. *
  4. * Created on: 14.11.2012
  5. * Author: Christian Dehnert
  6. */
  7. #ifndef STORM_MODELS_CTMC_H_
  8. #define STORM_MODELS_CTMC_H_
  9. #include <memory>
  10. #include <vector>
  11. #include "AbstractDeterministicModel.h"
  12. #include "AtomicPropositionsLabeling.h"
  13. #include "src/storage/SparseMatrix.h"
  14. namespace storm {
  15. namespace models {
  16. /*!
  17. * This class represents a continuous-time Markov chain (CTMC) whose states are
  18. * labeled with atomic propositions.
  19. */
  20. template <class T>
  21. class Ctmc : public storm::models::AbstractDeterministicModel<T> {
  22. public:
  23. /*!
  24. * Constructs a CTMC object from the given transition rate matrix and
  25. * the given labeling of the states.
  26. * @param rateMatrix The transition rate function of the
  27. * CTMC given by a matrix.
  28. * @param stateLabeling The labeling that assigns a set of atomic
  29. * propositions to each state.
  30. */
  31. Ctmc(storm::storage::SparseMatrix<T> const& rateMatrix, storm::models::AtomicPropositionsLabeling const& stateLabeling,
  32. boost::optional<std::vector<T>> const& optionalStateRewardVector, boost::optional<storm::storage::SparseMatrix<T>> const& optionalTransitionRewardMatrix,
  33. boost::optional<std::vector<std::list<uint_fast64_t>>> const& optionalChoiceLabeling)
  34. : AbstractDeterministicModel<T>(rateMatrix, stateLabeling, optionalStateRewardVector, optionalTransitionRewardMatrix, optionalChoiceLabeling) {
  35. // Intentionally left empty.
  36. }
  37. /*!
  38. * Constructs a CTMC object from the given transition rate matrix and
  39. * the given labeling of the states.
  40. * @param rateMatrix The transition rate function of the
  41. * CTMC given by a matrix.
  42. * @param stateLabeling The labeling that assigns a set of atomic
  43. * propositions to each state.
  44. */
  45. Ctmc(storm::storage::SparseMatrix<T>&& rateMatrix, storm::models::AtomicPropositionsLabeling&& stateLabeling,
  46. boost::optional<std::vector<T>>&& optionalStateRewardVector, boost::optional<storm::storage::SparseMatrix<T>>&& optionalTransitionRewardMatrix,
  47. boost::optional<std::vector<std::list<uint_fast64_t>>>&& optionalChoiceLabeling)
  48. // The std::move call must be repeated here because otherwise this calls the copy constructor of the Base Class
  49. : AbstractDeterministicModel<T>(std::move(rateMatrix), std::move(stateLabeling), std::move(optionalStateRewardVector), std::move(optionalTransitionRewardMatrix),
  50. std::move(optionalChoiceLabeling)) {
  51. // Intentionally left empty.
  52. }
  53. /*!
  54. * Copy Constructor. Performs a deep copy of the given CTMC.
  55. * @param ctmc A reference to the CTMC that is to be copied.
  56. */
  57. Ctmc(Ctmc<T> const & ctmc) : AbstractDeterministicModel<T>(ctmc) {
  58. // Intentionally left empty.
  59. }
  60. /*!
  61. * Move Constructor. Performs a move on the given CTMC.
  62. * @param ctmc A reference to the CTMC that is to be moved from.
  63. */
  64. Ctmc(Ctmc<T>&& ctmc) : AbstractDeterministicModel<T>(std::move(ctmc)) {
  65. // Intentionally left empty.
  66. }
  67. storm::models::ModelType getType() const {
  68. return CTMC;
  69. }
  70. /*!
  71. * Calculates a hash over all values contained in this Model.
  72. * @return size_t A Hash Value
  73. */
  74. virtual std::size_t getHash() const override {
  75. return AbstractDeterministicModel<T>::getHash();
  76. }
  77. };
  78. } // namespace models
  79. } // namespace storm
  80. #endif /* STORM_MODELS_DTMC_H_ */