Example #1
0
  public static void main(String[] args) {
    long seed = RND.initializeTime();
    //        long seed = 12341957678627684L;
    System.out.println("INITIALIZED SEED: " + seed);
    RND.initialize(seed);

    if (args.length == 0) {
      throw new IllegalArgumentException("Missing parameters!");
    }

    ParameterMatrixManager manager = ParameterMatrixStorage.load(new File(args[0]));

    ReportStorage reportStorage;

    if (args.length > 1) {
      reportStorage = new ReportStorage(args[1]);

    } else {
      reportStorage = new ReportStorage();
    }

    reportStorage.startAll(seed, manager);
    reportStorage.openExperimentsOverallResults();
    for (ParameterCombination combination : manager) {
      int experiments = combination.getInteger("EXPERIMENTS");

      Stats stats = prepareStats();

      reportStorage.storeParameters(combination.toStringAllSeparatedNewLines());

      for (int i = 1; i <= experiments; i++) {
        reportStorage.startSingleRun();

        System.out.println("PARAMETER SETTING: " + combination);

        EvolutionaryAlgorithmRunner runnerEA;

        String solver = combination.getString("SOLVER");
        if (solver.equals("GP")) {
          initializeGP(combination);
          runnerEA = new GPRunner(combination);
        } else if (solver.equals("MOGP")) {
          initializeMOGP(combination);
          runnerEA = new MOGPRunner(combination);
        } else if (solver.equals("GPAT")) {
          initializeGP(combination);
          runnerEA = new GPATRunner(combination);
        } else if (solver.equals("NEAT")) {
          initializeNEAT(combination);
          runnerEA = new NEATRunner(combination);
        } else {
          throw new IllegalStateException("Unknown SOLVER: " + solver + ".");
        }

        Utils.setStaticParameters(combination, GP.class, "GP");
        Utils.setStaticParameters(combination, GEP.class, "GEP");
        Utils.setStaticParameters(combination, GPAAC.class, "GPAAC");
        Utils.setStaticParameters(combination, GPEFS.class, "GPEFS");
        Utils.setStaticParameters(combination, GPAT.class, "GPAT");
        Utils.setStaticParameters(combination, GPATSimple.class, "GPATS");

        runnerEA.run(stats, reportStorage);

        reportStorage.storeSingleRunResults();
        reportStorage.incrementExperimentId();
      }
      reportStorage.storeExperimentResults(stats);
      reportStorage.appendExperimentsOverallResults(combination.toStringOnlyChannging(), stats);
      System.out.println(stats.scopeToString("EXPERIMENT"));
      reportStorage.prepareNewParameterCombination();
    }
    reportStorage.closeExperimentsOverallResults();
    SoundHelper.playSoundFile("/System/Library/Sounds/Glass.aiff");
    String experimentDirectory = args.length > 1 ? "(" + args[1] + ")" : "";
    XMPPHelper.sendViaXMPP("NE run (Runner) finished " + experimentDirectory + ".");
  }
Example #2
0
 private static void initializeMOGP(ParameterCombination combination) {
   GP.MAX_GENERATIONS = combination.getInteger("GP.MAX_GENERATIONS");
   GP.MAX_EVALUATIONS = combination.getInteger("GP.MAX_EVALUATIONS");
   GP.POPULATION_SIZE = combination.getInteger("GP.POPULATION_SIZE");
   GP.TARGET_FITNESS = combination.getDouble("GP.TARGET_FITNESS");
 }