Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/11/17 19:36:03 (8 years ago)
Author:
pfleck
Message:

#2592

  • Renamed ScatterPlotContent to ParetoFrontScatterPlot (also renamed corresponding view).
  • Refactored ParetoFrontScatterPlotView (use ScatterPlot internally).
Location:
trunk/sources/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3
Files:
2 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/ScatterPlotAnalyzer.cs

    r14111 r15203  
    3737    }
    3838
    39     public IResultParameter<ScatterPlotContent> ScatterPlotResultParameter {
    40       get { return (IResultParameter<ScatterPlotContent>)Parameters["Scatterplot"]; }
     39    public IResultParameter<ParetoFrontScatterPlot> ScatterPlotResultParameter {
     40      get { return (IResultParameter<ParetoFrontScatterPlot>)Parameters["Scatterplot"]; }
    4141    }
    4242
     
    5151    public ScatterPlotAnalyzer() {
    5252      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Individuals", "The individual solutions to the problem"));
    53       Parameters.Add(new ResultParameter<ScatterPlotContent>("Scatterplot", "The scatterplot for the current and optimal (if known front)"));
     53      Parameters.Add(new ResultParameter<ParetoFrontScatterPlot>("Scatterplot", "The scatterplot for the current and optimal (if known front)"));
    5454
    5555    }
     
    5757    public override IOperation Apply() {
    5858      var qualities = QualitiesParameter.ActualValue;
     59      var individuals = IndividualsParameter.ActualValue;
    5960      var testFunction = TestFunctionParameter.ActualValue;
    6061      int objectives = qualities[0].Length;
    61       var individuals = IndividualsParameter.ActualValue;
     62      int problemSize = individuals[0].Length;
    6263
    6364      double[][] optimalFront = new double[0][];
     
    6869      var solutionClones = individuals.Select(s => s.ToArray()).ToArray();
    6970
    70       ScatterPlotResultParameter.ActualValue = new ScatterPlotContent(qualityClones, solutionClones, optimalFront, objectives);
     71      ScatterPlotResultParameter.ActualValue = new ParetoFrontScatterPlot(qualityClones, solutionClones, optimalFront, objectives, problemSize);
    7172
    7273      return base.Apply();
  • trunk/sources/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3.csproj

    r14168 r15203  
    111111    <Compile Include="Calculators\InvertedGenerationalDistance.cs" />
    112112    <Compile Include="Calculators\GenerationalDistance.cs" />
    113     <Compile Include="ScatterPlotContent.cs" />
     113    <Compile Include="ParetoFrontScatterPlot.cs" />
    114114    <Compile Include="Utilities.cs" />
    115115    <Compile Include="Instances\MISCInstanceProvider.cs" />
  • trunk/sources/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/ParetoFrontScatterPlot.cs

    r15202 r15203  
    1919 */
    2020#endregion
     21
    2122using System.Linq;
    2223using HeuristicLab.Common;
     
    2627namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
    2728  [StorableClass]
    28   [Item("ScatterPlot", "The optimal front, current front and its associated Points in the searchspace")]
    29   public class ScatterPlotContent : Item {
     29  [Item("Pareto Front Scatter Plot", "The optimal front, current front and its associated Points in the searchspace")]
     30  public class ParetoFrontScatterPlot : Item {
     31
     32    [Storable]
     33    private int objectives;
     34    public int Objectives {
     35      get { return objectives; }
     36    }
     37
     38    [Storable]
     39    private int problemSize;
     40    public int ProblemSize {
     41      get { return problemSize; }
     42    }
    3043
    3144    [Storable]
    3245    private double[][] qualities;
    3346    public double[][] Qualities {
    34       get {
    35         return qualities;
    36       }
    37 
    38       private set {
    39         qualities = value;
    40       }
    41     }
    42 
    43     [Storable]
    44     private int objectives;
    45     public int Objectives {
    46       get {
    47         return objectives;
    48       }
    49 
    50       private set {
    51         objectives = value;
    52       }
     47      get { return qualities; }
    5348    }
    5449
     
    5651    private double[][] solutions;
    5752    public double[][] Solutions {
    58       get {
    59         return solutions;
    60       }
    61 
    62       private set {
    63         solutions = value;
    64       }
     53      get { return solutions; }
    6554    }
    6655
     
    6857    private double[][] paretoFront;
    6958    public double[][] ParetoFront {
    70       get {
    71         return paretoFront;
    72       }
    73 
    74       private set {
    75         paretoFront = value;
    76       }
     59      get { return paretoFront; }
    7760    }
    7861
    79     [StorableConstructor]
    80     protected ScatterPlotContent(bool deserializing) : base() { }
    81 
    82     protected ScatterPlotContent(ScatterPlotContent original, Cloner cloner)
    83       : this() {
    84       this.qualities = original.qualities.Select(s => s.ToArray()).ToArray();
    85       this.solutions = original.solutions.Select(s => s.ToArray()).ToArray();
    86       this.paretoFront = original.paretoFront.Select(s => s.ToArray()).ToArray();
    87       this.objectives = original.objectives;
    88     }
    89     protected ScatterPlotContent() : base() { }
    90     public ScatterPlotContent(double[][] qualities, double[][] solutions, double[][] paretoFront, int objectives) {
     62    #region Constructor, Cloning & Persistance
     63    public ParetoFrontScatterPlot(double[][] qualities, double[][] solutions, double[][] paretoFront, int objectives, int problemSize) {
    9164      this.qualities = qualities;
    9265      this.solutions = solutions;
    9366      this.paretoFront = paretoFront;
    9467      this.objectives = objectives;
     68      this.problemSize = problemSize;
     69    }
     70    public ParetoFrontScatterPlot() { }
     71
     72    protected ParetoFrontScatterPlot(ParetoFrontScatterPlot original, Cloner cloner)
     73      : base(original, cloner) {
     74      if (original.qualities != null) qualities = original.qualities.Select(s => s.ToArray()).ToArray();
     75      if (original.solutions != null) solutions = original.solutions.Select(s => s.ToArray()).ToArray();
     76      if (original.paretoFront != null) paretoFront = original.paretoFront.Select(s => s.ToArray()).ToArray();
     77      objectives = original.objectives;
     78      problemSize = original.problemSize;
     79    }
     80    public override IDeepCloneable Clone(Cloner cloner) {
     81      return new ParetoFrontScatterPlot(this, cloner);
    9582    }
    9683
    97     public override IDeepCloneable Clone(Cloner cloner) {
    98       return new ScatterPlotContent(this, cloner);
    99     }
     84    [StorableConstructor]
     85    protected ParetoFrontScatterPlot(bool deserializing)
     86      : base(deserializing) { }
     87    #endregion
    10088  }
    10189}
Note: See TracChangeset for help on using the changeset viewer.