plot_value_function {pomdp} | R Documentation |
Plots the value function of a POMDP solution as a line plot. The solution is projected on two states (i.e., the belief for the other states is held constant at zero).
plot_value_function(
model,
projection = 1:2,
epoch = 1,
ylim = NULL,
legend = TRUE,
col = NULL,
lwd = 1,
lty = 1,
...
)
model |
a solved POMDP. |
projection |
index or name of two states for the projection. |
epoch |
the value function of what epoch should be plotted? Use 1 for converged policies. |
ylim |
the y limits of the plot. |
legend |
logical; add a legend? |
col |
potting colors. |
lwd |
line width. |
lty |
line type. |
... |
additional arguments are passed on to |
the function has no return value.
Michael Hahsler
Other policy:
optimal_action()
,
policy_graph()
,
policy()
,
reward()
,
solve_POMDP()
,
solve_SARSOP()
data("Tiger")
sol <- solve_POMDP(model = Tiger)
sol
plot_value_function(sol, ylim = c(0,20))
## finite-horizon
sol <- solve_POMDP(model = Tiger, horizon = 3, discount = 1,
method = "enum")
sol
plot_value_function(sol, epoch = 1, ylim = c(-5, 25))
plot_value_function(sol, epoch = 2, ylim = c(-5, 25))
plot_value_function(sol, epoch = 3, ylim = c(-5, 25))
# using ggplot2
# library(ggplot2)
# pol <- policy(sol)[[3]]
# ggplot(pol) +
# geom_segment(aes(x = 0, y = `tiger-left`, xend=1, yend=`tiger-right`, color = action)) +
# coord_cartesian(ylim = c(-5, 15)) + ylab("Reward") + xlab("Belief")