Changeset 17261 for branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.MOCMAEvolutionStrategy/3.3/MOCMAEvolutionStrategy.cs
- Timestamp:
- 09/17/19 16:49:35 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Algorithms.MOCMAEvolutionStrategy/3.3/MOCMAEvolutionStrategy.cs
r17226 r17261 33 33 using HeuristicLab.Optimization; 34 34 using HeuristicLab.Parameters; 35 using HeuristicLab.Problems.TestFunctions.MultiObjective;36 35 using HeuristicLab.Random; 37 36 … … 327 326 solutions = new Individual[PopulationSize]; 328 327 for (var i = 0; i < PopulationSize; i++) { 329 var x = new RealVector(Encoding.Length); // Uniform dist ibution in all dimensions assumed.328 var x = new RealVector(Encoding.Length); // Uniform distribution in all dimensions assumed. 330 329 var bounds = Encoding.Bounds; 331 330 for (var j = 0; j < Encoding.Length; j++) { … … 350 349 } 351 350 private void InitResults() { 352 Results.Add(new Result(IterationsResultName, "The number of ge rerations evaluated", new IntValue(0)));353 Results.Add(new Result(EvaluationsResultName, "The number of function eval tions performed", new IntValue(0)));354 Results.Add(new Result(HypervolumeResultName, "The hyper volume of the current front considering the Referencepoint defined in the Problem", new DoubleValue(0.0)));355 Results.Add(new Result(BestHypervolumeResultName, "The best hyper volume of the current run considering the Referencepoint defined in the Problem", new DoubleValue(0.0)));356 Results.Add(new Result(BestKnownHypervolumeResultName, "The best kn won hypervolume considering the Referencepoint defined in the Problem", new DoubleValue(double.NaN)));357 Results.Add(new Result(DifferenceToBestKnownHypervolumeResultName, "The difference between the current and the best known hyper volume", new DoubleValue(double.NaN)));358 Results.Add(new Result(GenerationalDistanceResultName, "The generational distance to an optimal pareto front defined in the Problem", new DoubleValue(double.NaN)));359 Results.Add(new Result(InvertedGenerationalDistanceResultName, "The inverted generational distance to an optimal pareto front defined in the Problem", new DoubleValue(double.NaN)));351 Results.Add(new Result(IterationsResultName, "The number of generations evaluated", new IntValue(0))); 352 Results.Add(new Result(EvaluationsResultName, "The number of function evaluations performed", new IntValue(0))); 353 Results.Add(new Result(HypervolumeResultName, "The hyper volume of the current front considering the reference point defined in the Problem", new DoubleValue(0.0))); 354 Results.Add(new Result(BestHypervolumeResultName, "The best hyper volume of the current run considering the reference point defined in the Problem", new DoubleValue(0.0))); 355 Results.Add(new Result(BestKnownHypervolumeResultName, "The best known hyper volume considering the reference point defined in the Problem", new DoubleValue(double.NaN))); 356 Results.Add(new Result(DifferenceToBestKnownHypervolumeResultName, "The difference between the current and the best known hyper volume", new DoubleValue(double.NaN))); 357 Results.Add(new Result(GenerationalDistanceResultName, "The generational distance to an optimal Pareto front defined in the Problem", new DoubleValue(double.NaN))); 358 Results.Add(new Result(InvertedGenerationalDistanceResultName, "The inverted generational distance to an optimal Pareto front defined in the Problem", new DoubleValue(double.NaN))); 360 359 Results.Add(new Result(CrowdingResultName, "The average crowding value for the current front (excluding infinities)", new DoubleValue(0.0))); 361 360 Results.Add(new Result(SpacingResultName, "The spacing for the current front (excluding infinities)", new DoubleValue(0.0))); … … 369 368 table.Rows.Add(new DataRow(DifferenceToBestKnownHypervolumeResultName)); 370 369 table.Rows.Add(new DataRow(SpacingResultName)); 371 Results.Add(new Result(TimetableResultName, "Different quality meas sures in a timeseries", table));370 Results.Add(new Result(TimetableResultName, "Different quality measures in a time series", table)); 372 371 Results.Add(new Result(CurrentFrontResultName, "The current front", new DoubleMatrix())); 373 Results.Add(new Result(ScatterPlotResultName, "A scatter plot displaying the evaluated solutions and (if available) the analytically optimal front", new ParetoFrontScatterPlot()));372 Results.Add(new Result(ScatterPlotResultName, "A scatter plot displaying the evaluated solutions and (if available) the analytically optimal front", new ParetoFrontScatterPlot())); 374 373 375 374 var problem = Problem; … … 455 454 456 455 private void SelectParents(IReadOnlyList<Individual> parents, int length) { 457 //perform a non dominated sort to assign the rank to every element456 //perform a non-dominated sort to assign the rank to every element 458 457 int[] ranks; 459 458 var fronts = DominationCalculator.CalculateAllParetoFronts(parents.ToArray(), parents.Select(i => i.PenalizedFitness).ToArray(), Problem.Maximization, out ranks); … … 469 468 } 470 469 471 //now use the indicator to deselect the approximat ingly worst elements of the last selected front470 //now use the indicator to deselect the approximately worst elements of the last selected front 472 471 var front1 = fronts[rank].OrderBy(x => x.Item1.PenalizedFitness[0]).ToList(); 473 472 for (; popSize > length; popSize--) { … … 501 500 if (qualities.Length == 0) return; 502 501 ResultsCrowding = CrowdingCalculator.CalculateCrowding(qualities); 503 ResultsSpacing = Spacing .Calculate(qualities);504 505 506 ResultsGenerationalDistance = problem.BestKnownFront != null ? GenerationalDistance .Calculate(qualities, problem.BestKnownFront, 1) : double.NaN;507 ResultsInvertedGenerationalDistance = problem.BestKnownFront != null ? InvertedGenerationalDistance.Calculate(qualities, problem.BestKnownFront, 1) : double.NaN;502 ResultsSpacing = SpacingAnalyzer.CalculateSpacing(qualities); 503 504 505 ResultsGenerationalDistance = problem.BestKnownFront != null ? GenerationalDistanceAnalyzer.CalculateGenerationalDistance(qualities, problem.BestKnownFront, 1) : double.NaN; 506 ResultsInvertedGenerationalDistance = problem.BestKnownFront != null ? GenerationalDistanceAnalyzer.CalculateInverseGenerationalDistance(qualities, problem.BestKnownFront, 1) : double.NaN; 508 507 ResultsHypervolume = problem.ReferencePoint != null ? HypervolumeCalculator.CalculateHypervolume(qualities, problem.ReferencePoint, Problem.Maximization) : double.NaN; 509 508 ResultsBestHypervolume = Math.Max(ResultsHypervolume, ResultsBestHypervolume);
Note: See TracChangeset
for help on using the changeset viewer.