markusdumke/reinforcelearn

interact with OpenAI gyms

Opened this issue · 0 comments

Hi @markusdumke

I am trying to let an agent interact with the OpenAI MountainCar gym as seen here:

library(reinforcelearn)

# create gym env
env = makeEnvironment("gym", gym.name = "MountainCar-v0")

# create agent
policy = makePolicy("softmax")
values = makeValueFunction("table", n.states = env$n.states, n.actions = env$n.actions)
algorithm = makeAlgorithm("qlearning")
agent = makeAgent(policy, values, algorithm)

# interact
interact(env, agent, n.steps = 100, visualize = TRUE)

This throws me an error that env$n.states and env$n.actions are NULL. Upon testing multiple other OpenAI gyms I found that this is true for all of them. Is this intended? How do I get around this when trying to set up a gym environment?
Thanks for your time.