Skip to content

Commit

Permalink
Merge pull request #4 from ebalaban/fix-package
Browse files Browse the repository at this point in the history
Cleaned up LightDarkLPDM.
  • Loading branch information
ebalaban authored Jan 8, 2020
2 parents 85938d1 + 9eb1c73 commit f1f757d
Show file tree
Hide file tree
Showing 24 changed files with 38 additions and 119 deletions.
1 change: 0 additions & 1 deletion .codecov.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*.jl.cov
*.jl.*.cov
*.jl.mem
*.DS_Store
*.DS_Store
Manifest.toml
results*
18 changes: 0 additions & 18 deletions .travis.yml

This file was deleted.

13 changes: 13 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name = "LightDarkLPDM"
uuid = "61eceab4-c7ab-4531-afd3-78042c72ca60"
version = "0.1.0"

[deps]
Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
LPDM = "afad1059-261e-5166-a24b-444a49bdbc07"
POMDPs = "a93abf59-7444-517b-a68a-c42f96afdd7d"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# LightDarkPOMDPs
# LightDarkLPDM inspired and forked from LightDarkPOMDPs

![A trajectory of a good solution to a LightDark2DTarget problem](https://github.com/zsunberg/LightDarkPOMDPs.jl/raw/master/img/target_good_solution.gif)

Expand Down
8 changes: 0 additions & 8 deletions REQUIRE

This file was deleted.

34 changes: 0 additions & 34 deletions appveyor.yml

This file was deleted.

Binary file removed src.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion src/LPDMBounds1d.jl → src/1D/LPDMBounds1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function lower_bound(p::AbstractLD1, particle::LPDMParticle{Float64})
end
return r1+r2, a1
end
# lower_bound(p::LightDarkPOMDPs.LightDark1DDespot, particle::LPDM.LPDMParticle{Float64}) = lower_bound(p, POMDPToolbox.Particle{Float64}(particle.state, particle.weight))
# lower_bound(p::LightDarkLPDM.LightDark1DDespot, particle::LPDM.LPDMParticle{Float64}) = lower_bound(p, POMDPToolbox.Particle{Float64}(particle.state, particle.weight))

# NOTE: not for direct calling
# computes the reward for the straight-line path to target
Expand Down
2 changes: 1 addition & 1 deletion src/lightdark1d.jl → src/1D/lightdark1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ abstract type AbstractLD1 <: POMDP{Float64, Float64, Float64} end
discount::Float64
discount factor
"""
@with_kw mutable struct LightDark1D <: LightDarkPOMDPs.AbstractLD1
@with_kw mutable struct LightDark1D <: LightDarkLPDM.AbstractLD1
min_noise::Float64 = 0.0
min_noise_loc::Float64 = 5.0
Q::Float64 = 0.5
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 5 additions & 5 deletions src/LightDarkPOMDPs.jl → src/LightDarkLPDM.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# __precompile__()

module LightDarkPOMDPs
module LightDarkLPDM

# importall POMDPs
using POMDPs
Expand All @@ -15,14 +15,14 @@ using Random
# using ParticleFilters # for AbstractParticleBelief
using LPDM

include("lightdark1d.jl")
include("lightdark2d.jl")
include("1D/lightdark1d.jl")
include("2D/lightdark2d.jl")
# include("lightdark2dtarget.jl")
# include("lightdark2dfilter.jl")
# include("lightdark1ddespot.jl")
include("lightdark1dlpdm.jl")
include("1D/lightdark1dlpdm.jl")
# include("lightdark2ddespot.jl")
include("lightdark2dlpdm.jl")
include("2D/lightdark2dlpdm.jl")

# include("lightdark2dvis.jl")
export
Expand Down
4 changes: 2 additions & 2 deletions src/archive/execute1d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ using StatsFuns
using Printf
using Dates

include("LightDarkPOMDPs.jl")
include("LightDarkLPDM.jl")
using LightDarkPOMDPs

include("LPDMBounds1d.jl")
include("1D/LPDMBounds1d.jl")

struct LPDMTest
solver_mode::Symbol
Expand Down
2 changes: 1 addition & 1 deletion src/archive/execute2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using StatsFuns
using Printf
using Dates

include("LightDarkPOMDPs.jl")
include("LightDarkLPDM.jl")
using LightDarkPOMDPs

include("LPDMBounds2d.jl")
Expand Down
2 changes: 1 addition & 1 deletion src/archive/test_lightdark1d.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Revise
import LPDM, D3Trees, LightDarkPOMDPs, execute1d
import LPDM, D3Trees, LightDarkLPDM, execute1d
# execute1d.execute(solver=:lpdm)
steps = 1
# execute1d.execute(s0=3/2*π, solver_mode = :lpdm, action_mode = :standard, obs_mode = :discrete, steps=steps, vis=Int64[], output=1)
Expand Down
2 changes: 1 addition & 1 deletion src/archive/test_lightdark2d.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using Revise
import LPDM, D3Trees, LightDarkPOMDPs, execute2d
import LPDM, D3Trees, LightDarkLPDM, execute2d
# execute2d.execute(solver=:lpdm)
steps = 1
# execute2d.execute(output=2, steps = steps, reward_func = :quadratic)
Expand Down
8 changes: 4 additions & 4 deletions src/execute.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ using StatsFuns
using Printf
using Dates

include("LightDarkPOMDPs.jl")
using LightDarkPOMDPs
include("LightDarkLPDM.jl")
using LightDarkLPDM

include("LPDMBounds1d.jl")
include("LPDMBounds2d.jl")
include("1D/LPDMBounds1d.jl")
include("2D/LPDMBounds2d.jl")

struct ProblemConfig
n_bins ::Int64
Expand Down
4 changes: 3 additions & 1 deletion src/test_lightdark.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using Revise
import LPDM, D3Trees, LightDarkPOMDPs, execute
include("execute.jl")
using .execute
import LPDM, D3Trees, LightDarkLPDM

# execute.batch_execute(dims=2)
# Juno.@run execute.batch_execute(dims=1, debugger=true)
Expand Down
Empty file removed test/REQUIRE
Empty file.
41 changes: 2 additions & 39 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,46 +1,9 @@
using LightDarkPOMDPs
using LightDarkLPDM
using Base.Test
using POMDPs
using POMDPToolbox
using StaticArrays
using Plots
using ParticleFilters

#### LightDark2D Problem ####

p = LightDark2D()

# simulate with a policy that moves -0.01 times the observation
hr = HistoryRecorder(max_steps=10)
h = sim(p, simulator=hr) do o
@show o
return -0.01*o
end
@show p.count


# simulate with a kalman filter
bpol = FunctionPolicy(b -> -0.5*mean(b))
up = LightDark2DKalman(p)
h = simulate(hr, p, bpol, up)

# plotly()
pl = plot(p);
plot!(pl, h)
# gui()

#### LightDark2DTarget Problem ####

p = LightDark2DTarget()

pl = plot(p);
up = SIRParticleFilter(p, 1000)
b = initialize_belief(up, initial_state_distribution(p))
plot!(pl, b)
gui()

hist = simulate(hr, p, bpol, up)
println("state trajectory")
for s in state_hist(hist)
@show s
end
#Removed test code from here since it was for LightDarkPOMDPs.

0 comments on commit f1f757d

Please sign in to comment.