From 19c07f42d3bc4c673c9d41b5690db5cee11d549c Mon Sep 17 00:00:00 2001 From: Zachary Sunberg Date: Fri, 23 Mar 2018 17:52:10 -0700 Subject: [PATCH 1/2] deleted some unneeded code --- src/GridWorlds.jl | 10 ---------- test/crying.jl | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/GridWorlds.jl b/src/GridWorlds.jl index 27d3a70..5584be0 100644 --- a/src/GridWorlds.jl +++ b/src/GridWorlds.jl @@ -74,16 +74,6 @@ end GridWorld(;sx::Int64=10, sy::Int64=10, kwargs...) = GridWorld(sx, sy; kwargs...) -# convenience function -function term_from_rs(rs, rv) - terminals = Set{GridWorldState}() - for (i,v) in enumerate(rv) - if v > 0.0 - push!(terminals, rs[i]) - end - end -end - ################################################################# # State and Action Spaces diff --git a/test/crying.jl b/test/crying.jl index 67e82c8..b3842a5 100644 --- a/test/crying.jl +++ b/test/crying.jl @@ -8,10 +8,10 @@ problem = BabyPOMDP() # starve policy # when the baby is never fed, the reward for starting in the hungry state should be -100 -sim = RolloutSimulator(eps=0.0001, initial_state=true) +sim = RolloutSimulator(eps=0.0001) ib = nothing policy = Starve() -r = simulate(sim, problem, policy, updater(policy), ib) +r = simulate(sim, problem, policy, updater(policy), ib, true) @test r ≈ -100.0 atol=0.01 # test generate_o From 3cdeafd0f1e006e047b1e303c3b4a24d38f1883a Mon Sep 17 00:00:00 2001 From: Zachary Sunberg Date: Fri, 23 Mar 2018 18:30:10 -0700 Subject: [PATCH 2/2] fixed deprecation --- src/Random.jl | 4 ++-- test/random.jl | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Random.jl b/src/Random.jl index c9be2d5..ac1f219 100644 --- a/src/Random.jl +++ b/src/Random.jl @@ -1,4 +1,4 @@ -function RandomMDP(ns::Int64, na::Int64, discount::Float64; rng::AbstractRNG=MersenneTwister()) +function RandomMDP(ns::Int64, na::Int64, discount::Float64; rng::AbstractRNG=Base.GLOBAL_RNG) # random dynamics T = rand(rng, ns, na, ns) # normalize @@ -12,7 +12,7 @@ end RandomMDP() = RandomMDP(100, 5, 0.9) -function RandomPOMDP(ns::Int64, na::Int64, no::Int64, discount::Float64; rng::AbstractRNG=MersenneTwister()) +function RandomPOMDP(ns::Int64, na::Int64, no::Int64, discount::Float64; rng::AbstractRNG=Base.GLOBAL_RNG) # random dynamics T = rand(rng, ns, na, ns) # random observation model diff --git a/test/random.jl b/test/random.jl index 8b37452..725234c 100644 --- a/test/random.jl +++ b/test/random.jl @@ -25,3 +25,7 @@ ov = convert_o(Array{Float64}, 1, pomdp) @test ov == [1.] o = convert_o(Int, ov, pomdp) @test o == 1 + +# to catch anything in the default constructors +RandomPOMDP() +RandomMDP()