[13672] | 1 | #region License Information
|
---|
| 2 | /* HeuristicLab
|
---|
[16140] | 3 | * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
|
---|
[13672] | 4 | *
|
---|
| 5 | * This file is part of HeuristicLab.
|
---|
| 6 | *
|
---|
| 7 | * HeuristicLab is free software: you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation, either version 3 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * HeuristicLab is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
|
---|
| 19 | */
|
---|
| 20 | #endregion
|
---|
| 21 | using System;
|
---|
[13620] | 22 | using System.Collections.Generic;
|
---|
| 23 | using HeuristicLab.Common;
|
---|
[13421] | 24 | using HeuristicLab.Core;
|
---|
| 25 | using HeuristicLab.Encodings.RealVectorEncoding;
|
---|
| 26 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
|
---|
| 27 |
|
---|
[14111] | 28 | namespace HeuristicLab.Problems.TestFunctions.MultiObjective {
|
---|
[13936] | 29 | [Item("ELLI", "to be aded")]
|
---|
[13421] | 30 | [StorableClass]
|
---|
[13936] | 31 | public class ELLI : MultiObjectiveTestFunction {
|
---|
[14068] | 32 | protected override double[,] GetBounds(int objectives) {
|
---|
[13936] | 33 | return new double[,] { { -10, 10 } };
|
---|
[13421] | 34 | }
|
---|
| 35 |
|
---|
[14068] | 36 | protected override bool[] GetMaximization(int objecitves) {
|
---|
[13620] | 37 | return new bool[2];
|
---|
[13421] | 38 | }
|
---|
| 39 |
|
---|
[14068] | 40 | protected override double[] GetReferencePoint(int objecitves) {
|
---|
[13936] | 41 | return new double[] { 11, 11 };
|
---|
[13421] | 42 | }
|
---|
| 43 |
|
---|
[14068] | 44 | protected override IEnumerable<double[]> GetOptimalParetoFront(int objecitves) {
|
---|
[13936] | 45 | List<double[]> res = new List<double[]>();
|
---|
| 46 | for (int i = 0; i <= 500; i++) {
|
---|
| 47 | RealVector r = new RealVector(2);
|
---|
| 48 | r[0] = 2 / 500.0 * i;
|
---|
| 49 | r[1] = 2 / 500.0 * i;
|
---|
| 50 | res.Add(this.Evaluate(r, 2));
|
---|
| 51 | }
|
---|
| 52 | return res;
|
---|
[13448] | 53 | }
|
---|
[13988] | 54 |
|
---|
[14068] | 55 | protected override double GetBestKnownHypervolume(int objectives) {
|
---|
| 56 | return Hypervolume.Calculate(GetOptimalParetoFront(objectives), GetReferencePoint(objectives), GetMaximization(objectives));
|
---|
[13515] | 57 | }
|
---|
| 58 |
|
---|
[13421] | 59 | [StorableConstructor]
|
---|
[13936] | 60 | protected ELLI(bool deserializing) : base(deserializing) { }
|
---|
| 61 | protected ELLI(ELLI original, Cloner cloner) : base(original, cloner) { }
|
---|
[13421] | 62 | public override IDeepCloneable Clone(Cloner cloner) {
|
---|
[13936] | 63 | return new ELLI(this, cloner);
|
---|
[13421] | 64 | }
|
---|
| 65 |
|
---|
[13936] | 66 | public ELLI() : base(minimumObjectives: 2, maximumObjectives: 2, minimumSolutionLength: 1, maximumSolutionLength: int.MaxValue) { }
|
---|
[13421] | 67 |
|
---|
[13620] | 68 | public override double[] Evaluate(RealVector r, int objectives) {
|
---|
[13936] | 69 | if (objectives != 2) throw new ArgumentException("The ELLI problem must always have 2 objectives");
|
---|
| 70 | double a = 1000;
|
---|
| 71 | double sum = 0.0;
|
---|
| 72 | for (int i = 0; i < r.Length; i++) {
|
---|
| 73 | sum += Math.Pow(a, 2 * i / (r.Length - 1)) * r[i] * r[i];
|
---|
| 74 | }
|
---|
[13421] | 75 |
|
---|
| 76 | //objective1
|
---|
[13936] | 77 | double f0 = 1 / (a * a * r.Length) * sum;
|
---|
[13421] | 78 |
|
---|
[13936] | 79 | sum = 0.0;
|
---|
| 80 | for (int i = 0; i < r.Length; i++) {
|
---|
| 81 | sum += Math.Pow(a, 2 * i / (r.Length - 1)) * (r[i] - 2) * (r[i] - 2);
|
---|
| 82 | }
|
---|
[13421] | 83 | //objective0
|
---|
[13936] | 84 | double f1 = 1 / (a * a * r.Length) * sum;
|
---|
[13421] | 85 |
|
---|
[13620] | 86 | return new double[] { f0, f1 };
|
---|
[13421] | 87 | }
|
---|
| 88 | }
|
---|
| 89 | }
|
---|