Example #1
0
  /** Prints StatisticsData structures to local logs. */
  public void printStatistics(final EvolutionState state, StatisticsData data) {
    int log = -6;
    String sender;

    EvolutionAgent agent = (EvolutionAgent) state;

    sender = data.sender.name;
    if (logtable.containsKey(sender)) log = ((Integer) logtable.get(sender)).intValue();
    else log = addLog(state, sender);
    if (log < 0) {
      if (defaultlog < 0) defaultlog = addLog(state, agent.getName());
      state.output.message(
          "Received a stats message from an unknown sender, will be logged to: "
              + ((Integer) logtable.get(new Integer(defaultlog))).intValue());
      log = defaultlog;
    }
    state.output.println(data.toStringForHumans(), Output.V_NO_GENERAL, log);

    if (store_best && data.finalStats) {
      for (int i = 0; i < data.best_of_run.length; i++)
        storeIndividual(
            state,
            basefilename + data.sender.name.substring(data.sender.name.lastIndexOf(".")) + ".best",
            data.best_of_run[i]);
    }
  }