Package org.rlcommunity.rlglue.codec.types

Examples of org.rlcommunity.rlglue.codec.types.Observation


        assert (thisAction.getInt(0) < 4) : "Action should be in [0,4], " + thisAction.getInt(0) + " was provided";

        theWorld.updatePosition(thisAction.getInt(0));


        Observation theObservation = new Observation(1, 0, 0);
        theObservation.setInt(0, theWorld.getState());
        Reward_observation_terminal RewardObs = new Reward_observation_terminal();
        RewardObs.setObservation(theObservation);
        RewardObs.setTerminal(theWorld.isTerminal());
        RewardObs.setReward(theWorld.getReward());
View Full Code Here


  public String handleAutomatically(EnvironmentInterface theEnvironment) {
    Vector<Observation> theObservations= new Vector<Observation>();
    getEnvObsForStateInterface castedEnv=(getEnvObsForStateInterface)theEnvironment;
   
    for(int i=0;i<theRequestStates.size();i++){
      Observation thisObs=castedEnv.getObservationForState(theRequestStates.get(i));
      theObservations.add(thisObs);
    }

    EnvObsForStateResponse theResponse = new EnvObsForStateResponse(theObservations);
    return theResponse.makeStringResponse();
View Full Code Here

        if(currentState>=20){
            currentState=20;
            episodeOver=true;
            theReward=1.0d;
        }
        Observation returnObservation=new Observation(1,0,0);
        returnObservation.intArray[0]=currentState;
       
        Reward_observation_terminal returnRewardObs=new Reward_observation_terminal(theReward,returnObservation,episodeOver);
        return returnRewardObs;
    }
View Full Code Here

                //Query the value function in the agent
                double positionVal = dataProvider.getMinValueForDim(0) + x * xQueryIncrement;
                double velocityVal = dataProvider.getMinValueForDim(1) + y * yQueryIncrement;

                Observation thisState = new Observation(0, 2);
                thisState.doubleArray[0] = positionVal;
                thisState.doubleArray[1] = velocityVal;
                thePoints.add(thisState);
            }
        }
View Full Code Here

        network.putInt(Network.sizeOf(taskSpec)); // This is different than taskSpec.length(). It also includes
        network.putString(taskSpec);
    }

    protected void onEnvStart() {
        Observation obs = env.env_start();

        network.clearSendBuffer();
        network.putInt(Network.kEnvStart);
        network.putInt(Network.sizeOf(obs));
        network.putObservation(obs);
View Full Code Here

    protected void onAgentStart() {
        if (debug) {
            System.out.println("\tonAgentStart()");
        }
        Observation observation = network.getObservation();
        if (debug) {
            System.out.println("\t\tgot observation");
        }
        Action action = agent.agent_start(observation);
        if (debug) {
View Full Code Here

        network.putAction(action);
    }

    protected void onAgentStep() {
        double reward = network.getDouble();
        Observation observation = network.getObservation();
        Action action = agent.agent_step(reward, observation);

        int size = Network.sizeOf(action);
        network.clearSendBuffer();
        network.putInt(Network.kAgentStep);
View Full Code Here

        checkInstance();
        if (!inited) {
            System.err.println("-- Warning From RLGlue :: RL_env_start() was called without RL_init().");
        }
        currentEpisodeOver = false;
        Observation returnObs = instance.RL_env_start();
        if (returnObs == null) {
            System.err.println("-- Warning From RLGlue :: RL_env_start() response was NULL, that should be impossible.");
            returnObs = new Observation();
        }
        return returnObs;
    }
View Full Code Here

        return returnString;

    }

    public Observation getObservation() {
        Observation returnVal = new Observation();
        fillAbstractType(returnVal);
        return returnVal;
    }
View Full Code Here

        numSteps = 0;
        return taskSpec;
    }

    public synchronized Observation_action RL_start() {
        Observation o = RL_env_start();
        lastAction = RL_agent_start(o);
        Observation_action ao = new Observation_action(o, lastAction);
        return ao;
    }
View Full Code Here

TOP

Related Classes of org.rlcommunity.rlglue.codec.types.Observation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.