forked from yalonso03/LiSCPOMDP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_viz.jl
54 lines (47 loc) · 1.44 KB
/
test_viz.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using Random
using POMDPs
using POMDPTools
using LiPOMDPs
using MCTS
using DiscreteValueIteration
using POMCPOW
using Distributions
using Parameters
using ARDESPOT
using Plots
using Plots.PlotMeasures
rng = MersenneTwister(1)
pomdp = initialize_lipomdp(obj_weights=[0.25, 0.25, 1.0, 1.0, 0.25])
up = LiBeliefUpdater(pomdp)
b = initialize_belief(up)
mdp = GenerativeBeliefMDP(pomdp, up)
random_planner = RandPolicy(pomdp)
strong_planner = EfficiencyPolicy(pomdp, [true, true, true, true])
robust_planner = EfficiencyPolicyWithUncertainty(pomdp, 1., [true, true, true, true])
eco_planner = EmissionAwarePolicy(pomdp, [true, true, true, true])
# mcts_solver = DPWSolver(
# depth=15,
# n_iterations = 1000,
# estimate_value=RolloutEstimator(robust_planner, max_depth=50),
# enable_action_pw=false,
# enable_state_pw=true,
# k_state = 4.,
# alpha_state = 0.1,
# )
# mcts_planner = solve(mcts_solver, mdp)
solver = POMCPOW.POMCPOWSolver(
tree_queries=1000,
estimate_value = 0,
k_observation=4.,
alpha_observation=0.06,
max_depth=15,
enable_action_pw=false,
init_N=10
)
pomcpow_planner = solve(solver, pomdp)
hr = HistoryRecorder(rng=rng, max_steps=pomdp.time_horizon)
hist = simulate(hr, pomdp, pomcpow_planner, up, b);
df = get_rewards(pomdp, hist);
p = plot_results(pomdp, df);
pall = plot(p.action, p.econ, p.other, layout=(3, 1), size=(1100, 800), margin=5mm);
savefig(pall, "results.pdf")