# NOT RUN {
data("Tiger")
sol <- solve_POMDP(model = Tiger)
sol
## policy graph
policy_graph(sol)
## visualization
plot_policy_graph(sol)
## use a different graph layout (circle and manual; needs igraph)
library("igraph")
plot_policy_graph(sol, layout = layout.circle)
plot_policy_graph(sol, layout = rbind(c(1,1), c(1,-1), c(0,0), c(-1,-1), c(-1,1)))
## hide labels and legend
plot_policy_graph(sol, edge.label = NA, vertex.label = NA, legend = FALSE)
## add a plot title
plot_policy_graph(sol, main = sol$name)
## custom larger vertex labels (A, B, ...)
plot_policy_graph(sol,
vertex.label = LETTERS[1:nrow(policy(sol)[[1]])],
vertex.label.cex = 2,
vertex.label.color = "white")
## plotting using the graph object
## (e.g., using the graph in the layout and to change the edge curvature)
pg <- policy_graph(sol)
plot(pg,
layout = layout_as_tree(pg, root = 3, mode = "out"),
edge.curved = curve_multiple(pg, .2))
## changes labels
plot(pg,
edge.label = abbreviate(E(pg)$label),
vertex.label = sol$solution$pg$action,
vertex.size = 10)
## plot interactive graphs using the visNetwork library
plot_policy_graph(sol, engine = "visNetwork")
## add smooth edges and a layout (note, engine can be abbreviated)
plot_policy_graph(sol, engine = "vis", layout = "layout_in_circle", smooth = TRUE)
# }
Run the code above in your browser using DataLab