# NOT RUN {
# two-state POMDP
data("Tiger")
sol <- solve_POMDP(Tiger)
plot_belief_space(sol)
plot_belief_space(sol, n = 10)
plot_belief_space(sol, n = 10, sample = "random")
# plot the belief points used by the grid-based solver
plot_belief_space(sol, sample = sol$solution$belief_states)
# plot different measures
plot_belief_space(sol, what = "pg_node")
plot_belief_space(sol, what = "reward")
# three-state POMDP
# Note: If the plotting region is too small then the legend might run into the plot
data("Three_doors")
sol <- solve_POMDP(Three_doors)
sol
plot_belief_space(sol)
plot_belief_space(sol, sample = "random", n = 1000)
plot_belief_space(sol, what = "pg_node")
plot_belief_space(sol, what = "reward", sample = "random", n = 1000)
# plot the belief points used by the grid-based solver
plot_belief_space(sol, sample = sol$solution$belief_states)
# plot the belief points obtained using simulated trajectories with an epsilon-greedy policy.
# Note that we only use n = 50 to save time.
plot_belief_space(sol, sample = simulate_POMDP(sol, n = 50, horizon = 100,
epsilon = 0.1, visited_beliefs = TRUE))
# plot a 3-state belief space using ggtern (ggplot2)
# library(ggtern)
# samp <- sample_belief_space(sol, n = 1000)
# df <- cbind(as.data.frame(samp), reward = reward(sol, belief = samp))
#
# ggtern(df, aes(x = `tiger-left`, y = `tiger-center`, z = `tiger-right`)) +
# geom_point(aes(color = reward))
# }
Run the code above in your browser using DataLab