예제 #1
0
  protected void onAgentCleanup() {
    agent.agent_cleanup();

    network.clearSendBuffer();
    network.putInt(Network.kAgentCleanup);
    network.putInt(0); // No data in this packet
  }
예제 #2
0
  protected void onAgentMessage() throws UnsupportedEncodingException {
    String message = network.getString();
    String reply = agent.agent_message(message);

    network.clearSendBuffer();
    network.putInt(Network.kAgentMessage);
    network.putInt(Network.sizeOf(reply));
    network.putString(reply);
  }
예제 #3
0
  protected void onAgentEnd() {
    // int size = network.getInt();
    double reward = network.getDouble();

    agent.agent_end(reward);

    network.clearSendBuffer();
    network.putInt(Network.kAgentEnd);
    network.putInt(0); // No data in this packet
  }
예제 #4
0
  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);
    network.putInt(size);
    network.putAction(action);
  }
예제 #5
0
  protected void onAgentInit() throws UnsupportedEncodingException {
    String taskSpec = network.getString();

    agent.agent_init(taskSpec);

    network.clearSendBuffer();
    network.putInt(Network.kAgentInit);
    // BTANNER: Sept 16 2008.. why are we putting this here?
    // OH, it's the size!  Ok.  I think.
    network.putInt(0); // No data following this header
  }
예제 #6
0
  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) {
      System.out.println("\t\tgot action");
    }

    int size = Network.sizeOf(action);

    network.clearSendBuffer();
    network.putInt(Network.kAgentStart);
    network.putInt(size);
    network.putAction(action);
  }