public static void score(Agent agent, int startingSeed) {
    killsSum = 0;
    marioStatusSum = 0;
    timeLeftSum = 0;
    marioModeSum = 0;
    TimingAgent controller = new TimingAgent(agent);
    //        RegisterableAgent.registerAgent (controller);
    EvaluationOptions options = new CmdLineOptions(new String[0]);

    //        options.setNumberOfTrials(1);
    options.setVisualization(false);
    options.setFPS(GlobalOptions.MaxFPS);
    System.out.println("Scoring controller " + controller + " with starting seed " + startingSeed);

    double competitionScore = 0;

    competitionScore += testConfig(controller, options, startingSeed, 0, false);
    competitionScore += testConfig(controller, options, startingSeed, 3, false);
    competitionScore += testConfig(controller, options, startingSeed, 5, false);
    competitionScore += testConfig(controller, options, startingSeed, 10, false);
    System.out.println("Competition score: " + competitionScore + "\n\n");
    System.out.println("Number of levels cleared = " + marioStatusSum);
    System.out.println("Additional (tie-breaker) info: ");
    System.out.println("Total time left = " + timeLeftSum);
    System.out.println("Total kills = " + killsSum);
    System.out.println("Mario mode (small, large, fire) sum = " + marioModeSum);
  }
Пример #2
0
 public static void main(String[] args) {
   EvaluationOptions options = new CmdLineOptions(new String[0]);
   options.setNumberOfTrials(1);
   options.setPauseWorld(false);
   Evolvable initial = new SimpleMLPAgent();
   //        RegisterableAgent.registerAgent ((Agent) initial);
   options.setMaxFPS(true);
   options.setLevelDifficulty(0);
   options.setVisualization(false);
   ProgressTask task = new ProgressTask(options);
   options.setLevelRandSeed((int) (Math.random() * Integer.MAX_VALUE));
   ES es = new ES(task, initial, populationSize);
   System.out.println("Evolving " + initial + " with task " + task);
   final String fileName = "evolved" + (int) (Math.random() * Integer.MAX_VALUE) + ".xml";
   for (int gen = 0; gen < generations; gen++) {
     es.nextGeneration();
     double bestResult = es.getBestFitnesses()[0];
     System.out.println("Generation " + gen + " best " + bestResult);
     Easy.save(es.getBests()[0], fileName);
   }
   Stats.main(new String[] {fileName, "1"});
 }