/// <summary> /// Initializes a new instance of the <see cref="MasterArgumentParserTest"/> class. /// </summary> public MasterArgumentParserTest() { this._parser = new MasterArgumentParser(); }
/// <summary> /// Entry point to the program. /// </summary> /// <param name="args">If 'master' is included as argument, a /// <see cref="Master{TTargetAlgorithm,TInstance,TResult}"/> is starting using the provided arguments. /// Otherwise, a <see cref="Worker"/> is started with the provided arguments.</param> public static void Main(string[] args) { ProcessUtils.SetDefaultCultureInfo(CultureInfo.InvariantCulture); LoggingHelper.Configure($"parserLog_{ProcessUtils.GetCurrentProcessId()}.log"); // Parse gurobi configuration. var gurobiParser = new GurobiRunnerConfigurationParser(); if (!ArgumentParserUtils.ParseArguments(gurobiParser, args)) { return; } if (gurobiParser.IsPostTuningRunner) { LoggingHelper.Configure($"consoleOutput_PostTuningRun_{ProcessUtils.GetCurrentProcessId()}.log"); // Parse and build tuner configuration. var masterArgumentParser = new MasterArgumentParser(); if (!ArgumentParserUtils.ParseArguments(masterArgumentParser, gurobiParser.AdditionalArguments.ToArray())) { return; } var tunerConfig = masterArgumentParser.ConfigurationBuilder.Build(); LoggingHelper.ChangeConsoleLoggingLevel(tunerConfig.Verbosity); // Build gurobi configuration. var gurobiConfig = Program.BuildGurobiConfigAndCheckThreadCount(gurobiParser.ConfigurationBuilder, tunerConfig); var gurobiRunnerFactory = new GurobiRunnerFactory(gurobiConfig, tunerConfig); var parameterTree = GurobiUtils.CreateParameterTree(); // Start post tuning runner. var parallelPostTuningRunner = new ParallelPostTuningRunner <GurobiRunner, InstanceSeedFile, GurobiResult>( tunerConfig, gurobiParser.PostTuningConfiguration, gurobiRunnerFactory, parameterTree); parallelPostTuningRunner.ExecutePostTuningRunsInParallel(); return; } if (gurobiParser.IsMaster) { Master <GurobiRunner, InstanceSeedFile, GurobiResult, StandardRandomForestLearner <ReuseOldTreesStrategy>, GenomePredictionForestModel <GenomePredictionTree>, ReuseOldTreesStrategy> .Run( args : gurobiParser.AdditionalArguments.ToArray(), algorithmTunerBuilder : (algorithmTunerConfig, pathToInstanceFolder, pathToTestInstanceFolder) => Program.BuildGurobiRunner( algorithmTunerConfig, pathToInstanceFolder, pathToTestInstanceFolder, gurobiParser.ConfigurationBuilder)); } else { Worker.Run(gurobiParser.AdditionalArguments.ToArray()); } }