/** * 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)); }
public CommandLineStatistics(InterfaceStatisticsParameters statisticsParameters) { super(); this.statisticsParameters = statisticsParameters; this.runs = new ArrayList<>(statisticsParameters.getMultiRuns()); }