Browse Source

constructor for modelComp

refactoring
hannah 4 years ago
committed by Matthias Volk
parent
commit
9114729959
No known key found for this signature in database GPG Key ID: 83A57678F739FCD3
  1. 51
      src/storage/modelcomponents.cpp

51
src/storage/modelcomponents.cpp

@ -2,36 +2,55 @@
#include "storm/models/sparse/StandardRewardModel.h"
#include "storm/models/symbolic/StandardRewardModel.h"
#include "storm/storage/sparse/ModelComponents.h"
#include "storm/storage/SparseMatrix.h"
#include "storm/models/sparse/StateLabeling.h"
#include "storm/storage/BitVector.h"
// or just template<typename ValueType> using ModelComponents = storm::storage::sparse::ModelComponents<ValueType>; todo
template<typename ValueType> using SparseMatrix = storm::storage::SparseMatrix<ValueType>;
using stateLabeling = storm::models::sparse::StateLabeling;
using BitVector = storm::storage::BitVector;
template<typename ValueType> using StandardRewardModel = storm::models::sparse::StandardRewardModel<ValueType>;
template<typename ValueType, typename RewardModelType = StandardRewardModel<ValueType>> using ModelComponents = storm::storage::sparse::ModelComponents<ValueType, RewardModelType>;
// other: todo
// <storm::RationalNumber> <double, storm::models::sparse::StandardRewardModel<storm::Interval>><storm::RationalFunction>;
// py::class_<ModelComponents<double, StandardRewardModel<storm::Interval>>>(m, "ModelComponents", "ModelComponents description..")
void define_model_components(py::module& m) {
py::class_<ModelComponents<double, StandardRewardModel<double>>>(m, "ModelComponents", "ModelComponents description..")
//todo .def(py::init<...>)
py::class_<ModelComponents<double>>(m, "ModelComponents", "ModelComponents description..")
.def(py::init<SparseMatrix<double> const &, stateLabeling const &, std::unordered_map<std::string, StandardRewardModel<double>> const &,
bool, boost::optional<BitVector> const &, boost::optional<SparseMatrix<storm::storage::sparse::state_type>> const &>(),
"Construct from Prism program", py::arg("transition_matrix"), py::arg("state_labeling") = stateLabeling(),
py::arg("reward_models") = std::unordered_map<std::string, StandardRewardModel<double>>(), py::arg("rate_transitions") = false,
py::arg("markovian_states") = boost::none, py::arg("player1_matrix") = boost::none)
.def(py::init<>()) // for rvalue ? todo
// todo: readwrite or readonly?
// general components (for all model types)
.def_readwrite("transition_matrix", &ModelComponents<double, StandardRewardModel<double>>::transitionMatrix)
.def_readwrite("state_labeling", &ModelComponents<double, StandardRewardModel<double>>::stateLabeling)
.def_readwrite("reward_models", &ModelComponents<double, StandardRewardModel<double>>::rewardModels, "Reward models associated with the model")
.def_readwrite("choice_labeling", &ModelComponents<double, StandardRewardModel<double>>::choiceLabeling, "A vector that stores a labeling for each choic")
.def_readwrite("state_valuations", &ModelComponents<double, StandardRewardModel<double>>::stateValuations, "A vector that stores for each state to which variable valuation it belongs")
.def_readwrite("choice_origins", &ModelComponents<double, StandardRewardModel<double>>::choiceOrigins, "Stores for each choice from which parts of the input model description it originates")
.def_readwrite("transition_matrix", &ModelComponents<double>::transitionMatrix)
.def_readwrite("state_labeling", &ModelComponents<double>::stateLabeling)
.def_readwrite("reward_models", &ModelComponents<double>::rewardModels, "Reward models associated with the model")
.def_readwrite("choice_labeling", &ModelComponents<double>::choiceLabeling, "A vector that stores a labeling for each choic")
.def_readwrite("state_valuations", &ModelComponents<double>::stateValuations, "A vector that stores for each state to which variable valuation it belongs")
.def_readwrite("choice_origins", &ModelComponents<double>::choiceOrigins, "Stores for each choice from which parts of the input model description it originates")
// POMDP specific components
.def_readwrite("observability_classes", &ModelComponents<double, StandardRewardModel<double>>::observabilityClasses, "The POMDP observations")
.def_readwrite("observability_classes", &ModelComponents<double>::observabilityClasses, "The POMDP observations")
// Continuous time specific components (CTMCs, Markov Automata):
.def_readwrite("rate_transitions", &ModelComponents<double, StandardRewardModel<double>>::rateTransitions, "True iff the transition values (for Markovian choices) are interpreted as rates")
.def_readwrite("exit_Rates", &ModelComponents<double, StandardRewardModel<double>>::exitRates, "The exit rate for each state. Must be given for CTMCs and MAs, if rate_transitions is false. Otherwise, it is optional.")
.def_readwrite("markovian_states", &ModelComponents<double, StandardRewardModel<double>>::markovianStates, "A vector that stores which states are markovian (only for Markov Automata)")
.def_readwrite("rate_transitions", &ModelComponents<double>::rateTransitions, "True iff the transition values (for Markovian choices) are interpreted as rates")
.def_readwrite("exit_Rates", &ModelComponents<double>::exitRates, "The exit rate for each state. Must be given for CTMCs and MAs, if rate_transitions is false. Otherwise, it is optional.")
.def_readwrite("markovian_states", &ModelComponents<double>::markovianStates, "A vector that stores which states are markovian (only for Markov Automata)")
// Stochastic two player game specific components:
.def_readwrite("player1_matrix", &ModelComponents<double, StandardRewardModel<double>>::observabilityClasses, "Matrix of player 1 choices (needed for stochastic two player games")
.def_readwrite("player1_matrix", &ModelComponents<double>::observabilityClasses, "Matrix of player 1 choices (needed for stochastic two player games")
;
;
}
Loading…
Cancel
Save