示例#1
0
文件: Main.java 项目: openea/eva2
  /**
   * This method takes a set of command line arguments and tries to construct OptimizationParameters
   * and StatisticsParameters from it. It will use defaults if not otherwise configured.
   *
   * @param args Command line arguments
   */
  private static void executeArguments(String[] args) {
    InterfaceOptimizationParameters parameters = OptimizationBuilder.parseOptimizerArguments(args);
    InterfaceStatisticsParameters statisticsParameters =
        OptimizationBuilder.parseStatisticsArguments(args);

    InterfaceTerminator terminator = parameters.getTerminator();
    InterfaceOptimizer optimizer = parameters.getOptimizer();
    InterfaceOptimizationProblem problem = parameters.getProblem();

    LinkedHashMap<String, Object> optimizationLog = new LinkedHashMap<>();
    // Meta parameters
    optimizationLog.put(
        "populationSize", parameters.getOptimizer().getPopulation().getTargetSize());
    optimizationLog.put("numberOfRuns", statisticsParameters.getMultiRuns());
    optimizationLog.put("seed", parameters.getRandomSeed());
    optimizationLog.put("problem", parameters.getProblem());

    CommandLineStatistics yamlStatistics = new CommandLineStatistics(statisticsParameters);

    /** Runs optimization */
    Processor optimizationProcessor = new Processor(yamlStatistics, parameters);
    optimizationProcessor.setSaveParams(false);
    optimizationProcessor.startOptimization();
    optimizationProcessor.runOptimizationOnce();

    /** Get run statistics */
    optimizationLog.put("runs", yamlStatistics.getRuns());

    /** Yaml configuration */
    DumperOptions options = new DumperOptions();
    options.setExplicitStart(true);
    options.setExplicitEnd(true);
    Yaml yaml = new Yaml();

    System.out.println(yaml.dump(optimizationLog));
  }
示例#2
0
文件: Main.java 项目: openea/eva2
 public CommandLineStatistics(InterfaceStatisticsParameters statisticsParameters) {
   super();
   this.statisticsParameters = statisticsParameters;
   this.runs = new ArrayList<>(statisticsParameters.getMultiRuns());
 }