Changeset 17229 for branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers
- Timestamp:
- 09/03/19 14:49:46 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/ScatterPlotAnalyzer.cs
r17226 r17229 21 21 22 22 using System.Linq; 23 using HEAL.Attic; 24 using HeuristicLab.Analysis; 23 25 using HeuristicLab.Common; 24 26 using HeuristicLab.Core; 25 using HeuristicLab.Data;26 27 using HeuristicLab.Encodings.RealVectorEncoding; 27 28 using HeuristicLab.Optimization; 28 29 using HeuristicLab.Parameters; 29 using HEAL.Attic;30 30 31 31 namespace HeuristicLab.Problems.TestFunctions.MultiObjective { … … 38 38 } 39 39 40 public IResultParameter<ParetoFrontScatterPlot > ScatterPlotResultParameter {41 get { return (IResultParameter<ParetoFrontScatterPlot >)Parameters["Scatterplot"]; }40 public IResultParameter<ParetoFrontScatterPlot<RealVector>> ScatterPlotResultParameter { 41 get { return (IResultParameter<ParetoFrontScatterPlot<RealVector>>)Parameters["Scatterplot"]; } 42 42 } 43 43 … … 51 51 public ScatterPlotAnalyzer() { 52 52 Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Individuals", "The individual solutions to the problem")); 53 Parameters.Add(new ResultParameter<ParetoFrontScatterPlot >("Scatterplot", "The scatterplot for the current and optimal (if known front)"));53 Parameters.Add(new ResultParameter<ParetoFrontScatterPlot<RealVector>>("Scatterplot", "The scatterplot for the current and optimal (if known front)")); 54 54 } 55 55 … … 58 58 var individuals = IndividualsParameter.ActualValue; 59 59 var testFunction = TestFunctionParameter.ActualValue; 60 var objectives = qualities.Length != 0 ? qualities[0].Length:0; 61 var problemSize = individuals.Length != 0 ? individuals[0].Length:0; 60 var objectives = qualities.Length != 0 ? qualities[0].Length:0; 62 61 63 62 var optimalFront = new double[0][]; … … 71 70 } 72 71 73 var qualityClones = qualities.Select(s => s.ToArray()).ToArray(); 74 var solutionClones = individuals.Select(s => s.ToArray()).ToArray(); 75 76 ScatterPlotResultParameter.ActualValue = new ParetoFrontScatterPlot(qualityClones, solutionClones, optimalFront, objectives, problemSize); 72 var fronts = DominationCalculator.CalculateAllParetoFronts(individuals.ToArray(), qualities.Select(x => x.ToArray()).ToArray(), testFunction.Maximization(objectives), out var rank); 73 74 ScatterPlotResultParameter.ActualValue = new ParetoFrontScatterPlot<RealVector>( 75 fronts.Select(x => x.Select(y => y.Item2).ToArray()).ToArray(), 76 fronts.Select(x => x.Select(y => y.Item1).ToArray()).ToArray(), 77 optimalFront, objectives); 77 78 return base.Apply(); 78 79 }
Note: See TracChangeset
for help on using the changeset viewer.