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

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

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

import lombok.Getter;

import java.util.Random;

/**
 * @author rubenfiszel ([email protected]) on 7/8/16.
 *         

* A discrete space of action. A discrete space is always isomorphic * to a space of integer so we can parametrize directly by Integer. * Benefit of using Integers directly is that you can use it as the * id of the node assigned to that action in the outpout of a DQN. */ public class DiscreteSpace implements ActionSpace { //size of the space also defined as the number of different actions @Getter final protected int size; final protected Random rd; public DiscreteSpace(int size) { this.size = size; rd = new Random(); } public Integer randomAction() { return rd.nextInt(size); } public Object encode(Integer a) { return a; } public Integer noOp() { return 0; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy