/// <inheritdoc /> protected override void InitializeContinuousOptimizer( Population basePopulation, IncumbentGenomeWrapper <TResult> currentIncumbent) { if (basePopulation == null) { throw new ArgumentNullException(nameof(basePopulation)); } if (currentIncumbent == null) { LoggingHelper.WriteLine( VerbosityLevel.Warn, "CMA-ES with focus on incumbent can only be executed if an incumbent exists, i.e. it is not possible to run it on its own."); throw new ArgumentNullException(nameof(currentIncumbent)); } // We do not reuse anything from potential old configurations, because old information may be // outdated at the point a new phase is started. var initialMean = PartialGenomeSearchPoint.CreateFromGenome( currentIncumbent.IncumbentGenome, this.ParameterTree, this.StrategyConfiguration.MinimumDomainSize).Values; var cmaEsConfiguration = new CmaEsConfiguration( populationSize: basePopulation.CompetitiveCount, initialDistributionMean: initialMean, initialStepSize: this.StrategyConfiguration.InitialStepSize); this._cmaEsRunner = this.CreateCmaEsRunner(evaluationBase: currentIncumbent.IncumbentGenome); this._cmaEsRunner.Initialize(cmaEsConfiguration, this.CreateTerminationCriteria()); }
/// <summary> /// Creates a new <see cref="CmaEs{TSearchPoint}"/> which evaluates points based on the provided /// <see cref="Genome"/>. /// </summary> /// <param name="evaluationBase">The <see cref="Genome"/> determining discrete parameters.</param> /// <returns>The newly created <see cref="CmaEs{TSearchPoint}"/>.</returns> private CmaEs <PartialGenomeSearchPoint> CreateCmaEsRunner(Genome evaluationBase) { PartialGenomeSearchPoint.ObtainParameterBounds( this.ParameterTree, this.StrategyConfiguration.MinimumDomainSize, out var lowerBounds, out var upperBounds); var converter = new GenomeSearchPointConverter(this.ParameterTree, this.StrategyConfiguration.MinimumDomainSize); this._searchPointFactory = vector => new PartialGenomeSearchPoint(new ImmutableGenome(evaluationBase), vector, converter, this._genomeBuilder, lowerBounds, upperBounds); return(new CmaEs <PartialGenomeSearchPoint>(this.SearchPointSorter, this._searchPointFactory)); }