Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/21/18 09:18:49 (6 years ago)
Author:
bwerth
Message:

#2943 worked on MOBasicProblem - added Interfaces;reworked MOCalculators; several minor changes

Location:
branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR
Files:
6 edited

Legend:

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

    r15583 r16171  
    2020#endregion
    2121using System;
     22using System.Linq;
    2223using HeuristicLab.Common;
    2324using HeuristicLab.Encodings.RealVectorEncoding;
     25using HeuristicLab.Optimization;
    2426using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2527
     
    3638
    3739    protected override double[] GetReferencePoint(int objectives) {
    38       double[] rp = new double[objectives];
    39       for (int i = 0; i < objectives; i++) {
     40      var rp = new double[objectives];
     41      for (var i = 0; i < objectives; i++) {
    4042        rp[i] = 11;
    4143      }
     
    5860    protected abstract double G(RealVector y);
    5961
     62    protected override double GetBestKnownHypervolume(int objectives) {
     63      return HypervolumeCalculator.CalculateHypervolume(GetOptimalParetoFront(objectives).ToArray(), GetReferencePoint(objectives), GetMaximization(objectives));
     64    }
    6065
    6166    protected double H(double x, RealVector r) {
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR1.cs

    r15583 r16171  
    3131  public class IHR1 : IHR {
    3232    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    33       List<double[]> res = new List<double[]>();
    34       for (int i = 0; i <= 500; i++) {
    35         RealVector r = new RealVector(objectives);
     33      var res = new List<double[]>();
     34      for (var i = 0; i <= 500; i++) {
     35        var r = new RealVector(objectives);
    3636        r[0] = 1 / 500.0 * i;
    3737        res.Add(this.Evaluate(r, objectives));
    3838      }
    3939      return res;
    40     }
    41 
    42     protected override double GetBestKnownHypervolume(int objectives) {
    43       return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4440    }
    4541
     
    6460
    6561    protected override double G(RealVector y) {
    66       double sum = 0.0;
    67       for (int i = 1; i < y.Length; i++) {
     62      var sum = 0.0;
     63      for (var i = 1; i < y.Length; i++) {
    6864        sum += HG(y[i]);
    6965      }
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR2.cs

    r15583 r16171  
    3131  public class IHR2 : IHR {
    3232    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    33       List<double[]> res = new List<double[]>();
    34       for (int i = 0; i <= 500; i++) {
    35         RealVector r = new RealVector(objectives);
     33      var res = new List<double[]>();
     34      for (var i = 0; i <= 500; i++) {
     35        var r = new RealVector(objectives);
    3636        r[0] = 1 / 500.0 * i;
    3737
     
    3939      }
    4040      return res;
    41     }
    42 
    43     protected override double GetBestKnownHypervolume(int objectives) {
    44       return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4541    }
    4642
     
    6662
    6763    protected override double G(RealVector y) {
    68       double sum = 0.0;
    69       for (int i = 1; i < y.Length; i++) {
     64      var sum = 0.0;
     65      for (var i = 1; i < y.Length; i++) {
    7066        sum += HG(y[i]);
    7167      }
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR3.cs

    r15583 r16171  
    2121using System;
    2222using System.Collections.Generic;
     23using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    3132  public class IHR3 : IHR {
    3233    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    33       List<double[]> res = new List<double[]>();
    34       for (int i = 0; i <= 500; i++) {
    35         RealVector r = new RealVector(objectives);
     34      var res = new List<double[]>();
     35      for (var i = 0; i <= 500; i++) {
     36        var r = new RealVector(objectives);
    3637        r[0] = 1 / 500.0 * i;
    3738
     
    3940      }
    4041      return res;
    41     }
    42 
    43     protected override double GetBestKnownHypervolume(int objectives) {
    44       return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4542    }
    4643
     
    6663
    6764    protected override double G(RealVector y) {
    68       double sum = 0.0;
    69       for (int i = 1; i < y.Length; i++) {
     65      var sum = 0.0;
     66      for (var i = 1; i < y.Length; i++) {
    7067        sum += HG(y[i]);
    7168      }
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR4.cs

    r15583 r16171  
    2121using System;
    2222using System.Collections.Generic;
     23using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    3132  public class IHR4 : IHR {
    3233    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    33       List<double[]> res = new List<double[]>();
    34       for (int i = 0; i <= 500; i++) {
    35         RealVector r = new RealVector(objectives);
     34      var res = new List<double[]>();
     35      for (var i = 0; i <= 500; i++) {
     36        var r = new RealVector(objectives);
    3637        r[0] = 1 / 500.0 * i;
    3738        res.Add(this.Evaluate(r, objectives));
    3839      }
    3940      return res;
    40     }
    41 
    42     protected override double GetBestKnownHypervolume(int objectives) {
    43       return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4441    }
    4542
     
    6966
    7067    protected override double G(RealVector y) {
    71       double sum = 0.0;
    72       for (int i = 1; i < y.Length; i++) {
     68      var sum = 0.0;
     69      for (var i = 1; i < y.Length; i++) {
    7370        sum += y[i] * y[i] - 10 * Math.Cos(4 * Math.PI * y[i]);
    7471      }
  • branches/2943_MOBasicProblem_MOCMAES/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/TestFunctions/IHR/IHR6.cs

    r15583 r16171  
    2121using System;
    2222using System.Collections.Generic;
     23using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    3132  public class IHR6 : IHR {
    3233    protected override IEnumerable<double[]> GetOptimalParetoFront(int objectives) {
    33       List<double[]> res = new List<double[]>();
    34       for (int i = 0; i <= 500; i++) {
    35         RealVector r = new RealVector(objectives);
     34      var res = new List<double[]>();
     35      for (var i = 0; i <= 500; i++) {
     36        var r = new RealVector(objectives);
    3637        r[0] = 1 / 500.0 * i;
    3738        res.Add(this.Evaluate(r, objectives));
    3839      }
    3940      return res;
    40     }
    41 
    42     protected override double GetBestKnownHypervolume(int objectives) {
    43       return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
    4441    }
    4542
     
    6562
    6663    protected override double G(RealVector y) {
    67       double sum = 0.0;
    68       for (int i = 1; i < y.Length; i++) {
     64      var sum = 0.0;
     65      for (var i = 1; i < y.Length; i++) {
    6966        sum += HG(y[i]);
    7067      }
Note: See TracChangeset for help on using the changeset viewer.