public static void Main(string[] args)
        {
            _config = LoadConfig(args);
            File.Copy(_config.ConfigPath, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json"), true);

            var path = _config.AlgorithmLocation;

            if (!string.IsNullOrEmpty(path))
            {
                File.Copy(path, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.GetFileName(path)), true);
                var pdb = path.Replace(Path.GetExtension(path), ".pdb");
                if (File.Exists(pdb))
                {
                    File.Copy(pdb, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.GetFileName(pdb)), true);
                }
            }

            AppDomainManager.Initialize(_config);

            var instance = (OptimizerFitness)Assembly.GetExecutingAssembly().CreateInstance(_config.FitnessTypeName,
                                                                                            false, BindingFlags.Default, null,
                                                                                            new[] { _config }, null, null);

            var manager = new GeneManager(_config, instance);

            manager.Start();

            Console.ReadKey();
        }
示例#2
0
        public static void Main(string[] args)
        {
            _config = LoadConfig(args);
            string path = _config.ConfigPath;

            System.IO.File.Copy(path, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json"), true);

            path = _config.AlgorithmLocation;
            if (!string.IsNullOrEmpty(path))
            {
                System.IO.File.Copy(path, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.GetFileName(path)), true);
                string pdb = path.Replace(Path.GetExtension(path), ".pdb");
                if (File.Exists(pdb))
                {
                    System.IO.File.Copy(pdb, Path.Combine(AppDomain.CurrentDomain.BaseDirectory, Path.GetFileName(pdb)), true);
                }
            }

            _writerLock = new object();

            using (_writer = System.IO.File.AppendText("optimizer.txt"))
            {
                AppDomainManager.Initialize(_config);

                OptimizerFitness instance = (OptimizerFitness)System.Reflection.Assembly.GetExecutingAssembly().CreateInstance(_config.FitnessTypeName, false, BindingFlags.Default, null,
                                                                                                                               new[] { _config }, null, null);

                var manager = new GeneticManager(_config, instance, new LogManager());
                manager.Start();
            }

            Console.ReadKey();
        }