Skip to content

JuliaPOMDP/POMDPReinforce.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

THIS PACKAGE IS DEPRECATED

Reinforce.jl is discontinued. Please reference CommonRLInterface.

POMDPReinforce

Build Status

Coverage Status

codecov.io

This package wraps POMDPs.jl problems into reinforcement learning environments with Reinforce.jl interface. This allows POMDP problems to be used with a variety of deep reinforcement learning algorithms.

Quick Start

We will use the Episode type from Reinforce to run a quick simulation.

using POMDPReinforce
using Reinforce
import POMDPModels: GridWorld, LightDark1D

# Create a random Reinforce.jl policy 
type RandomPolicy <: AbstractPolicy end
Reinforce.action(policy::RandomPolicy, r, s, A) = rand(A)
policy = RandomPolicy()


# Simulating an grid world MDP environment
env = MDPEnv(GridWorld())
ep = Episode(env, policy)
for (s, a, r, sp) in ep
    # do some custom pre-processing if needed
    info("State $s, action $a, reward $r")
end

# Simulating a light dark POMDP environment
env = POMDPEnv(LightDark1D(), MersenneTwister(1))
ep = Episode(env, policy)
for (o, a, r, op) in ep
    # do some custom pre-processing if needed
    info("Observation $o, action $a, reward $r")
end

OpenAI Gym Like Interface

You can also simulate wrapped POMDPs problems in a similar way to OpenAI Gym.

using POMDPReinforce
import POMDPModels: GridWorld

env = MDPEnv(GridWorld())

s = reset!(env)
while !finished(env, s)
    a = rand(actions(env, s))
    r, sp = step!(env, s, a)
    info("State $s, action $a, reward $r")
    s = sp
end

About

Wrapper that turns POMDPs.jl problems into Reinforce.jl environments

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages