craam/Simulation.hpp
RandomizedPolicy(const Sim& sim, const vector<numvec>& probabilities,random_device::result_type seed = random_device{}()):
        gen(seed), distributions(probabilities.size()), sim(sim){

        for(auto pi : indices(probabilities)){
            
            // check that this distribution is correct
            const numvec& prob = probabilities[pi];
            prec_t sum = accumulate(prob.begin(), prob.end(), 0.0);
            
            if(abs(sum - 1) > SOLPREC){
                throw invalid_argument("Action probabilities must sum to 1 in state " + to_string(pi));
            } 
            distributions[pi] = discrete_distribution<long>(prob.begin(), prob.end());
        }
    }
/**
    Initializes randomized polices, transition probabilities
    for each state. The policy is applicable only to simulators that
    have:

      1) At most as many states as probabilities.size()
      2) At least as many actions are max(probabilities[i].size() | i) 


    \param sim Simulator used with the policy. The reference is retained,
                the object should not be deleted
    \param probabilities List of action probabilities for each state
    */
Initializes randomized polices, transition probabilities
for each state. The policy is applicable only to simulators that
have.

1) At most as many states as probabilities.size()
2) At least as many actions are max(probabilities[i].size() | i)

\param sim Simulator used with the policy. The reference is retained,
the object should not be deleted
\param probabilities List of action probabilities for each state
Initializes randomized polices transition probabilities for each state . The policy is applicable only to simulators that have . 1 ) At most as many states as probabilities . size () 2 ) At least as many actions are max ( probabilities [ i ] . size () | i ) \ param sim Simulator used with the policy . The reference is retained the object should not be deleted \ param probabilities List of action probabilities for each state
RandomizedPolicy(const Sim& sim, const vector<numvec>& probabilities,random_device::result_type seed = random_device{}()):
        gen(seed), distributions(probabilities.size()), sim(sim){
        for(auto pi : indices(probabilities)){
            const numvec& prob = probabilities[pi];
            prec_t sum = accumulate(prob.begin(), prob.end(), 0.0);
            if(abs(sum - 1) > SOLPREC){
                throw invalid_argument("Action probabilities must sum to 1 in state " + to_string(pi));
            } 
            distributions[pi] = discrete_distribution<long>(prob.begin(), prob.end());
        }
    }
RandomizedPolicy ( const Sim & sim , const vector < numvec > & probabilities , random_device :: result_type seed = random_device { } ( ) ) : gen ( seed ) , distributions ( probabilities . size ( ) ) , sim ( sim ) { for ( auto pi : indices ( probabilities ) ) { const numvec & prob = probabilities [ pi ] ; prec_t sum = accumulate ( prob . begin ( ) , prob . end ( ) , 0.0 ) ; if ( abs ( sum - 1 ) > SOLPREC ) { throw invalid_argument ( " " + to_string ( pi ) ) ; } distributions [ pi ] = discrete_distribution < long > ( prob . begin ( ) , prob . end ( ) ) ; } }
Initializes randomized polices, transition probabilities
for each state.
Initializes randomized polices transition probabilities for each state .
// check that this distribution is correct