Skip to content

Latest commit

 

History

46 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gym4j

Library for running Open AI gym in Java


Usage

I've setup a variety of ways to create any environment for full flexibility

try (Gym gym = new Gym()) {
//try (GymEnvironment<Box, Box> env = new GymEnvironment<Box,Box>("BipedalWalker-v2")) {
    try (BoxBoxEnvironment env = gym.makeBoxBox("BipedalWalker-v2")) {
//    try (BoxBoxEnvironment env = new BoxBoxEnvironment("BipedalWalker-v2", gym)) {
        final BoxSpace actionSpace = (BoxSpace) env.getActionSpace();
        final BoxSpace observationSpace = (BoxSpace) env.getObservationSpace();
        final Box initialState = env.reset();
        for (int i = 0; i < 1; i++) {
            final ActionResult<Box> result = env.step(new Box(1, 1, 1, 1));
            final Box observation = result.getObservation();
            final double reward = result.getReward();
            final boolean done = result.isDone();
        }
    }
}

Note: The GymEnvironment class is for utility, and is tightly coupled with its own Gym instance (a python subprocess).

About

Library for running Open AI gym in Java

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages