@ -29,6 +29,7 @@
using RationalFunction = storm : : RationalFunction ;
using ModelBase = storm : : models : : ModelBase ;
template < typename ValueType > using ModelComponents = storm : : storage : : sparse : : ModelComponents < ValueType > ;
template < typename ValueType > using SparseModel = storm : : models : : sparse : : Model < ValueType > ;
template < typename ValueType > using SparseDtmc = storm : : models : : sparse : : Dtmc < ValueType > ;
template < typename ValueType > using SparseMdp = storm : : models : : sparse : : Mdp < ValueType > ;
@ -197,10 +198,12 @@ void define_sparse_model(py::module& m) {
;
py : : class_ < SparseDtmc < double > , std : : shared_ptr < SparseDtmc < double > > > ( m , " SparseDtmc " , " DTMC in sparse representation " , model )
. def ( py : : init < SparseDtmc < double > > ( ) , py : : arg ( " other_model " ) )
. def ( py : : init < ModelComponents < double > const & > ( ) , py : : arg ( " components " ) ) //todo tests
. def ( " __str__ " , & getModelInfoPrinter )
;
py : : class_ < SparseMdp < double > , std : : shared_ptr < SparseMdp < double > > > mdp ( m , " SparseMdp " , " MDP in sparse representation " , model ) ;
mdp . def ( py : : init < SparseMdp < double > > ( ) , py : : arg ( " other_model " ) )
. def ( py : : init < ModelComponents < double > const & , storm : : models : : ModelType > ( ) , py : : arg ( " components " ) , py : : arg ( " type " ) = storm : : models : : ModelType : : Mdp ) //todo tests
. def_property_readonly ( " nondeterministic_choice_indices " , [ ] ( SparseMdp < double > const & mdp ) { return mdp . getNondeterministicChoiceIndices ( ) ; } )
. def ( " get_nr_available_actions " , [ ] ( SparseMdp < double > const & mdp , uint64_t stateIndex ) { return mdp . getNondeterministicChoiceIndices ( ) [ stateIndex + 1 ] - mdp . getNondeterministicChoiceIndices ( ) [ stateIndex ] ; } , py : : arg ( " state " ) )
. def ( " get_choice_index " , [ ] ( SparseMdp < double > const & mdp , uint64_t state , uint64_t actOff ) { return mdp . getNondeterministicChoiceIndices ( ) [ state ] + actOff ; } , py : : arg ( " state " ) , py : : arg ( " action_offset " ) , " gets the choice index for the offset action from the given state. " )
@ -209,6 +212,7 @@ void define_sparse_model(py::module& m) {
;
py : : class_ < SparsePomdp < double > , std : : shared_ptr < SparsePomdp < double > > > ( m , " SparsePomdp " , " POMDP in sparse representation " , mdp )
. def ( py : : init < SparsePomdp < double > > ( ) , py : : arg ( " other_model " ) )
. def ( py : : init < ModelComponents < double > const & , bool > ( ) , py : : arg ( " components " ) , py : : arg ( " canonicFlag " ) = false ) //todo tests
. def ( " __str__ " , & getModelInfoPrinter )
. def ( " get_observation " , & SparsePomdp < double > : : getObservation , py : : arg ( " state " ) )
. def_property_readonly ( " observations " , & SparsePomdp < double > : : getObservations )
@ -216,10 +220,12 @@ void define_sparse_model(py::module& m) {
;
py : : class_ < SparseCtmc < double > , std : : shared_ptr < SparseCtmc < double > > > ( m , " SparseCtmc " , " CTMC in sparse representation " , model )
. def ( py : : init < SparseCtmc < double > > ( ) , py : : arg ( " other_model " ) )
. def ( py : : init < ModelComponents < double > const & > ( ) , py : : arg ( " components " ) ) //todo tests
. def ( " __str__ " , & getModelInfoPrinter )
;
py : : class_ < SparseMarkovAutomaton < double > , std : : shared_ptr < SparseMarkovAutomaton < double > > > ( m , " SparseMA " , " MA in sparse representation " , model )
. def ( py : : init < SparseMarkovAutomaton < double > > ( ) , py : : arg ( " other_model " ) )
. def ( py : : init < ModelComponents < double > const & > ( ) , py : : arg ( " components " ) ) //todo tests
. def_property_readonly ( " nondeterministic_choice_indices " , [ ] ( SparseMarkovAutomaton < double > const & ma ) { return ma . getNondeterministicChoiceIndices ( ) ; } )
. def ( " apply_scheduler " , [ ] ( SparseMarkovAutomaton < double > const & ma , storm : : storage : : Scheduler < double > const & scheduler , bool dropUnreachableStates ) { return ma . applyScheduler ( scheduler , dropUnreachableStates ) ; } , " apply scheduler " , " scheduler " _a , " drop_unreachable_states " _a = true )
. def ( " __str__ " , & getModelInfoPrinter )
@ -228,6 +234,7 @@ void define_sparse_model(py::module& m) {
;
py : : class_ < SparseRewardModel < double > > ( m , " SparseRewardModel " , " Reward structure for sparse models " )
//todo init?
. def_property_readonly ( " has_state_rewards " , & SparseRewardModel < double > : : hasStateRewards )
. def_property_readonly ( " has_state_action_rewards " , & SparseRewardModel < double > : : hasStateActionRewards )
. def_property_readonly ( " has_transition_rewards " , & SparseRewardModel < double > : : hasTransitionRewards )
@ -290,6 +297,7 @@ void define_sparse_model(py::module& m) {
;
py : : class_ < SparseRewardModel < RationalFunction > > ( m , " SparseParametricRewardModel " , " Reward structure for parametric sparse models " )
//todo init?
. def_property_readonly ( " has_state_rewards " , & SparseRewardModel < RationalFunction > : : hasStateRewards )
. def_property_readonly ( " has_state_action_rewards " , & SparseRewardModel < RationalFunction > : : hasStateActionRewards )
. def_property_readonly ( " has_transition_rewards " , & SparseRewardModel < RationalFunction > : : hasTransitionRewards )