Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/15/16 16:07:14 (8 years ago)
Author:
bwerth
Message:

#1087 minor bugfixes and added unittests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Kursawe.cs

    r13451 r13515  
    11using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    62using HeuristicLab.Common;
    73using HeuristicLab.Core;
     
    95using HeuristicLab.Encodings.RealVectorEncoding;
    106using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    11 using HeuristicLab.Problems.MultiObjectiveTestFunction;
    127
    13 namespace HeuristicLab.Problems.TestFunctions {
    14   [Item("Kursawe", "from // http://darwin.di.uminho.pt/jecoli/index.php/Multiobjective_example [30.11.2015]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("Kursawe", "Kursawe function from // http://darwin.di.uminho.pt/jecoli/index.php/Multiobjective_example [30.11.2015]")]
    1510  [StorableClass]
    1611  public class Kursawe : MultiObjectiveTestFunction {
     
    6156    }
    6257
     58    public override RealVector[] OptimalParetoFront {
     59      get {
     60        return PFReader.getFromFile("Kursawe");
     61      }
     62    }
     63    public override double BestKnownHypervolume {
     64      get {
     65        return new Hypervolume(base.ReferencePoint, Maximization).GetHypervolume(OptimalParetoFront);
     66      }
     67    }
     68
    6369    [StorableConstructor]
    6470    protected Kursawe(bool deserializing) : base(deserializing) { }
     
    7581      //objective 1
    7682      double f0 = 0.0;
    77       for (int i = 0; i < 2; i++) {
     83      for (int i = 0; i < r.Length-1; i++) {
    7884        f0 += -10 * Math.Exp(-0.2 * Math.Sqrt(r[i] * r[i] + r[i + 1] * r[i + 1]));
    7985      }
    8086      //objective2
    8187      double f1 = 0.0;
    82       for (int i = 0; i < 3; i++) {
     88      for (int i = 0; i < r.Length; i++) {
    8389        f1 += Math.Pow(Math.Abs(r[i]), 0.8) + 5 * Math.Sin(Math.Pow(r[i], 3));
    8490      }
Note: See TracChangeset for help on using the changeset viewer.