All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.deeplearning4j.rl4j.space.Box Maven / Gradle / Ivy

There is a newer version: 1.0.0-beta2
Show newest version
package org.deeplearning4j.rl4j.space;

import org.json.JSONArray;

/**
 * @author rubenfiszel ([email protected]) on 7/8/16.
 *
 * A Box observation
 *
 * @see https://gym.openai.com/envs#box2d
 */
public class Box implements Encodable {

    private final double[] array;

    public Box(JSONArray arr) {

        int lg = arr.length();
        this.array = new double[lg];

        for (int i = 0; i < lg; i++) {
            this.array[i] = arr.getDouble(i);
        }
    }

    public double[] toArray() {
        return array;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy