diff --git a/src/envs/circular.jl b/src/envs/circular.jl index e3e91a4..afac476 100644 --- a/src/envs/circular.jl +++ b/src/envs/circular.jl @@ -140,12 +140,13 @@ function POMDPs.observations(pomdp::CircularMaze) # NOTE: In JuliaPOMDPs, an observation space is NOT the set of possible distributions, but rather union of the support of all possible observations corridors = 1:pomdp.n_corridors # from CMAZE_SENSE_CORRIDOR perms = permutations(pomdp.probabilities) - space = chain(corridors, perms) # generator + space = Iterators.flatten(corridors, perms) # generator return space end # TODO: maybe implement POMDPs.obsindex +# TODO: confirm that transitions are non-Deterministic function POMDPs.transition(pomdp::CircularMaze, s::CircularMazeState, a::Integer) @assert a in actions(pomdp) "Unrecognized action $a" if a == CMAZE_DECLARE_GOAL diff --git a/src/updaters/kalman.jl b/src/updaters/kalman.jl new file mode 100644 index 0000000..7ae2695 --- /dev/null +++ b/src/updaters/kalman.jl @@ -0,0 +1,12 @@ +import POMDPs + +struct HistoryUpdater <: POMDPs.Updater end + +POMDPs.initialize_belief(up::HistoryUpdater, d) = Any[d] + +function POMDPs.update(up::HistoryUpdater, b, a, o) + bp = copy(b) + push!(bp, a) + push!(bp, o) + return bp +end \ No newline at end of file diff --git a/test/circular_tests.jl b/test/circular_tests.jl index 1c7793f..c94059f 100644 --- a/test/circular_tests.jl +++ b/test/circular_tests.jl @@ -1,5 +1,5 @@ let - pomdp = CircularMaze() + pomdp = CircularMaze(2, 5, 0.99) policy = RandomPolicy(pomdp, rng=MersenneTwister(2)) sim = RolloutSimulator(rng=MersenneTwister(3), max_steps=100)