Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Analysis-3.3/Multi-objective/CrowdingTest.cs @ 17262

Last change on this file since 17262 was 17262, checked in by mkommend, 4 years ago

#2521: Adapted unit tests for multi-objective analysis.

File size: 4.6 KB
Line 
1//#region License Information
2///* HeuristicLab
3// * Copyright (C) Heuristic and Evolutionary Algorithms Laboratory (HEAL)
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;
22//using Microsoft.VisualStudio.TestTools.UnitTesting;
23//using HeuristicLab.Optimization;
24
25//namespace HeuristicLab.Analysis.Tests {
26//  [TestClass]
27//  public class CrowdingTest {
28
29//    [TestMethod]
30//    [ExpectedException(typeof(ArgumentException))]
31//    [TestCategory("Analysis.MultiObjective")]
32//    [TestProperty("Time", "short")]
33//    public void CrowdingTestEmptyFront() {
34//      double[][] front = { };
35
36//      CrowdingCalculator.CalculateCrowding(front);
37//    }
38
39//    [TestMethod]
40//    [TestCategory("Analysis.MultiObjective")]
41//    [TestProperty("Time", "short")]
42//    public void CrowdingTestSamePoint() {
43
44//      double[] point = new double[2];
45//      point[0] = 0.5;
46//      point[1] = 0.5;
47
48//      double[] point1 = new double[2];
49//      point1[0] = 0.5;
50//      point1[1] = 0.5;
51//      double[][] front = { point, point1 };
52//      double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } });
53//      Assert.AreEqual(double.PositiveInfinity, dist);
54//    }
55
56//    [TestMethod]
57//    [TestCategory("Analysis.MultiObjective")]
58//    [TestProperty("Time", "short")]
59//    public void CrowdingTestSinglePoint() {
60//      double[] point = new double[2];
61//      point[0] = 0;
62//      point[1] = 0;
63//      double[][] front = { point };
64//      double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } });
65//      Assert.AreEqual(double.PositiveInfinity, dist);
66//    }
67
68//    [TestMethod]
69//    [TestCategory("Analysis.MultiObjective")]
70//    [TestProperty("Time", "short")]
71//    public void CrowdingTestDiagonal() {
72//      double[] point = new double[2];
73//      point[0] = 0;
74//      point[1] = 0;
75//      double[] point1 = new double[2];
76//      point1[0] = 0.5;
77//      point1[1] = 0.5;
78
79//      double[] point2 = new double[2];
80//      point2[0] = 1;
81//      point2[1] = 1;
82//      double[][] front = { point, point1, point2 };
83//      double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } });
84//      Assert.AreEqual(2, dist);
85//    }
86
87//    [TestMethod]
88//    [TestCategory("Analysis.MultiObjective")]
89//    [TestProperty("Time", "short")]
90//    public void CrowdingTestDiamond() {
91//      double[] point = new double[2];
92//      point[0] = 0;
93//      point[1] = 0;
94//      double[] point1 = new double[2];
95//      point1[0] = 1;
96//      point1[1] = 1.5;
97
98//      double[] point2 = new double[2];
99//      point2[0] = 3;
100//      point2[1] = 0.5;
101//      double[] point3 = new double[2];
102//      point3[0] = 4;
103//      point3[1] = 2;
104//      double[][] front = { point, point1, point2, point3 };
105//      double dist = Crowding.Calculate(front, new double[,] { { 0, 4 }, { 0, 2 } });
106//      Assert.AreEqual(1.5, dist);
107//    }
108
109//    /// <summary>
110//    /// deltoid with 4 points of the 1-unit-square and the northeastern point at 4,4
111//    ///
112//    /// </summary>
113//    [TestMethod]
114//    [TestCategory("Analysis.MultiObjective")]
115//    [TestProperty("Time", "short")]
116//    public void CrowdingTestDeltoid() {
117//      double[] point = new double[2];
118//      point[0] = 0;
119//      point[1] = 0;
120//      double[] point1 = new double[2];
121//      point1[0] = 0.00000001;         //points should not be exactly equal because sorting behavior could change result
122//      point1[1] = 1.00000001;
123
124//      double[] point2 = new double[2];
125//      point2[0] = 1;
126//      point2[1] = 0;
127//      double[] point3 = new double[2];
128//      point3[0] = 4;
129//      point3[1] = 4;
130
131
132//      double[][] front = { point, point1, point2, point3, };
133//      double dist = Crowding.Calculate(front, new double[,] { { 0, 4 }, { 0, 4 } });
134//      Assert.AreEqual(1.25, dist);
135//    }
136
137
138//  }
139
140
141//}
Note: See TracBrowser for help on using the repository browser.