forked from JuliaPOMDP/DESPOT.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrockSampleBounds.jl
40 lines (31 loc) · 1.3 KB
/
rockSampleBounds.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
# Combined (lower and upper) bounds type for the RockSample problem
include("rockSampleParticleLB.jl")
include("rockSampleFringeUB.jl")
include("../../upperBound/upperBoundNonStochastic.jl")
import DESPOT: bounds, init_bounds, default_action
type RockSampleBounds
lb::RockSampleParticleLB
ub::UpperBoundNonStochastic{RockSampleState,RockSampleAction,RockSampleObs}
function RockSampleBounds(pomdp::RockSample)
this = new()
this.lb = RockSampleParticleLB(pomdp)
this.ub = UpperBoundNonStochastic{RockSampleState,RockSampleAction,RockSampleObs}(pomdp)
return this
end
end
function bounds(b::RockSampleBounds,
pomdp::RockSample,
particles::Vector{DESPOTParticle{RockSampleState}},
config::DESPOTConfig)
ubound::Float64 = upper_bound(b.ub, pomdp, particles, config)
lbound::Float64 = lower_bound(b.lb, pomdp, particles, b.ub.upper_bound_act, config)
return lbound, ubound
end
function init_bounds(bounds::RockSampleBounds, pomdp::RockSample, config::DESPOTConfig)
init_bound(bounds.ub, pomdp, config)
# lower bound init not currently needed
end
function default_action(b::RockSampleBounds, pomdp::RockSample, particles::Vector, config::DESPOTConfig)
bounds(b, pomdp, particles, config)
return b.lb.best_action
end