craam/ImMDP.hpp
MDPI(const shared_ptr<const MDP>& mdp, const indvec& state2observ, const Transition& initial):
             mdp(mdp), state2observ(state2observ), initial(initial),
              obscount(1+max_value(state2observ)),
              action_counts(obscount, -1){
        check_parameters(*mdp, state2observ, initial);

        for(auto state : range((size_t) 0, mdp->state_count())){
            auto obs = state2observ[state];

            // check the number of actions
            auto ac = mdp->get_state(state).action_count();
            if(action_counts[obs] >= 0){
                if(action_counts[obs] != (long) ac){
                    throw invalid_argument("Inconsistent number of actions: " + to_string(ac) +
                                           " instead of " + to_string(action_counts[obs]) +
                                           " in state " + to_string(state));
                }
            }else{
                action_counts[obs] = ac;
            }
        }
    }
/**
    Constructs the MDP with implementability constraints. This constructor makes it
    possible to share the MDP with other data structures.

    Important: when the underlying MDP changes externally, the object becomes invalid
    and may result in unpredictable behavior.

    \param mdp A non-robust base MDP model.
    \param state2observ Maps each state to the index of the corresponding observation.
                    A valid policy will take the same action in all states
                    with a single observation. The index is 0-based.
    \param initial A representation of the initial distribution. The rewards
                    in this transition are ignored (and should be 0).
    */
Constructs the MDP with implementability constraints. This constructor makes it
possible to share the MDP with other data structures.

when the underlying MDP changes externally, the object becomes invalid
and may result in unpredictable behavior.

\param mdp A non-robust base MDP model.
\param state2observ Maps each state to the index of the corresponding observation.
A valid policy will take the same action in all states
with a single observation. The index is 0-based.
\param initial A representation of the initial distribution. The rewards
in this transition are ignored (and should be 0).
Constructs the MDP with implementability constraints . This constructor makes it possible to share the MDP with other data structures . when the underlying MDP changes externally the object becomes invalid and may result in unpredictable behavior . \ param mdp A non - robust base MDP model . \ param state2observ Maps each state to the index of the corresponding observation . A valid policy will take the same action in all states with a single observation . The index is 0 - based . \ param initial A representation of the initial distribution . The rewards in this transition are ignored ( and should be 0 ) .
MDPI(const shared_ptr<const MDP>& mdp, const indvec& state2observ, const Transition& initial):
             mdp(mdp), state2observ(state2observ), initial(initial),
              obscount(1+max_value(state2observ)),
              action_counts(obscount, -1){
        check_parameters(*mdp, state2observ, initial);
        for(auto state : range((size_t) 0, mdp->state_count())){
            auto obs = state2observ[state];
            auto ac = mdp->get_state(state).action_count();
            if(action_counts[obs] >= 0){
                if(action_counts[obs] != (long) ac){
                    throw invalid_argument("Inconsistent number of actions: " + to_string(ac) +
                                           " instead of " + to_string(action_counts[obs]) +
                                           " in state " + to_string(state));
                }
            }else{
                action_counts[obs] = ac;
            }
        }
    }
MDPI ( const shared_ptr < const MDP > & mdp , const indvec & state2observ , const Transition & initial ) : mdp ( mdp ) , state2observ ( state2observ ) , initial ( initial ) , obscount ( 1 + max_value ( state2observ ) ) , action_counts ( obscount , -1 ) { check_parameters ( * mdp , state2observ , initial ) ; for ( auto state : range ( ( size_t ) 0 , mdp -> state_count ( ) ) ) { auto obs = state2observ [ state ] ; auto ac = mdp -> get_state ( state ) . action_count ( ) ; if ( action_counts [ obs ] >= 0 ) { if ( action_counts [ obs ] != ( long ) ac ) { throw invalid_argument ( " " + to_string ( ac ) + " " + to_string ( action_counts [ obs ] ) + " " + to_string ( state ) ) ; } } else { action_counts [ obs ] = ac ; } } }
Constructs the MDP with implementability constraints.
Constructs the MDP with implementability constraints .
// check the number of actions