sim_plus: sim_plus

Description Usage Arguments Value Examples

View source: R/sim_plus.R

Description

sim_plus

Usage

1
2
sim_plus(models, discount, model_prior = NULL, state_prior = NULL, x0,
  a0 = 1, Tmax, true_model, alphas = NULL, model_names = NULL, ...)

Arguments

models

a list of lists, each of which gives the transition matrix, observation matrix and reward matrix for the model considered

discount

discount rate

model_prior

Prior belief assigned to each model. uniform by default.

state_prior

Prior belief that system is in state x_i and model m_i

x0

starting state of the system

a0

initial action (used to make the first observation, only relevant if observation depends on action)

Tmax

number of time steps to simulate

true_model

a list of the transition matrix, observation matrix, and reward matrix used to simulate draws.

alphas

the alpha vectors for each model, as provided from sarsop_plus, which will otherwise be run each time if not provided.

model_names

vector of identifying names for each model. If none are provided, model posterior columns will be named V1, V2, etc.

...

additional options to sarsop::sarsop, if alphas are not provided

Value

a list with elements (1) df a data.frame with the time, state, observation, action, and value at each timestep, (2) model_posterior, a data.frame of Tmax rows by n_models columns giving the evolution of the belief over models, and (3) state_posterior, a data.frame of Tmax rows by n_states columns giving the evolution of the belief over states

Examples

1
2
3
4
5
6
7
8
## Not run: 
source(system.file("examples/K_models.R", package="pomdpplus"))
alphas <- sarsop_plus(models, discount, precision = .1)
out <- sim_plus(models = models, discount = discount,
                x0 = 6, a0 = 1, Tmax = 10,
                true_model = models[[2]], alphas = alphas)

## End(Not run)

boettiger-lab/pomdpplus documentation built on May 24, 2019, 3:05 a.m.