Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13515


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

#1087 minor bugfixes and added unittests

Location:
branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/HeuristicLab.Problems.MultiObjectiveTestFunctions-3.3.csproj

    r13448 r13515  
    9595  </ItemGroup>
    9696  <ItemGroup>
     97    <Compile Include="Comparators\Spacing.cs" />
     98    <Compile Include="Comparators\HyperVolume.cs" />
     99    <Compile Include="Comparators\InvertedGenerationalDistance.cs" />
     100    <Compile Include="Comparators\GenerationalDistance.cs" />
     101    <Compile Include="NonDominatedSelect.cs" />
    97102    <Compile Include="Interfaces\IMultiObjectiveTestFunction.cs" />
     103    <Compile Include="Interfaces\IMultiObjectiveDistance.cs" />
    98104    <Compile Include="MultiObjectiveTestFunctionProblem.cs" />
     105    <Compile Include="PFReader.cs" />
    99106    <Compile Include="Plugin.cs" />
    100107    <Compile Include="Properties\AssemblyInfo.cs" />
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Interfaces/IMultiObjectiveTestFunction.cs

    r13448 r13515  
    2424using HeuristicLab.Encodings.RealVectorEncoding;
    2525
    26 namespace HeuristicLab.Problems.TestFunctions {
     26namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
    2727  /// <summary>
    2828  /// An interface which represents an evaluation operator for multi objective test functions.
     
    3131    bool[] Maximization { get; }
    3232    DoubleMatrix Bounds { get; }
    33     //double BestKnownQuality { get; }
    3433    int MinimumProblemSize { get; }
    3534    int MaximumProblemSize { get; }
     
    3837    int ActualSolutionSize { get; set; }
    3938
    40     //double Evaluate2D(double x, double y);
     39
     40    RealVector[] OptimalParetoFront { get; }
     41    RealVector ReferencePoint { get; }
     42    double BestKnownHypervolume { get; }
     43
     44
    4145    double[] Evaluate(RealVector point);
    42     //RealVector GetBestKnownSolution(int dimension);
    4346  }
    4447}
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/MultiObjectiveTestFunctionProblem.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;
     
    117using HeuristicLab.Parameters;
    128using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    13 using HeuristicLab.Problems.MultiObjectiveTestFunctions.Testfunctions;
    14 using HeuristicLab.Problems.TestFunctions;
     9using HeuristicLab.Problems.MultiObjectiveTestFunctions;
    1510
    1611namespace HeuristicLab.Problems.MultiObjectiveTestFunction {
     
    1813  public class MultiObjectiveTestFunctionProblem : MultiObjectiveBasicProblem<RealVectorEncoding> {
    1914
     15
     16    //TODO update of Maximisatzion when SolutionSize or TestFunction changes
    2017    public override bool[] Maximization {
    2118      get {
     
    2623    #region Parameter Properties
    2724
    28 
     25    /// <summary>
     26    /// The dimensionality of the solution candidates
     27    /// </summary>
    2928    private IFixedValueParameter<IntValue> ProblemSizeParameter {
    3029      get { return (IFixedValueParameter<IntValue>)Parameters["ProblemSize"]; }
    3130    }
     31
     32    /// <summary>
     33    /// The number of objectives that are to be optimized
     34    /// </summary>
    3235    private IFixedValueParameter<IntValue> SolutionSizeParameter {
    3336      get { return (IFixedValueParameter<IntValue>)Parameters["SolutionSize"]; }
    3437    }
     38
     39    /// <summary>
     40    /// The bounds for the entries of the solution candidate
     41    /// </summary>
    3542    private IValueParameter<DoubleMatrix> BoundsParameter {
    3643      get { return (IValueParameter<DoubleMatrix>)Parameters["Bounds"]; }
    3744    }
    38     public OptionalValueParameter<RealVector> BestKnownSolutionParameter {
    39       get { return (OptionalValueParameter<RealVector>)Parameters["BestKnownSolution"]; }
    40     }
     45
     46    /// <summary>
     47    /// The testfunction
     48    /// </summary>
    4149    public IValueParameter<IMultiObjectiveTestFunction> TestFunctionParameter {
    4250      get { return (IValueParameter<IMultiObjectiveTestFunction>)Parameters["TestFunction"]; }
     
    6371    #endregion
    6472
    65 
     73    public override void Analyze(Individual[] individuals, double[][] qualities, ResultCollection results, IRandom random) {
     74      base.Analyze(individuals, qualities, results, random);
     75      if (qualities[0].Length != 2) { throw new Exception(); }
     76      if (!results.ContainsKey("Hypervolume")) {
     77        results.Add(new Result("Hypervolume", typeof(DoubleValue)));
     78      }
     79      if (!results.ContainsKey("BestKnownHypervolume")) {
     80        results.Add(new Result("BestKnownHypervolume", typeof(DoubleValue)));
     81      }
     82      if (!results.ContainsKey("Absolute Distance to BestKnownHypervolume")) {
     83        results.Add(new Result("Absolute Distance to BestKnownHypervolume", typeof(DoubleValue)));
     84      }
     85      Hypervolume comp = new Hypervolume(TestFunction.ReferencePoint, Maximization);
     86      RealVector[] front = NonDominatedSelect.selectNonDominatedRows(qualities, Maximization, true);
     87
     88      double hv = comp.GetHypervolume(front);
     89      double best = TestFunction.BestKnownHypervolume;
     90      results["Hypervolume"].Value = new DoubleValue(hv);
     91      results["BestKnownHypervolume"].Value = new DoubleValue(best);
     92      results["Absolute Distance to BestKnownHypervolume"].Value = new DoubleValue(best - hv);
     93    }
    6694
    6795    [StorableConstructor]
     
    72100    }
    73101    public MultiObjectiveTestFunctionProblem()
    74       : base() { //former: base(new RealVectorEncoding("Point"))
     102      : base() {
    75103      Parameters.Add(new FixedValueParameter<IntValue>("ProblemSize", "The dimensionality of the problem instance (number of variables in the function).", new IntValue(2)));
    76104      Parameters.Add(new FixedValueParameter<IntValue>("SolutionSize", "The dimensionality of the solution vector (number of objectives).", new IntValue(2)));
     
    80108      Encoding.LengthParameter = ProblemSizeParameter;
    81109      Encoding.BoundsParameter = BoundsParameter;
    82       //BestKnownQuality = TestFunction.BestKnownQuality;
    83110
    84111      InitializeOperators();
    85112      RegisterEventHandlers();
    86113    }
     114
     115
    87116
    88117    public override IDeepCloneable Clone(Cloner cloner) {
     
    96125
    97126    private void RegisterEventHandlers() {
    98       //Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
    99127      TestFunctionParameter.ValueChanged += TestFunctionParameterOnValueChanged;
    100128      ProblemSizeParameter.Value.ValueChanged += ProblemSizeOnValueChanged;
     
    119147    protected override void OnEvaluatorChanged() {
    120148      base.OnEvaluatorChanged();
    121       // Evaluator.QualityParameter.ActualNameChanged += Evaluator_QualityParameter_ActualNameChanged;
    122       Parameterize();
    123     }
    124 
    125     //private void Evaluator_QualityParameter_ActualNameChanged(object sender, EventArgs e) {
    126     //  Parameterize();
    127     //}
    128 
     149      Parameterize();
     150    }
    129151
    130152    private void TestFunctionParameterOnValueChanged(object sender, EventArgs eventArgs) {
     
    176198
    177199    private void Parameterize() {
    178     }
    179 
     200      //empty for now
     201    }
    180202
    181203    #endregion
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ1.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;
    84using HeuristicLab.Data;
    95using HeuristicLab.Encodings.RealVectorEncoding;
    10 using HeuristicLab.Parameters;
    116using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    12 using HeuristicLab.Problems.MultiObjectiveTestFunction;
    137
    14 namespace HeuristicLab.Problems.TestFunctions {
    15   [Item("DTLZ1", " http://repository.ias.ac.in/81671/ [30.11.15]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("DTLZ1", "Testfunction as defined as DTLZ1 in http://repository.ias.ac.in/81671/ [30.11.15]")]
    1610  [StorableClass]
    1711  public class DTLZ1 : MultiObjectiveTestFunction {
     
    6559    }
    6660
     61    public override RealVector[] OptimalParetoFront {
     62      get {
     63        throw new NotImplementedException();
     64      }
     65    }
     66
     67    public override RealVector ReferencePoint {
     68      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     69    }
     70
     71    public override double BestKnownHypervolume {
     72      get { return 120 + 7.0 / 8; }
     73    }
     74
    6775    [StorableConstructor]
    6876    protected DTLZ1(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ2.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;
    84using HeuristicLab.Data;
    95using HeuristicLab.Encodings.RealVectorEncoding;
    10 using HeuristicLab.Parameters;
    116using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    12 using HeuristicLab.Problems.MultiObjectiveTestFunction;
    137
    14 namespace HeuristicLab.Problems.TestFunctions {
    15   [Item("DTLZ2", " http://repository.ias.ac.in/81671/ [30.11.15]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("DTLZ2", "Testfunction as defined as DTLZ2 in http://repository.ias.ac.in/81671/ [30.11.15]")]
    1610  [StorableClass]
    1711  public class DTLZ2 : MultiObjectiveTestFunction {
     
    6559    }
    6660
     61    public override RealVector[] OptimalParetoFront {
     62      get {
     63        throw new NotImplementedException();
     64      }
     65    }
     66
     67    public override RealVector ReferencePoint {
     68      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     69    }
     70
     71    public override double BestKnownHypervolume {
     72      get { return 121.0 - 1.0 / 4.0 *Math.PI; }
     73    }
     74
    6775    [StorableConstructor]
    6876    protected DTLZ2(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ3.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;
    84using HeuristicLab.Data;
    95using HeuristicLab.Encodings.RealVectorEncoding;
    10 using HeuristicLab.Parameters;
    116using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    12 using HeuristicLab.Problems.MultiObjectiveTestFunction;
    137
    14 namespace HeuristicLab.Problems.TestFunctions {
    15   [Item("DTLZ3", " http://repository.ias.ac.in/81671/ [30.11.15]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("DTLZ3", "Testfunction as defined as DTLZ3 in http://repository.ias.ac.in/81671/ [30.11.15]")]
    1610  [StorableClass]
    1711  public class DTLZ3 : MultiObjectiveTestFunction {
     
    6559    }
    6660
     61    public override RealVector[] OptimalParetoFront {
     62      get {
     63        throw new NotImplementedException();
     64      }
     65    }
     66
     67    public override RealVector ReferencePoint {
     68      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     69    }
     70
     71    public override double BestKnownHypervolume {
     72      get { return 121.0 - 1.0 / 4.0 * Math.PI; }
     73    }
     74
    6775    [StorableConstructor]
    6876    protected DTLZ3(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ4.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;
    84using HeuristicLab.Data;
    95using HeuristicLab.Encodings.RealVectorEncoding;
    10 using HeuristicLab.Parameters;
    116using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    12 using HeuristicLab.Problems.MultiObjectiveTestFunction;
    137
    14 namespace HeuristicLab.Problems.TestFunctions {
    15   [Item("DTLZ4", " http://repository.ias.ac.in/81671/ [30.11.15]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("DTLZ4", "Testfunction as defined as DTLZ4 in http://repository.ias.ac.in/81671/ [30.11.15]")]
    1610  [StorableClass]
    1711  public class DTLZ4 : MultiObjectiveTestFunction {
     
    6559    }
    6660
     61    public override RealVector[] OptimalParetoFront {
     62      get {
     63        throw new NotImplementedException();
     64      }
     65    }
     66
     67    public override RealVector ReferencePoint {
     68      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     69    }
     70
     71    public override double BestKnownHypervolume {
     72      get { return 121.0 - 1.0 / 4.0 * Math.PI; }
     73    }
     74
    6775    [StorableConstructor]
    6876    protected DTLZ4(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ5.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;
    84using HeuristicLab.Data;
    95using HeuristicLab.Encodings.RealVectorEncoding;
    10 using HeuristicLab.Parameters;
    116using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    12 using HeuristicLab.Problems.MultiObjectiveTestFunction;
    137
    14 namespace HeuristicLab.Problems.TestFunctions {
    15   [Item("DTLZ5", " http://repository.ias.ac.in/81671/ [30.11.15]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("DTLZ5", "Testfunction as defined as DTLZ5 in http://repository.ias.ac.in/81671/ [30.11.15]")]
    1610  [StorableClass]
    1711  public class DTLZ5 : MultiObjectiveTestFunction {
     
    6559    }
    6660
     61    public override RealVector[] OptimalParetoFront {
     62      get {
     63        throw new NotImplementedException();
     64      }
     65    }
     66
    6767    [StorableConstructor]
    6868    protected DTLZ5(bool deserializing) : base(deserializing) { }
     
    9494      //phi definition
    9595      Func<double, double> phi;
    96       phi = (double x) => { return Math.PI / (4 * 1 + g) * (1 + 2 * g * x); };
     96      phi = (double x) => { return Math.PI / (4 * (1 + g)) * (1 + 2 * g * x); };
    9797
    9898      //calculating f0...fM-1
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ6.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;
    84using HeuristicLab.Data;
    95using HeuristicLab.Encodings.RealVectorEncoding;
    10 using HeuristicLab.Parameters;
    116using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    12 using HeuristicLab.Problems.MultiObjectiveTestFunction;
    137
    14 namespace HeuristicLab.Problems.TestFunctions {
    15   [Item("DTLZ6", " http://repository.ias.ac.in/81671/ [30.11.15]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("DTLZ6", "Testfunction as defined as DTLZ6 in http://repository.ias.ac.in/81671/ [30.11.15] NOTE: The website http://people.ee.ethz.ch/~sop/download/supplementary/testproblems/dtlz7/index.php [16.12.2015] lables this function as DTLZ7")]
    1610  [StorableClass]
    1711  public class DTLZ6 : MultiObjectiveTestFunction {
     
    6559    }
    6660
     61    public override RealVector[] OptimalParetoFront {
     62      get {
     63        throw new NotImplementedException();
     64      }
     65    }
     66    public override RealVector ReferencePoint {
     67      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     68    }
     69
     70    public override double BestKnownHypervolume {
     71      get { return 116.1138716447221; }
     72    }
     73
     74
    6775    [StorableConstructor]
    6876    protected DTLZ6(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/DTLZ7.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;
    84using HeuristicLab.Data;
    95using HeuristicLab.Encodings.RealVectorEncoding;
    10 using HeuristicLab.Parameters;
    116using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    12 using HeuristicLab.Problems.MultiObjectiveTestFunction;
    137
    14 namespace HeuristicLab.Problems.TestFunctions {
    15   [Item("DTLZ7", " http://repository.ias.ac.in/81671/ [30.11.15]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("DTLZ7", "Testfunction as defined as DTLZ7 in http://repository.ias.ac.in/81671/ [30.11.15]")]
    1610  [StorableClass]
    1711  public class DTLZ7 : MultiObjectiveTestFunction {
     
    6559    }
    6660
     61    public override RealVector[] OptimalParetoFront {
     62      get {
     63        throw new NotImplementedException();
     64      }
     65    }
     66
     67    public override RealVector ReferencePoint {
     68      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     69    }
     70
     71
    6772    [StorableConstructor]
    6873    protected DTLZ7(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Evaluators.cs

    r13448 r13515  
    77
    88namespace HeuristicLab.Problems.MultiObjectiveTestFunctions.Testfunctions {
     9
     10  /// <summary>
     11  /// unused class
     12  /// </summary>
    913  class Evaluators {
    1014
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/Fonseca.cs

    r13448 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("Fonseca", "from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("Fonseca", "Fonseca and Flemming function from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
    1510  [StorableClass]
    1611  public class Fonseca : MultiObjectiveTestFunction {
     
    6156    }
    6257
     58    public override RealVector[] OptimalParetoFront {
     59      get {
     60        return PFReader.getFromFile("Fonseca");
     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 Fonseca(bool deserializing) : base(deserializing) { }
  • 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      }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/MultiObjectiveTestFunction.cs

    r13451 r13515  
    2727using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2828
    29 namespace HeuristicLab.Problems.TestFunctions {
     29namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
    3030  /// <summary>
    3131  /// Base class for a test function evaluator.
     
    7777    public abstract int MaximumSolutionSize { get; }
    7878
     79    /// <summary>
     80    /// retrieves the optimal pareto front (if known from a file)
     81    /// </summary>
     82    public abstract RealVector[] OptimalParetoFront { get; }
     83
     84    public virtual RealVector ReferencePoint {
     85      get {
     86        return new RealVector(new double[]{ 11,11});
     87      }
     88    }
     89
     90    public virtual double BestKnownHypervolume {
     91      get {
     92        return 0;
     93      }
     94    }
     95
    7996    [StorableConstructor]
    8097    protected MultiObjectiveTestFunction(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN1.cs

    r13448 r13515  
    1 using System;
    2 using System.Collections.Generic;
    3 using System.Linq;
    4 using System.Text;
    5 using System.Threading.Tasks;
    6 using HeuristicLab.Common;
     1using HeuristicLab.Common;
    72using HeuristicLab.Core;
    83using HeuristicLab.Data;
    94using HeuristicLab.Encodings.RealVectorEncoding;
    105using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    11 using HeuristicLab.Problems.MultiObjectiveTestFunction;
    126
    13 namespace HeuristicLab.Problems.TestFunctions {
    14   [Item("SchafferN1", "from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
     7namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     8  [Item("SchafferN1", "Schaffer function N.1 for mulitobjective optimization from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
    159  [StorableClass]
    1610  public class SchafferN1 : MultiObjectiveTestFunction {
     
    6155    }
    6256
     57    public override RealVector[] OptimalParetoFront {
     58      get {
     59        return PFReader.getFromFile("SchafferN1");
     60      }
     61    }
     62    public override double BestKnownHypervolume {
     63      get {
     64        return new Hypervolume(base.ReferencePoint, Maximization).GetHypervolume(OptimalParetoFront);
     65      }
     66    }
     67
    6368    [StorableConstructor]
    6469    protected SchafferN1(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/SchafferN2.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("SchafferN2", "from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("SchafferN2", "Schaffer function N.2 for mulitobjective optimization from // https://en.wikipedia.org/wiki/Test_functions_for_optimization [30.11.2015]")]
    1510  [StorableClass]
    1611  public class SchafferN2 : MultiObjectiveTestFunction {
     
    6156    }
    6257
     58    public override RealVector[] OptimalParetoFront {
     59      get {
     60        throw new NotImplementedException();
     61      }
     62    }
     63
    6364    [StorableConstructor]
    6465    protected SchafferN2(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT1.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("ZDT1", "//http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("ZDT1", "ZDT1 function as defined in http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
    1510  [StorableClass]
    1611  public class ZDT1 : MultiObjectiveTestFunction {
     
    6156    }
    6257
     58    public override RealVector[] OptimalParetoFront {
     59      get {
     60        throw new NotImplementedException();
     61      }
     62    }
     63
     64    public override RealVector ReferencePoint {
     65      get { return new RealVector(new double[]{ 11.0, 11.0}); }
     66    }
     67
     68    public override double BestKnownHypervolume {
     69      get { return 120 + 2.0 / 3; }
     70    }
     71
    6372    [StorableConstructor]
    6473    protected ZDT1(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT2.cs

    r13448 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("ZDT2", "//http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("ZDT2", "ZDT2 function as defined in http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
    1510  [StorableClass]
    1611  public class ZDT2 : MultiObjectiveTestFunction {
     
    6055    }
    6156
     57    public override RealVector[] OptimalParetoFront {
     58      get {
     59        throw new NotImplementedException();
     60      }
     61    }
     62    public override RealVector ReferencePoint {
     63      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     64    }
     65
     66    public override double BestKnownHypervolume {
     67      get { return 120+1.0/3; }
     68    }
     69
    6270    [StorableConstructor]
    6371    protected ZDT2(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT3.cs

    r13448 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("ZDT3", "//http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("ZDT3", "ZDT3 function as defined in http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
    1510  [StorableClass]
    1611  public class ZDT3 : MultiObjectiveTestFunction {
     
    6156    }
    6257
     58    public override RealVector[] OptimalParetoFront {
     59      get {
     60        throw new NotImplementedException();
     61      }
     62    }
     63
     64    public override RealVector ReferencePoint {
     65      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     66    }
     67
     68    public override double BestKnownHypervolume {
     69      get { return 128.77811613069076060; }
     70    }
     71
    6372    [StorableConstructor]
    6473    protected ZDT3(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT4.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("ZDT4", "//http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("ZDT4", "ZDT4 function as defined in http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
    1510  [StorableClass]
    1611  public class ZDT4 : MultiObjectiveTestFunction {
     
    6156    }
    6257
     58    public override RealVector[] OptimalParetoFront {
     59      get {
     60        throw new NotImplementedException();
     61      }
     62    }
     63
     64    public override RealVector ReferencePoint {
     65      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     66    }
     67
     68    public override double BestKnownHypervolume {
     69      get { return 120+2.0/3; }
     70    }
     71
    6372    [StorableConstructor]
    6473    protected ZDT4(bool deserializing) : base(deserializing) { }
  • branches/HeuristicLab.Problems.MultiObjectiveTestFunctions/HeuristicLab.Problems.MultiObjectiveTestFunctions/3.3/Testfunctions/ZDT6.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("ZDT6", "//http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
     8namespace HeuristicLab.Problems.MultiObjectiveTestFunctions {
     9  [Item("ZDT6", "ZDT6 function as defined in http://www.tik.ee.ethz.ch/sop/download/supplementary/testproblems/ [30.11.2015]")]
    1510  [StorableClass]
    1611  public class ZDT6 : MultiObjectiveTestFunction {
     
    6156    }
    6257
     58    public override RealVector[] OptimalParetoFront {
     59      get {
     60        throw new NotImplementedException();
     61      }
     62    }
     63
     64    public override RealVector ReferencePoint {
     65      get { return new RealVector(new double[] { 11.0, 11.0 }); }
     66    }
     67
     68
     69    public override double BestKnownHypervolume {
     70      get{ return 119.51857519692037009; }
     71    }
     72
    6373    [StorableConstructor]
    6474    protected ZDT6(bool deserializing) : base(deserializing) { }
Note: See TracChangeset for help on using the changeset viewer.