Skip to content

Commit

Permalink
bump up version
Browse files Browse the repository at this point in the history
  • Loading branch information
Wu-Chenyang committed May 5, 2021
1 parent 4b0035c commit 568d747
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
4 changes: 2 additions & 2 deletions Project.toml
@@ -1,7 +1,7 @@
name = "AdaOPS"
uuid = "eadfb9d8-44f1-454c-a5eb-0663ee7d74a1"
repo = "git@github.com:LAMDA-POMDP/AdaOPS.jl.git"
version = "0.4.2"
version = "0.5.1"

[deps]
BasicPOMCP = "d721219e-3fc6-5570-a8ef-e5402f47c49e"
Expand Down Expand Up @@ -30,7 +30,7 @@ BeliefUpdaters = "0.2"
CPUTime = "1"
D3Trees = "0.3"
Distances = "0.9, 0.10"
Distributions = "0.22 - 0.24"
Distributions = "0.22 - 0.25"
MCTS = "0.4"
POMDPLinter = "0.1"
POMDPModelTools = "0.3"
Expand Down
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -46,8 +46,6 @@ Solver options can be found in the `AdaOPSSolver` docstring and accessed using [
### Belief Packing
#### delta
A δ-packing of observation branches will be generated, i.e., the belief nodes with L1 distance less than delta are merged.
#### m_min
`m_min` is the number of particles used for estimating the L1 between beliefs.

### Adaptive Particle Filter
The core idea of the adaptive particle filter is that it can change the number of particles adaptively and use more particles to estimate the belief when needed.
Expand All @@ -63,8 +61,10 @@ With the number of tiles (bins) occupied, we can estimate the number of particle
`max_occupied_bins` is the maximum number of bins occupied by a belief. Normally, it is exactly the grid size. However, in some domains, such as Roomba, only states within the room is accessible, and the corresponding bins will never be occupied.
##### min_occupied_bins
`min_occupied_bins` is the minimum number of bins occupied by a belief. Normally, it default to 2. A belief occupying `min_occupied_bins` tiles will be estimated with `m_min` particles. Increasing `min_occupied_bins` indicates that a belief need to occupy more bins so as to be estimated by the same amount of particles.
#### m_min
`m_min` is the minimum number of particles used for approximating beliefs.
#### m_max
`m_max` is the maximum number of particles used for estimating a belief. Normally, `m_max` is set to be big enough so that KLD-Sampling determines the number of particles used. When the KLD-Sampling is disabled, i.e. `grid=StateGrid{0}([])`, `m_max` will be sampled during the resampling.
`m_max` is the maximum number of particles used for approximating a belief. Normally, `m_max` is set to be big enough so that KLD-Sampling determines the number of particles used. When the KLD-Sampling is disabled, i.e. `grid=StateGrid{0}([])`, `m_max` will be sampled during the resampling.
#### zeta
`zeta` is the target error when estimating a belief. Spcifically, we use KLD Sampling to calculate the number of particles needed, where `zeta` is the targe Kullback-Leibler divergence between the estimated belief and the true belief. In AdaOPS, `zeta` is automatically adjusted according to the minimum number of bins occupied such that the minimum number of particles KLD-Sampling method suggests is exactly `m_min`.

Expand Down
4 changes: 2 additions & 2 deletions src/AdaOPS.jl
Expand Up @@ -99,13 +99,13 @@ Further information can be found in the field docstrings (e.g.
"The maximum number of bins a belief occupies (default to the grid size)."
max_occupied_bins::Int = prod(size(grid))

"The number of particles used for generating belief packing."
"The minimum number of particles for approximating beliefs"
m_min::Int = 30

"The target error for belief estimation."
zeta::Float64 = KLDSampleSize(min_occupied_bins, m_min)

"The maximum number of particles for belief estimation"
"The maximum number of particles for approximating beliefs"
m_max::Int = max(ceil(Int, KLDSampleSize(max_occupied_bins, zeta)), m_min)

"Resample when the design effect of a belief node exceed Deff_thres"
Expand Down
21 changes: 7 additions & 14 deletions src/tree.jl
Expand Up @@ -223,28 +223,25 @@ end

function gen_packing!(D::AdaOPSTree, S, O, belief::WeightedParticleBelief, a, p::AdaOPSPlanner)
sol = solver(p)
m_min = sol.m_min
m_max = length(S)
m = length(S)
w = weights(belief)

next_obs = 1 # denote the index of the next observation branch
for i in eachindex(O)
w′ = resize!(D.weights[D.b+next_obs], m_min)
w′ = resize!(D.weights[D.b+next_obs], m)
o = O[i]
# reweight first m_min particles
reweight!(w′, view(w, 1:m_min), view(S, 1:m_min), a, o, p.pomdp)
reweight!(w′, w, S, a, o, p.pomdp)
# check if the observation is already covered by the packing
norm_w = p.norm_w[next_obs]
norm_w .= w′ ./ sum(w′)
obs_ind = in_packing(norm_w, view(p.norm_w, 1:(next_obs-1)), sol.delta)
if obs_ind !== 0
w′ .= w′ ./ sum(w′)
obs_ind = in_packing(w′, p.w, sol.delta)
if obs_ind != 0
# merge the new obs into an existing obs
p.obs_w[obs_ind] += p.obs_w[i]
else
# add the new obs into the packing
p.obs_w[next_obs] = p.obs_w[i]
O[next_obs] = o
push!(p.w, resize!(w′, m_max))
push!(p.w, w′)
next_obs += 1
end
end
Expand All @@ -253,10 +250,6 @@ function gen_packing!(D::AdaOPSTree, S, O, belief::WeightedParticleBelief, a, p:
resize!(O, n_obs)
resize!(p.obs_w, n_obs)

for i in eachindex(p.w)
reweight!(view(p.w[i], (m_min+1):m_max), view(w, (m_min+1):m_max), view(S, (m_min+1):m_max), a, O[i], p.pomdp)
end

return nothing
end

Expand Down

2 comments on commit 568d747

@Wu-Chenyang
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/36101

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.5.1 -m "<description of version>" 568d747473f3201de11ee97b7da5867f1227ff6c
git push origin v0.5.1

Please sign in to comment.