Ejemplo n.º 1
0
        public MasterSystem(ProgramArguments arguments, int size)
        {
            int rank = 0;

            LoadOptimiserParams(arguments);
            sceOptions = SceOptions.RndInSubComplex;
            if (arguments.SceOptions == "full")
            {
                sceOptions |= SceOptions.ReflectionRandomization;
            }

            OutputPath = arguments.OutputPath;
            // Ensure existance of some locations that are assumed to exist when writing the results
            if (!OutputPath.Exists)
            {
                OutputPath.Create();
            }

            RosenbrockIterations            = arguments.RosenbrockIterations.Clamp(MinRosenbrockIterations, MaxRosenbrockIterations);
            WallClock                       = arguments.WallClockHours.Clamp(MinWallClock, MaxWallClock);
            ConvergenceCriterionCvThreshold = arguments.ConvergenceCriterionCvThreshold.Clamp(MinConvergenceThreshold, MaxConvergenceThreshold);
            TerminationCriterion            = (TerminationCriteria)Enum.Parse(typeof(TerminationCriteria), arguments.TerminationCriterion);
            OptimisationMethod              = (OptimisationMethods)Enum.Parse(typeof(OptimisationMethods), arguments.OptimisationMethod);
            SeedParametersFile              = arguments.ParameterDefinitions.FullName;
            LogFileName                     = Path.Combine(arguments.OutputPath.FullName, arguments.LogFile);
            OutputFileName                  = Path.Combine(arguments.OutputPath.FullName, arguments.ResultsFile);
            TemplateParameterSet            = GridModelHelper.LoadParameterSpace(arguments.ParameterDefinitions.FullName);
            MpiSysConfig[] seedsPopulation = GridModelHelper.LoadParameterSets(arguments.SeedParameterSets, TemplateParameterSet);
            evaluator = new MultiCatchmentCompositeObjectiveEvaluator(
                arguments.GlobalDefinition, arguments.ObjectiveDefinition, arguments.CreateCompositeEvaluator(), rank, size);
            InMemoryLogger     = new InMemoryLogger();
            optimisationEngine = CreateEngine(evaluator, TemplateParameterSet, seedsPopulation, InMemoryLogger, arguments.Name, arguments.InitString);
        }
        /// <summary>
        /// Initialises a new instance of GenerationViewModel with the specified universe size.
        /// </summary>
        /// <param name="universeSize">Universesize.</param>
        public GenerationViewModel(int universeSize)
        {
            engine = new EvolutionEngine(new Generation(universeSize));

            EvolveCommand = new RelayCommand<object>(
                _ => EvolveGeneration(),
                _ => CanEvolveGeneration()
            );

            ResetCommand = new RelayCommand<object>(
                _ => ResetGame(),
                _ => CanResetGame()
            );

            ToggleCellLifeCommand = new RelayCommand<string>(
                (cellRowColumn) => ToggleCellLife(cellRowColumn),
                _ => CanToggleCellLife()
            );

            GenerationNumber = engine.CurrentGenerationNumber;
        }
Ejemplo n.º 3
0
 public void SetEvolutionEngine(IEvolutionEngine <T> engine)
 {
     this.rosen = engine as RosenbrockOptimizer <T, U>;
 }