Free cookie consent management tool by TermsFeed Policy Generator

Changeset 17262


Ignore:
Timestamp:
09/17/19 17:28:33 (5 years ago)
Author:
mkommend
Message:

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

Location:
branches/2521_ProblemRefactoring/HeuristicLab.Tests
Files:
1 added
1 deleted
1 edited
6 copied

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Analysis-3.3/Multi-objective/CrowdingTest.cs

    r17261 r17262  
    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;
     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;
    2324
    24 namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
    25   [TestClass]
    26   public class CrowdingTest {
     25//namespace HeuristicLab.Analysis.Tests {
     26//  [TestClass]
     27//  public class CrowdingTest {
    2728
    28     [TestMethod]
    29     [ExpectedException(typeof(ArgumentException))]
    30     [TestCategory("Problems.TestFunctions.MultiObjective")]
    31     [TestProperty("Time", "short")]
    32     public void CrowdingTestEmptyFront() {
    33       double[][] front = { };
     29//    [TestMethod]
     30//    [ExpectedException(typeof(ArgumentException))]
     31//    [TestCategory("Analysis.MultiObjective")]
     32//    [TestProperty("Time", "short")]
     33//    public void CrowdingTestEmptyFront() {
     34//      double[][] front = { };
    3435
    35       Crowding.Calculate(front, null);
    36     }
     36//      CrowdingCalculator.CalculateCrowding(front);
     37//    }
    3738
    38     [TestMethod]
    39     [TestCategory("Problems.TestFunctions.MultiObjective")]
    40     [TestProperty("Time", "short")]
    41     public void CrowdingTestSamePoint() {
     39//    [TestMethod]
     40//    [TestCategory("Analysis.MultiObjective")]
     41//    [TestProperty("Time", "short")]
     42//    public void CrowdingTestSamePoint() {
    4243
    43       double[] point = new double[2];
    44       point[0] = 0.5;
    45       point[1] = 0.5;
     44//      double[] point = new double[2];
     45//      point[0] = 0.5;
     46//      point[1] = 0.5;
    4647
    47       double[] point1 = new double[2];
    48       point1[0] = 0.5;
    49       point1[1] = 0.5;
    50       double[][] front = { point, point1 };
    51       double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } });
    52       Assert.AreEqual(double.PositiveInfinity, dist);
    53     }
     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//    }
    5455
    55     [TestMethod]
    56     [TestCategory("Problems.TestFunctions.MultiObjective")]
    57     [TestProperty("Time", "short")]
    58     public void CrowdingTestSinglePoint() {
    59       double[] point = new double[2];
    60       point[0] = 0;
    61       point[1] = 0;
    62       double[][] front = { point };
    63       double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } });
    64       Assert.AreEqual(double.PositiveInfinity, dist);
    65     }
     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//    }
    6667
    67     [TestMethod]
    68     [TestCategory("Problems.TestFunctions.MultiObjective")]
    69     [TestProperty("Time", "short")]
    70     public void CrowdingTestDiagonal() {
    71       double[] point = new double[2];
    72       point[0] = 0;
    73       point[1] = 0;
    74       double[] point1 = new double[2];
    75       point1[0] = 0.5;
    76       point1[1] = 0.5;
     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;
    7778
    78       double[] point2 = new double[2];
    79       point2[0] = 1;
    80       point2[1] = 1;
    81       double[][] front = { point, point1, point2 };
    82       double dist = Crowding.Calculate(front, new double[,] { { 0, 1 }, { 0, 1 } });
    83       Assert.AreEqual(2, dist);
    84     }
     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//    }
    8586
    86     [TestMethod]
    87     [TestCategory("Problems.TestFunctions.MultiObjective")]
    88     [TestProperty("Time", "short")]
    89     public void CrowdingTestDiamond() {
    90       double[] point = new double[2];
    91       point[0] = 0;
    92       point[1] = 0;
    93       double[] point1 = new double[2];
    94       point1[0] = 1;
    95       point1[1] = 1.5;
     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;
    9697
    97       double[] point2 = new double[2];
    98       point2[0] = 3;
    99       point2[1] = 0.5;
    100       double[] point3 = new double[2];
    101       point3[0] = 4;
    102       point3[1] = 2;
    103       double[][] front = { point, point1, point2, point3 };
    104       double dist = Crowding.Calculate(front, new double[,] { { 0, 4 }, { 0, 2 } });
    105       Assert.AreEqual(1.5, dist);
    106     }
     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//    }
    107108
    108     /// <summary>
    109     /// deltoid with 4 points of the 1-unit-square and the northeastern point at 4,4
    110     ///
    111     /// </summary>
    112     [TestMethod]
    113     [TestCategory("Problems.TestFunctions.MultiObjective")]
    114     [TestProperty("Time", "short")]
    115     public void CrowdingTestDeltoid() {
    116       double[] point = new double[2];
    117       point[0] = 0;
    118       point[1] = 0;
    119       double[] point1 = new double[2];
    120       point1[0] = 0.00000001;         //points should not be exactly equal because sorting behaviour could change result
    121       point1[1] = 1.00000001;
     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;
    122123
    123       double[] point2 = new double[2];
    124       point2[0] = 1;
    125       point2[1] = 0;
    126       double[] point3 = new double[2];
    127       point3[0] = 4;
    128       point3[1] = 4;
     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;
    129130
    130131
    131       double[][] front = { point, point1, point2, point3, };
    132       double dist = Crowding.Calculate(front, new double[,] { { 0, 4 }, { 0, 4 } });
    133       Assert.AreEqual(1.25, dist);
    134     }
     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//    }
    135136
    136137
    137   }
     138//  }
    138139
    139140
    140 }
     141//}
  • branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Analysis-3.3/Multi-objective/FastHyperVolumeTests.cs

    r17261 r17262  
    2020#endregion
    2121using System;
     22using HeuristicLab.Optimization;
    2223using Microsoft.VisualStudio.TestTools.UnitTesting;
    2324
    24 namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
     25namespace HeuristicLab.Analysis.MultiObjective.Tests {
    2526  [TestClass]
    2627  public class FastHypervolumeTest {
     
    3839    /// </summary>
    3940    [TestMethod]
    40     [TestCategory("Problems.TestFunctions.MultiObjective")]
     41    [TestCategory("Analysis.MultiObjective")]
    4142    [TestProperty("Time", "short")]
    4243    public void FastHypervolumeTestSinglePoint() {
     
    4445      double[][] front = { point };
    4546      double[] referencePoint = new double[] { 1, 1, 1 };
    46       double hv = Hypervolume.Calculate(front, referencePoint, new bool[3]);
     47      double hv = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, new bool[3]);
    4748      Assert.AreEqual(0.125, hv);
    4849    }
     
    5657    /// +-----+
    5758    ///
    58     /// box between(0,0) and(1,1) with singular point pareto front at a random Location
     59    /// box between(0,0) and(1,1) with singular point Pareto front at a random Location
    5960    /// Sum of the Hypervolume to each of the corners should be 1; 
    6061    ///
    6162    /// </summary>
    6263    [TestMethod]
    63     [TestCategory("Problems.TestFunctions.MultiObjective")]
     64    [TestCategory("Analysis.MultiObjective")]
    6465    [TestProperty("Time", "short")]
    6566    public void FastHypervolumeTestRandomSinglePoint() {
     
    7980      referencePoint[1] = 1;
    8081      referencePoint[2] = 1;
    81       double hv = Hypervolume.Calculate(front, referencePoint, new bool[3]);
     82      double hv = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, new bool[3]);
    8283      double hv2 = 1;
    8384      foreach (double d in point) {
     
    9596    /// +-----x
    9697    ///
    97     /// box between(0,0,0) and(1,1,1) with three point (pareto) front at (1,0,0), (0.5,0.5,0)  and (0,1,0)
     98    /// box between(0,0,0) and(1,1,1) with three point (Pareto) front at (1,0,0), (0.5,0.5,0)  and (0,1,0)
    9899    /// Hypervolume should be 0.25
    99100    /// </summary>
    100101    [TestMethod]
    101     [TestCategory("Problems.TestFunctions.MultiObjective")]
     102    [TestCategory("Analysis.MultiObjective")]
    102103    [TestProperty("Time", "short")]
    103104    public void FastHypervolumeTestDiagonalPoint() {
     
    109110
    110111      double[] referencePoint = new double[] { 1, 1, 1 };
    111       double hv = Hypervolume.Calculate(front, referencePoint, new bool[3]);
     112      double hv = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, new bool[3]);
    112113      Assert.AreEqual(0.5, hv);
    113114    }
  • branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Analysis-3.3/Multi-objective/GenerationalDistanceTest.cs

    r17261 r17262  
    2020#endregion
    2121using System;
     22using HeuristicLab.Analysis;
    2223using Microsoft.VisualStudio.TestTools.UnitTesting;
    2324
    24 namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
     25namespace HeuristicLab.Analysis.MultiObjective.Tests {
    2526  [TestClass]
    2627  public class GenerationalDistanceTest {
     
    2829    [TestMethod]
    2930    [ExpectedException(typeof(ArgumentException))]
    30     [TestCategory("Problems.TestFunctions.MultiObjective")]
     31    [TestCategory("Analysis.MultiObjective")]
    3132    [TestProperty("Time", "short")]
    3233    public void GenerationalDistanceTestEmptyOptimalFront() {
     
    3738      double[][] front = { point };
    3839      double[][] referencefront = { };
    39       GenerationalDistance.Calculate(front, referencefront, 1);
     40      GenerationalDistanceAnalyzer.CalculateGenerationalDistance(front, referencefront, 1);
    4041    }
    4142
    4243    [TestMethod]
    4344    [ExpectedException(typeof(ArgumentException))]
    44     [TestCategory("Problems.TestFunctions.MultiObjective")]
     45    [TestCategory("Analysis.MultiObjective")]
    4546    [TestProperty("Time", "short")]
    4647    public void GenerationalDistanceTestEmptyFront() {
     
    5152      double[][] front = { };
    5253      double[][] referencefront = { point };
    53       GenerationalDistance.Calculate(front, referencefront, 1);
     54      GenerationalDistanceAnalyzer.CalculateGenerationalDistance(front, referencefront, 1);
    5455    }
    5556
    5657    [TestMethod]
    57     [TestCategory("Problems.TestFunctions.MultiObjective")]
     58    [TestCategory("Analysis.MultiObjective")]
    5859    [TestProperty("Time", "short")]
    5960    public void GenerationalDistanceTestSamePoint() {
     
    6768      point1[1] = 0.5;
    6869      double[][] referencefront = { point1 };
    69       double dist = GenerationalDistance.Calculate(front, referencefront, 1);
     70      double dist = GenerationalDistanceAnalyzer.CalculateGenerationalDistance(front, referencefront, 1);
    7071      Assert.AreEqual(0, dist);
    7172    }
    7273
    7374    [TestMethod]
    74     [TestCategory("Problems.TestFunctions.MultiObjective")]
     75    [TestCategory("Analysis.MultiObjective")]
    7576    [TestProperty("Time", "short")]
    7677    public void GenerationalDistanceTestSinglePoint() {
     
    8384      point2[1] = 1;
    8485      double[][] referencefront = { point2 };
    85       double dist = GenerationalDistance.Calculate(front, referencefront, 1);
     86      double dist = GenerationalDistanceAnalyzer.CalculateGenerationalDistance(front, referencefront, 1);
    8687      Assert.AreEqual(Math.Sqrt(2), dist);
    8788    }
    8889
    8990    [TestMethod]
    90     [TestCategory("Problems.TestFunctions.MultiObjective")]
     91    [TestCategory("Analysis.MultiObjective")]
    9192    [TestProperty("Time", "short")]
    9293    public void GenerationalDistanceTestDifferentSizes() {
     
    102103      point2[1] = 0;
    103104      double[][] referencefront = { point2 };
    104       double dist = GenerationalDistance.Calculate(front, referencefront, 1);
     105      double dist = GenerationalDistanceAnalyzer.CalculateGenerationalDistance(front, referencefront, 1);
    105106      Assert.AreEqual(0.75, dist);
    106107    }
    107108
    108109    [TestMethod]
    109     [TestCategory("Problems.TestFunctions.MultiObjective")]
     110    [TestCategory("Analysis.MultiObjective")]
    110111    [TestProperty("Time", "short")]
    111112    public void GenerationalDistanceTestQuadratic() {
     
    124125      point3[1] = 1;
    125126      double[][] referencefront = { point2, point3 };
    126       double dist = GenerationalDistance.Calculate(front, referencefront, 1);
     127      double dist = GenerationalDistanceAnalyzer.CalculateGenerationalDistance(front, referencefront, 1);
    127128      Assert.AreEqual(1, dist);
    128129    }
  • branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Analysis-3.3/Multi-objective/HyperVolumeTests.cs

    r17261 r17262  
    2020#endregion
    2121using System;
     22using System.Linq;
     23using HeuristicLab.Optimization;
    2224using Microsoft.VisualStudio.TestTools.UnitTesting;
    2325
    24 namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
     26namespace HeuristicLab.Analysis.MultiObjective.Tests {
    2527  [TestClass]
    2628  public class HypervolumeTest {
     
    3436    /// +-----+
    3537    ///
    36     /// box between(0,0) and(1,1) with singular point pareto front at(0.5,0.5)
     38    /// box between(0,0) and(1,1) with singular point Pareto front at(0.5,0.5)
    3739    /// Hypervolume to each of the corners should be 0.25; 
    3840    ///
    3941    /// </summary>
    4042    [TestMethod]
    41     [TestCategory("Problems.TestFunctions.MultiObjective")]
     43    [TestCategory("Analysis.MultiObjective")]
    4244    [TestProperty("Time", "short")]
    4345    public void HypervolumeTestSinglePoint() {
     
    5658      referencePoint[0] = 1;
    5759      referencePoint[1] = 1;
    58       double ne = Hypervolume.Calculate(front, referencePoint, maximization);
     60      double ne = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    5961      Assert.AreEqual(0.25, ne);
    6062
     
    6365      referencePoint[0] = 0;
    6466      referencePoint[1] = 1;
    65       double nw = Hypervolume.Calculate(front, referencePoint, maximization);
     67      double nw = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    6668      Assert.AreEqual(0.25, nw);
    6769
     
    7072      referencePoint[0] = 0;
    7173      referencePoint[1] = 0;
    72       double sw = Hypervolume.Calculate(front, referencePoint, maximization);
     74      double sw = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    7375      Assert.AreEqual(0.25, sw);
    7476
     
    7779      referencePoint[0] = 1;
    7880      referencePoint[1] = 0;
    79       double se = Hypervolume.Calculate(front, referencePoint, maximization);
     81      double se = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    8082      Assert.AreEqual(0.25, se);
    8183
     
    9193    /// +-----+
    9294    ///
    93     /// box between(0,0) and(1,1) with singular point pareto front at a random Location
     95    /// box between(0,0) and(1,1) with singular point Pareto front at a random Location
    9496    /// Sum of the Hypervolume to each of the corners should be 1; 
    9597    ///
    9698    /// </summary>
    9799    [TestMethod]
    98     [TestCategory("Problems.TestFunctions.MultiObjective")]
     100    [TestCategory("Analysis.MultiObjective")]
    99101    [TestProperty("Time", "short")]
    100102    public void HypervolumeTestRandomSinglePoint() {
     
    114116      referencePoint[0] = 1;
    115117      referencePoint[1] = 1;
    116       double ne = Hypervolume.Calculate(front, referencePoint, maximization);
    117 
    118       //NorthWest
    119       maximization = new bool[] { true, false };
    120       referencePoint[0] = 0;
    121       referencePoint[1] = 1;
    122       double nw = Hypervolume.Calculate(front, referencePoint, maximization);
    123 
    124       //SouthWest
    125       maximization = new bool[] { true, true };
    126       referencePoint[0] = 0;
    127       referencePoint[1] = 0;
    128       double sw = Hypervolume.Calculate(front, referencePoint, maximization);
    129 
    130       //SouthEast
    131       maximization = new bool[] { false, true };
    132       referencePoint[0] = 1;
    133       referencePoint[1] = 0;
    134       double se = Hypervolume.Calculate(front, referencePoint, maximization);
     118      double ne = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
     119
     120      //NorthWest
     121      maximization = new bool[] { true, false };
     122      referencePoint[0] = 0;
     123      referencePoint[1] = 1;
     124      double nw = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
     125
     126      //SouthWest
     127      maximization = new bool[] { true, true };
     128      referencePoint[0] = 0;
     129      referencePoint[1] = 0;
     130      double sw = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
     131
     132      //SouthEast
     133      maximization = new bool[] { false, true };
     134      referencePoint[0] = 1;
     135      referencePoint[1] = 0;
     136      double se = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    135137      Assert.AreEqual(1.0, ne + se + nw + sw, 1e8);
    136138    }
     
    144146    /// +-----x
    145147    ///
    146     /// box between(0,0) and(1,1) with three point (pareto) front at (1,0), (0.5,0.5)  and (0,1)
    147     /// Hypervolume to (1,0) and (0,1) of the corners should be 1 (dominated Points need to be reemoved beforehand and   
     148    /// box between(0,0) and(1,1) with three point (Pareto) front at (1,0), (0.5,0.5)  and (0,1)
     149    /// Hypervolume to (1,0) and (0,1) of the corners should be 1 (dominated Points need to be removed beforehand and   
    148150    /// Hypervolume to (0,0) and (1,1) of the corners should be 0.25
    149151    /// </summary>
    150152    [TestMethod]
    151     [TestCategory("Problems.TestFunctions.MultiObjective")]
     153    [TestCategory("Analysis.MultiObjective")]
    152154    [TestProperty("Time", "short")]
    153155    public void HypervolumeTestDiagonalPoint() {
     
    171173      referencePoint[0] = 1;
    172174      referencePoint[1] = 1;
    173       double ne = Hypervolume.Calculate(front, referencePoint, maximization);
     175      double ne = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    174176      Assert.AreEqual(0.25, ne);
    175177
     
    178180      referencePoint[0] = 0;
    179181      referencePoint[1] = 1;
    180       double nw = Hypervolume.Calculate(NonDominatedSelect.SelectNonDominatedVectors(front, maximization, true), referencePoint, maximization);
     182      var nonDominatedFront = DominationCalculator.CalculateBestParetoFront(front, front, maximization, false).Select(i => i.Item2).ToList();
     183      double nw = HypervolumeCalculator.CalculateHypervolume(nonDominatedFront, referencePoint, maximization);
    181184      Assert.AreEqual(1, nw);
    182185
     
    185188      referencePoint[0] = 0;
    186189      referencePoint[1] = 0;
    187       double sw = Hypervolume.Calculate(front, referencePoint, maximization);
     190      double sw = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    188191      Assert.AreEqual(0.25, sw);
    189192
     
    192195      referencePoint[0] = 1;
    193196      referencePoint[1] = 0;
    194       double se = Hypervolume.Calculate(NonDominatedSelect.SelectNonDominatedVectors(front, maximization, true), referencePoint, maximization);
     197      nonDominatedFront = DominationCalculator.CalculateBestParetoFront(front, front, maximization, false).Select(i => i.Item2).ToList();
     198      double se = HypervolumeCalculator.CalculateHypervolume(nonDominatedFront, referencePoint, maximization);
    195199      Assert.AreEqual(1, se);
    196200
     
    199203    [TestMethod()]
    200204    [ExpectedException(typeof(ArgumentException))]
    201     [TestCategory("Problems.TestFunctions.MultiObjective")]
     205    [TestCategory("Analysis.MultiObjective")]
    202206    [TestProperty("Time", "short")]
    203207    public void HypervolumeTestReferencePointViolationNE() {
     
    215219      referencePoint[0] = 1;
    216220      referencePoint[1] = 1;
    217       double ne = Hypervolume.Calculate(front, referencePoint, maximization);
    218     }
    219 
    220     [TestMethod()]
    221     [ExpectedException(typeof(ArgumentException))]
    222     [TestCategory("Problems.TestFunctions.MultiObjective")]
     221      double ne = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
     222    }
     223
     224    [TestMethod()]
     225    [ExpectedException(typeof(ArgumentException))]
     226    [TestCategory("Analysis.MultiObjective")]
    223227    [TestProperty("Time", "short")]
    224228    public void HypervolumeTestReferencePointViolationNW() {
     
    236240      referencePoint[0] = 0;
    237241      referencePoint[1] = 1;
    238       double nw = Hypervolume.Calculate(front, referencePoint, maximization);
     242      double nw = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    239243      Assert.AreEqual(0.25, nw);
    240244    }
     
    242246    [TestMethod()]
    243247    [ExpectedException(typeof(ArgumentException))]
    244     [TestCategory("Problems.TestFunctions.MultiObjective")]
     248    [TestCategory("Analysis.MultiObjective")]
    245249    [TestProperty("Time", "short")]
    246250    public void HypervolumeTestReferencePointViolationSW() {
     
    258262      referencePoint[0] = 0;
    259263      referencePoint[1] = 0;
    260       double sw = Hypervolume.Calculate(front, referencePoint, maximization);
     264      double sw = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    261265      Assert.AreEqual(0.25, sw);
    262266    }
     
    264268    [TestMethod()]
    265269    [ExpectedException(typeof(ArgumentException))]
    266     [TestCategory("Problems.TestFunctions.MultiObjective")]
     270    [TestCategory("Analysis.MultiObjective")]
    267271    [TestProperty("Time", "short")]
    268272    public void HypervolumeTestReferencePointViolationSE() {
     
    280284      referencePoint[0] = 1;
    281285      referencePoint[1] = 0;
    282       double se = Hypervolume.Calculate(front, referencePoint, maximization);
     286      double se = HypervolumeCalculator.CalculateHypervolume(front, referencePoint, maximization);
    283287      Assert.AreEqual(0.25, se);
    284288    }
  • branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Analysis-3.3/Multi-objective/InvertedGenerationalDistanceTest.cs

    r17261 r17262  
    2222using Microsoft.VisualStudio.TestTools.UnitTesting;
    2323
    24 namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
     24namespace HeuristicLab.Analysis.MultiObjective.Tests {
    2525  [TestClass]
    2626  public class InvertedGenerationalDistanceTest {
     
    2828    [TestMethod]
    2929    [ExpectedException(typeof(ArgumentException))]
    30     [TestCategory("Problems.TestFunctions.MultiObjective")]
     30    [TestCategory("Analysis.MultiObjective")]
    3131    [TestProperty("Time", "short")]
    3232    public void InvertedGenerationalDistanceTestEmptyOptimalFront() {
     
    3737      double[][] front = { point };
    3838      double[][] referencefront = { };
    39       InvertedGenerationalDistance.Calculate(front, referencefront, 1);
     39      GenerationalDistanceAnalyzer.CalculateInverseGenerationalDistance(front, referencefront, 1);
    4040    }
    4141
    4242    [TestMethod]
    4343    [ExpectedException(typeof(ArgumentException))]
    44     [TestCategory("Problems.TestFunctions.MultiObjective")]
     44    [TestCategory("Analysis.MultiObjective")]
    4545    [TestProperty("Time", "short")]
    4646    public void InvertedGenerationalDistanceTestEmptyFront() {
     
    5151      double[][] front = { };
    5252      double[][] referencefront = { point };
    53       InvertedGenerationalDistance.Calculate(front, referencefront, 1);
     53      GenerationalDistanceAnalyzer.CalculateInverseGenerationalDistance(front, referencefront, 1);
    5454    }
    5555
    5656    [TestMethod]
    57     [TestCategory("Problems.TestFunctions.MultiObjective")]
     57    [TestCategory("Analysis.MultiObjective")]
    5858    [TestProperty("Time", "short")]
    5959    public void InvertedGenerationalDistanceTestSamePoint() {
     
    6666      point1[1] = 0.5;
    6767      double[][] referencefront = { point1 };
    68       double dist = GenerationalDistance.Calculate(front, referencefront, 1);
     68      double dist = GenerationalDistanceAnalyzer.CalculateInverseGenerationalDistance(front, referencefront, 1);
    6969      Assert.AreEqual(0, dist);
    7070    }
    7171
    7272    [TestMethod]
    73     [TestCategory("Problems.TestFunctions.MultiObjective")]
     73    [TestCategory("Analysis.MultiObjective")]
    7474    [TestProperty("Time", "short")]
    7575    public void InvertedGenerationalDistanceTestSinglePoint() {
     
    8282      point2[1] = 1;
    8383      double[][] referencefront = { point2 };
    84       double dist = InvertedGenerationalDistance.Calculate(front, referencefront, 1);
     84      double dist = GenerationalDistanceAnalyzer.CalculateInverseGenerationalDistance(front, referencefront, 1);
    8585      Assert.AreEqual(Math.Sqrt(2), dist);
    8686    }
    8787
    8888    [TestMethod]
    89     [TestCategory("Problems.TestFunctions.MultiObjective")]
     89    [TestCategory("Analysis.MultiObjective")]
    9090    [TestProperty("Time", "short")]
    9191    public void InvertedGenerationalDistanceTestDifferentSizes() {
     
    101101      point2[1] = 0;
    102102      double[][] referencefront = { point2 };
    103       double dist = InvertedGenerationalDistance.Calculate(front, referencefront, 1);
     103      double dist = GenerationalDistanceAnalyzer.CalculateInverseGenerationalDistance(front, referencefront, 1);
    104104      Assert.AreEqual(0.5, dist);
    105105    }
    106106
    107107    [TestMethod]
    108     [TestCategory("Problems.TestFunctions.MultiObjective")]
     108    [TestCategory("Analysis.MultiObjective")]
    109109    [TestProperty("Time", "short")]
    110110    public void InvertedGenerationalDistanceTestQuadratic() {
     
    123123      point3[1] = 1;
    124124      double[][] referencefront = { point2, point3 };
    125       double dist = InvertedGenerationalDistance.Calculate(front, referencefront, 1);
     125      double dist = GenerationalDistanceAnalyzer.CalculateInverseGenerationalDistance(front, referencefront, 1);
    126126      Assert.AreEqual(1, dist);
    127127    }
  • branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Analysis-3.3/Multi-objective/SpacingTest.cs

    r17261 r17262  
    2222using Microsoft.VisualStudio.TestTools.UnitTesting;
    2323
    24 namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
     24namespace HeuristicLab.Analysis.MultiObjective.Tests {
    2525  [TestClass]
    2626  public class SpacingTest {
    2727    [TestMethod]
    2828    [ExpectedException(typeof(ArgumentException))]
    29     [TestCategory("Problems.TestFunctions.MultiObjective")]
     29    [TestCategory("Analysis.MultiObjective")]
    3030    [TestProperty("Time", "short")]
    3131    public void SpacingTestEmptyFront() {
    3232      double[][] front = { };
    3333
    34       Spacing.Calculate(front);
     34      SpacingAnalyzer.CalculateSpacing(front);
    3535    }
    3636
    3737    [TestMethod]
    38     [TestCategory("Problems.TestFunctions.MultiObjective")]
     38    [TestCategory("Analysis.MultiObjective")]
    3939    [TestProperty("Time", "short")]
    4040    public void SpacingTestSamePoint() {
     
    4848      point1[1] = 0.5;
    4949      double[][] front = { point, point1 };
    50       double dist = Spacing.Calculate(front);
     50      double dist = SpacingAnalyzer.CalculateSpacing(front);
    5151      Assert.AreEqual(0, dist);
    5252    }
    5353
    5454    [TestMethod]
    55     [TestCategory("Problems.TestFunctions.MultiObjective")]
     55    [TestCategory("Analysis.MultiObjective")]
    5656    [TestProperty("Time", "short")]
    5757    public void SpacingTestSinglePoint() {
     
    6060      point[1] = 0;
    6161      double[][] front = { point };
    62       double dist = Spacing.Calculate(front);
     62      double dist = SpacingAnalyzer.CalculateSpacing(front);
    6363      Assert.AreEqual(0, dist);
    6464    }
    6565
    6666    [TestMethod]
    67     [TestCategory("Problems.TestFunctions.MultiObjective")]
     67    [TestCategory("Analysis.MultiObjective")]
    6868    [TestProperty("Time", "short")]
    6969    public void SpacingTestQuadratic() {
     
    8282      point3[1] = 1;
    8383      double[][] front = { point, point1, point2, point3 };
    84       double dist = Spacing.Calculate(front);
     84      double dist = SpacingAnalyzer.CalculateSpacing(front);
    8585      Assert.AreEqual(0, dist);
    8686    }
    8787
    8888    [TestMethod]
    89     [TestCategory("Problems.TestFunctions.MultiObjective")]
     89    [TestCategory("Analysis.MultiObjective")]
    9090    [TestProperty("Time", "short")]
    9191    public void SpacingTestRectangular() {
     
    104104      point3[1] = 1;
    105105      double[][] front = { point, point1, point2, point3 };
    106       double dist = Spacing.Calculate(front);
     106      double dist = SpacingAnalyzer.CalculateSpacing(front);
    107107      Assert.AreEqual(0, dist);
    108108    }
     
    111111    /// deltoid with 3 points of the 1-unit-square and the northeastern point at 4,4
    112112    /// which gives d=(1,1,1,5) for minimal distances. Mean of d is 2 and variance of d is 3
    113     /// Spacing is defined as the standarddeviation of d
     113    /// Spacing is defined as the standard deviation of d
    114114    /// </summary>
    115115    [TestMethod]
    116     [TestCategory("Problems.TestFunctions.MultiObjective")]
     116    [TestCategory("Analysis.MultiObjective")]
    117117    [TestProperty("Time", "short")]
    118118    public void SpacingTestDeltoid() {
     
    131131      point3[1] = 4;
    132132      double[][] front = { point, point1, point2, point3 };
    133       double dist = Spacing.Calculate(front);
     133      double dist = SpacingAnalyzer.CalculateSpacing(front);
    134134      Assert.AreEqual(Math.Sqrt(3), dist);
    135135    }
  • branches/2521_ProblemRefactoring/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r17226 r17262  
    636636    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SumSquaresEvaluatorTest.cs" />
    637637    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\ZakharovEvaluatorTest.cs" />
    638     <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\CrowdingTest.cs" />
    639     <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\FastHyperVolumeTests.cs" />
    640     <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\GenerationalDistanceTest.cs" />
    641     <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\HyperVolumeTests.cs" />
    642     <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\InvertedGenerationalDistanceTest.cs" />
    643     <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\SpacingTest.cs" />
     638    <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\CrowdingTest.cs" />
     639    <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\FastHyperVolumeTests.cs" />
     640    <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\GenerationalDistanceTest.cs" />
     641    <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\HyperVolumeTests.cs" />
     642    <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\InvertedGenerationalDistanceTest.cs" />
     643    <Compile Include="HeuristicLab.Analysis-3.3\Multi-objective\SpacingTest.cs" />
    644644    <Compile Include="HeuristicLab.Problems.TravelingSalesman-3.3\TSPMoveEvaluatorTest.cs" />
    645645    <Compile Include="HeuristicLab.Problems.LinearAssignment-3.3\LinearAssignmentProblemSolverTest.cs" />
Note: See TracChangeset for help on using the changeset viewer.