Exemplo n.º 1
0
  protected void onAgentCleanup() {
    agent.agent_cleanup();

    network.clearSendBuffer();
    network.putInt(Network.kAgentCleanup);
    network.putInt(0); // No data in this packet
  }
Exemplo n.º 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);
  }
Exemplo n.º 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
  }
Exemplo n.º 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);
  }
Exemplo n.º 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
  }
Exemplo n.º 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);
  }