Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/03/19 14:49:46 (5 years ago)
Author:
abeham
Message:

#2521: Refactored ParetoFrontScatterPlot (moved from TestFunctions.MultiObjective to Analysis)

  • Introduced generic type that may work with all solution encodings
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/ScatterPlotAnalyzer.cs

    r17226 r17229  
    2121
    2222using System.Linq;
     23using HEAL.Attic;
     24using HeuristicLab.Analysis;
    2325using HeuristicLab.Common;
    2426using HeuristicLab.Core;
    25 using HeuristicLab.Data;
    2627using HeuristicLab.Encodings.RealVectorEncoding;
    2728using HeuristicLab.Optimization;
    2829using HeuristicLab.Parameters;
    29 using HEAL.Attic;
    3030
    3131namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
     
    3838    }
    3939
    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"]; }
    4242    }
    4343
     
    5151    public ScatterPlotAnalyzer() {
    5252      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)"));
    5454    }
    5555
     
    5858      var individuals = IndividualsParameter.ActualValue;
    5959      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;
    6261
    6362      var optimalFront = new double[0][];               
     
    7170      }
    7271
    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);
    7778      return base.Apply();
    7879    }
Note: See TracChangeset for help on using the changeset viewer.