Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/20/18 14:53:51 (6 years ago)
Author:
bwerth
Message:

#2943 worked on MOBasicProblem and MOAnalyzers

Location:
branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective

    • Property svn:mergeinfo changed (with no actual effect on merging)
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/CrowdingAnalyzer.cs

    r16171 r16310  
    3030namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
    3131  [StorableClass]
    32   [Item("CrowdingAnalyzer", "The mean crowding distance for each point of the Front (see Multi-Objective Performance Metrics - Shodhganga for more information)")]
     32  [Item("CrowdingAnalyzer", "This analyzer is functionally equivalent to the CrowdingAnalyzer in HeuristicLab.Analysis, but is kept as not to break backwards compatibility")]
    3333  public class CrowdingAnalyzer : MOTFAnalyzer {
    3434
    35     public IResultParameter<DoubleValue> CrowdingResultParameter {
    36       get { return (IResultParameter<DoubleValue>)Parameters["Crowding"]; }
    37     }
     35    public IResultParameter<DoubleValue> CrowdingResultParameter => (IResultParameter<DoubleValue>)Parameters["Crowding"];
    3836
    3937    [StorableConstructor]
    4038    protected CrowdingAnalyzer(bool deserializing) : base(deserializing) { }
    41     public CrowdingAnalyzer(CrowdingAnalyzer original, Cloner cloner)
    42       : base(original, cloner) {
    43     }
     39    public CrowdingAnalyzer(CrowdingAnalyzer original, Cloner cloner): base(original, cloner) {}
    4440    public override IDeepCloneable Clone(Cloner cloner) {
    4541      return new CrowdingAnalyzer(this, cloner);
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/GenerationalDistanceAnalyzer.cs

    r16171 r16310  
    3131namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
    3232  [StorableClass]
    33   [Item("GenerationalDistanceAnalyzer", "The generational distance between the current and the best known front (see Multi-Objective Performance Metrics - Shodhganga for more information)")]
     33  [Item("GenerationalDistanceAnalyzer", "This analyzer is functionally equivalent to the GenerationalDistanceAnalyzer in HeuristicLab.Analysis, but is kept as not to break backwards compatibility")]
    3434  public class GenerationalDistanceAnalyzer : MOTFAnalyzer {
    3535
    3636    private IFixedValueParameter<DoubleValue> DampeningParameter {
    37       get { return (IFixedValueParameter<DoubleValue>)Parameters["Dampening"]; }
    38       set { Parameters["Dampening"].ActualValue = value; }
     37      get => (IFixedValueParameter<DoubleValue>)Parameters["Dampening"];
     38      set => Parameters["Dampening"].ActualValue = value;
    3939    }
    4040
    4141    public double Dampening {
    42       get { return DampeningParameter.Value.Value; }
    43       set { DampeningParameter.Value.Value = value; }
     42      get => DampeningParameter.Value.Value;
     43      set => DampeningParameter.Value.Value = value;
    4444    }
    4545
    46     public IResultParameter<DoubleValue> GenerationalDistanceResultParameter {
    47       get { return (IResultParameter<DoubleValue>)Parameters["Generational Distance"]; }
    48     }
     46    public IResultParameter<DoubleValue> GenerationalDistanceResultParameter => (IResultParameter<DoubleValue>)Parameters["Generational Distance"];
    4947
    5048    [StorableConstructor]
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/HypervolumeAnalyzer.cs

    r16171 r16310  
    3232namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
    3333  [StorableClass]
    34   [Item("HypervolumeAnalyzer", "Computes the enclosed Hypervolume between the current front and a given reference Point")]
     34  [Item("HypervolumeAnalyzer", "This analyzer is functionally equivalent to the HypervolumeAnalyzer in HeuristicLab.Analysis, but is kept as not to break backwards compatibility")]
    3535  public class HypervolumeAnalyzer : MOTFAnalyzer {
    3636
    37     public ILookupParameter<DoubleArray> ReferencePointParameter {
    38       get { return (ILookupParameter<DoubleArray>)Parameters["ReferencePoint"]; }
    39     }
    40     public IResultParameter<DoubleValue> HypervolumeResultParameter {
    41       get { return (IResultParameter<DoubleValue>)Parameters["Hypervolume"]; }
    42     }
    43     public IResultParameter<DoubleValue> BestKnownHypervolumeResultParameter {
    44       get { return (IResultParameter<DoubleValue>)Parameters["Best known hypervolume"]; }
    45     }
    46     public IResultParameter<DoubleValue> HypervolumeDistanceResultParameter {
    47       get { return (IResultParameter<DoubleValue>)Parameters["Absolute Distance to BestKnownHypervolume"]; }
    48     }
     37    public ILookupParameter<DoubleArray> ReferencePointParameter => (ILookupParameter<DoubleArray>)Parameters["ReferencePoint"];
     38
     39    public IResultParameter<DoubleValue> HypervolumeResultParameter => (IResultParameter<DoubleValue>)Parameters["Hypervolume"];
     40
     41    public IResultParameter<DoubleValue> BestKnownHypervolumeResultParameter => (IResultParameter<DoubleValue>)Parameters["Best known hypervolume"];
     42
     43    public IResultParameter<DoubleValue> HypervolumeDistanceResultParameter => (IResultParameter<DoubleValue>)Parameters["Absolute Distance to BestKnownHypervolume"];
    4944
    5045
    5146    [StorableConstructor]
    52     protected HypervolumeAnalyzer(bool deserializing)
    53       : base(deserializing) {
    54     }
     47    protected HypervolumeAnalyzer(bool deserializing) : base(deserializing) {}
    5548
    56     protected HypervolumeAnalyzer(HypervolumeAnalyzer original, Cloner cloner)
    57       : base(original, cloner) {
    58     }
     49    protected HypervolumeAnalyzer(HypervolumeAnalyzer original, Cloner cloner) : base(original, cloner) {}
     50
    5951    public override IDeepCloneable Clone(Cloner cloner) {
    6052      return new HypervolumeAnalyzer(this, cloner);
     
    6961      BestKnownHypervolumeResultParameter.DefaultValue = new DoubleValue(0);
    7062      HypervolumeDistanceResultParameter.DefaultValue = new DoubleValue(0);
    71 
    72 
    7363    }
    7464
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/InvertedGenerationalDistanceAnalyzer.cs

    r16171 r16310  
    3030namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
    3131  [StorableClass]
    32   [Item("InvertedGenerationalDistanceAnalyzer", "The inverted generational distance between the current and the best known front (see Multi-Objective Performance Metrics - Shodhganga for more information)")]
     32  [Item("InvertedGenerationalDistanceAnalyzer", "This analyzer is functionally equivalent to the InvertedGenerationalDistanceAnalyzer in HeuristicLab.Analysis, but is kept as not to break backwards compatibility")]
    3333  public class InvertedGenerationalDistanceAnalyzer : MOTFAnalyzer {
    34     public override bool EnabledByDefault { get { return false; } }
     34    public override bool EnabledByDefault => false;
    3535
    36     private IFixedValueParameter<DoubleValue> DampeningParameter {
    37       get { return (IFixedValueParameter<DoubleValue>)Parameters["Dampening"]; }
     36    private IFixedValueParameter<DoubleValue> DampeningParameter => (IFixedValueParameter<DoubleValue>)Parameters["Dampening"];
     37
     38    public double Dampening {
     39      get => DampeningParameter.Value.Value;
     40      set => DampeningParameter.Value.Value = value;
    3841    }
    3942
    40     public double Dampening {
    41       get { return DampeningParameter.Value.Value; }
    42       set { DampeningParameter.Value.Value = value; }
    43     }
    44 
    45     public IResultParameter<DoubleValue> InvertedGenerationalDistanceResultParameter {
    46       get { return (IResultParameter<DoubleValue>)Parameters["Inverted Generational Distance"]; }
    47     }
     43    public IResultParameter<DoubleValue> InvertedGenerationalDistanceResultParameter => (IResultParameter<DoubleValue>)Parameters["Inverted Generational Distance"];
    4844
    4945    [StorableConstructor]
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/MOTFAnalyzer.cs

    r15583 r16310  
    3333  [StorableClass]
    3434  public abstract class MOTFAnalyzer : SingleSuccessorOperator, IMultiObjectiveTestFunctionAnalyzer {
    35     public virtual bool EnabledByDefault { get { return true; } }
     35    public virtual bool EnabledByDefault => true;
    3636
    37     public IScopeTreeLookupParameter<DoubleArray> QualitiesParameter {
    38       get { return (IScopeTreeLookupParameter<DoubleArray>)Parameters["Qualities"]; }
    39     }
     37    public IScopeTreeLookupParameter<DoubleArray> QualitiesParameter => (IScopeTreeLookupParameter<DoubleArray>)Parameters["Qualities"];
    4038
    41     public ILookupParameter<ResultCollection> ResultsParameter {
    42       get { return (ILookupParameter<ResultCollection>)Parameters["Results"]; }
    43     }
     39    public ILookupParameter<ResultCollection> ResultsParameter => (ILookupParameter<ResultCollection>)Parameters["Results"];
    4440
    45     public ILookupParameter<IMultiObjectiveTestFunction> TestFunctionParameter {
    46       get { return (ILookupParameter<IMultiObjectiveTestFunction>)Parameters["TestFunction"]; }
    47     }
     41    public ILookupParameter<IMultiObjectiveTestFunction> TestFunctionParameter => (ILookupParameter<IMultiObjectiveTestFunction>)Parameters["TestFunction"];
    4842
    49     public ILookupParameter<DoubleMatrix> BestKnownFrontParameter {
    50       get { return (ILookupParameter<DoubleMatrix>)Parameters["BestKnownFront"]; }
    51     }
     43    public ILookupParameter<DoubleMatrix> BestKnownFrontParameter => (ILookupParameter<DoubleMatrix>)Parameters["BestKnownFront"];
    5244
    5345    protected MOTFAnalyzer(MOTFAnalyzer original, Cloner cloner) : base(original, cloner) { }
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/ScatterPlotAnalyzer.cs

    r16171 r16310  
    2323using HeuristicLab.Common;
    2424using HeuristicLab.Core;
     25using HeuristicLab.Data;
    2526using HeuristicLab.Encodings.RealVectorEncoding;
    2627using HeuristicLab.Optimization;
     
    3334  public class ScatterPlotAnalyzer : MOTFAnalyzer {
    3435
    35     public IScopeTreeLookupParameter<RealVector> IndividualsParameter {
    36       get { return (IScopeTreeLookupParameter<RealVector>)Parameters["Individuals"]; }
    37     }
     36    public IScopeTreeLookupParameter<RealVector> IndividualsParameter => (IScopeTreeLookupParameter<RealVector>)Parameters["Individuals"];
    3837
    39     public IResultParameter<ParetoFrontScatterPlot> ScatterPlotResultParameter {
    40       get { return (IResultParameter<ParetoFrontScatterPlot>)Parameters["Scatterplot"]; }
    41     }
    42 
     38    public IResultParameter<ParetoFrontScatterPlot> ScatterPlotResultParameter => (IResultParameter<ParetoFrontScatterPlot>)Parameters["Scatterplot"];
    4339
    4440    [StorableConstructor]
     
    5248      Parameters.Add(new ScopeTreeLookupParameter<RealVector>("Individuals", "The individual solutions to the problem"));
    5349      Parameters.Add(new ResultParameter<ParetoFrontScatterPlot>("Scatterplot", "The scatterplot for the current and optimal (if known front)"));
    54 
    5550    }
    5651
     
    5954      var individuals = IndividualsParameter.ActualValue;
    6055      var testFunction = TestFunctionParameter.ActualValue;
    61       var objectives = qualities[0].Length;
    62       var problemSize = individuals[0].Length;
     56      var objectives = qualities.Length != 0 ? qualities[0].Length:0;   
     57      var problemSize = individuals.Length != 0 ? individuals[0].Length:0;
    6358
    64       var optimalFront = new double[0][];
    65       var front = testFunction.OptimalParetoFront(objectives);
    66       if (front != null) optimalFront = front.ToArray();
     59      var optimalFront = new double[0][];               
     60      if (testFunction != null) {
     61        var front = testFunction.OptimalParetoFront(objectives);
     62        if (front != null) optimalFront = front.ToArray();
     63      }
     64      else {
     65        var mat = BestKnownFrontParameter.ActualValue;
     66        optimalFront = mat == null ? null : Enumerable.Range(0, mat.Rows).Select(r => Enumerable.Range(0, mat.Columns).Select(c => mat[r, c]).ToArray()).ToArray();
     67      }
    6768
    6869      var qualityClones = qualities.Select(s => s.ToArray()).ToArray();
     
    7071
    7172      ScatterPlotResultParameter.ActualValue = new ParetoFrontScatterPlot(qualityClones, solutionClones, optimalFront, objectives, problemSize);
    72 
    7373      return base.Apply();
    7474    }
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/Analyzers/SpacingAnalyzer.cs

    r16171 r16310  
    2929namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
    3030  [StorableClass]
    31   [Item("SpacingAnalyzer", "The spacing of the current front (see Multi-Objective Performance Metrics - Shodhganga for more information)")]
     31  [Item("SpacingAnalyzer", "This analyzer is functionally equivalent to the SpacingAnalyzer in HeuristicLab.Analysis, but is kept as not to break backwards compatibility")]
    3232  public class SpacingAnalyzer : MOTFAnalyzer {
    3333
    34     public IResultParameter<DoubleValue> SpacingResultParameter {
    35       get { return (IResultParameter<DoubleValue>)Parameters["Spacing"]; }
    36     }
     34    public IResultParameter<DoubleValue> SpacingResultParameter => (IResultParameter<DoubleValue>)Parameters["Spacing"];
     35
    3736    [StorableConstructor]
    3837    protected SpacingAnalyzer(bool deserializing) : base(deserializing) { }
    39 
    4038
    4139    protected SpacingAnalyzer(SpacingAnalyzer original, Cloner cloner) : base(original, cloner) { }
Note: See TracChangeset for help on using the changeset viewer.