-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix trailing whitespace errors * V0.8 compat * Delete old require file * Disable tests for v0.7 and enable vor v1.x
- Loading branch information
Showing
12 changed files
with
66 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,8 @@ os: | |
- linux | ||
# - osx | ||
julia: | ||
- 0.7 | ||
- 1.0 | ||
- 1 | ||
notifications: | ||
email: false | ||
after_success: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name = "ParticleFilters" | ||
uuid = "c8b314e2-9260-5cf8-ae76-3be7461ca6d0" | ||
repo = "https://github.com/JuliaPOMDP/ParticleFilters.jl" | ||
version = "0.4.0" | ||
|
||
[deps] | ||
POMDPModelTools = "08074719-1b2a-587c-a292-00f91cc44415" | ||
POMDPPolicies = "182e52fb-cfd0-5e46-8c26-fd0667c990f4" | ||
POMDPs = "a93abf59-7444-517b-a68a-c42f96afdd7d" | ||
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" | ||
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" | ||
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" | ||
|
||
[compat] | ||
POMDPs = "0.7.3, 0.8" | ||
julia = "1" | ||
|
||
[extras] | ||
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab" | ||
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
NBInclude = "0db19996-df87-5ea3-a455-e3a50d440464" | ||
POMDPModels = "355abbd5-f08e-5560-ac9e-8b5f2592a0ca" | ||
POMDPSimulators = "e0d0a172-29c6-5d4e-96d0-f262df5d01fd" | ||
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" | ||
Reel = "71555da5-176e-5e73-a222-aebc6c6e4f2f" | ||
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
||
[targets] | ||
test = ["DelimitedFiles", "Distributions", "LinearAlgebra", "NBInclude", "Plots", "POMDPModels", "POMDPSimulators", "Reel", "StaticArrays", "Test"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
#= | ||
Implementation specific to using ParticleBeliefs with AlphaVectorPolicy from POMDPToolbox | ||
these are more efficient than converting the ParticleBelief to a DiscreteBelief | ||
=# | ||
|
||
""" | ||
Given a particle belief, return the unnormalized utility function that weights each state value by the weight of | ||
the corresponding particle | ||
unnormalized_util(p::AlphaVectorPolicy, b::AbstractParticleBelief) | ||
""" | ||
function unnormalized_util(p::AlphaVectorPolicy, b::AbstractParticleBelief) | ||
util = zeros(n_actions(p.pomdp)) | ||
for (i, s) in enumerate(particles(b)) | ||
j = stateindex(p.pomdp, s) | ||
util += weight(b, i)*getindex.(p.alphas, (j,)) | ||
end | ||
return util | ||
end | ||
|
||
function action(p::AlphaVectorPolicy, b::AbstractParticleBelief) | ||
util = unnormalized_util(p, b) | ||
ihi = argmax(util) | ||
return p.action_map[ihi] | ||
end | ||
|
||
value(p::AlphaVectorPolicy, b::AbstractParticleBelief) = maximum(unnormalized_util(p, b))/weight_sum(b) | ||
#= | ||
Implementation specific to using ParticleBeliefs with AlphaVectorPolicy from POMDPToolbox | ||
these are more efficient than converting the ParticleBelief to a DiscreteBelief | ||
=# | ||
|
||
""" | ||
Given a particle belief, return the unnormalized utility function that weights each state value by the weight of | ||
the corresponding particle | ||
unnormalized_util(p::AlphaVectorPolicy, b::AbstractParticleBelief) | ||
""" | ||
function unnormalized_util(p::AlphaVectorPolicy, b::AbstractParticleBelief) | ||
util = p.pomdp |> actions |> length |> zeros | ||
for (i, s) in enumerate(particles(b)) | ||
j = stateindex(p.pomdp, s) | ||
util += weight(b, i)*getindex.(p.alphas, (j,)) | ||
end | ||
return util | ||
end | ||
|
||
function action(p::AlphaVectorPolicy, b::AbstractParticleBelief) | ||
util = unnormalized_util(p, b) | ||
ihi = argmax(util) | ||
return p.action_map[ihi] | ||
end | ||
|
||
value(p::AlphaVectorPolicy, b::AbstractParticleBelief) = maximum(unnormalized_util(p, b))/weight_sum(b) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44b494e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
44b494e
There was a problem hiding this comment.
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/3740
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 Julia TagBot is installed, or can be done manually through the github interface, or via: