Changeset 14121


Ignore:
Timestamp:
07/19/16 18:24:53 (15 months ago)
Author:
mkommend
Message:

#1087: Copied unit tests from branch and adapted path of multi-objective test function project file.

Location:
trunk/sources
Files:
1 added
2 edited
6 copied

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.TestFunctions.MultiObjective/3.3/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3.csproj

    r14120 r14121  
    2121    <DebugType>full</DebugType>
    2222    <Optimize>false</Optimize>
    23     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     23    <OutputPath>..\..\bin\</OutputPath>
    2424    <DefineConstants>DEBUG;TRACE</DefineConstants>
    2525    <ErrorReport>prompt</ErrorReport>
     
    3030    <DebugType>pdbonly</DebugType>
    3131    <Optimize>true</Optimize>
    32     <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath>
     32    <OutputPath>..\..\bin\</OutputPath>
    3333    <DefineConstants>TRACE</DefineConstants>
    3434    <ErrorReport>prompt</ErrorReport>
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3/CrowdingTest.cs

    r14111 r14121  
    2020#endregion
    2121using System;
    22 using HeuristicLab.Problems.TestFunctions.MultiObjective;
    2322using Microsoft.VisualStudio.TestTools.UnitTesting;
    2423
    25 namespace MultiObjectiveTestfunctionTests {
     24namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
    2625  [TestClass]
    2726  public class CrowdingTest {
     
    2928    [TestMethod]
    3029    [ExpectedException(typeof(ArgumentException))]
    31     [TestCategory("Problems.TestFunctions")]
     30    [TestCategory("Problems.TestFunctions.MultiObjective")]
    3231    [TestProperty("Time", "short")]
    33     public void EmptyFrontTest() {
     32    public void CrowdingTestEmptyFront() {
    3433      double[][] front = { };
    3534
     
    3837
    3938    [TestMethod]
    40     [TestCategory("Problems.TestFunctions")]
     39    [TestCategory("Problems.TestFunctions.MultiObjective")]
    4140    [TestProperty("Time", "short")]
    42     public void SamePointTest() {
     41    public void CrowdingTestSamePoint() {
    4342
    4443      double[] point = new double[2];
     
    5554
    5655    [TestMethod]
    57     [TestCategory("Problems.TestFunctions")]
     56    [TestCategory("Problems.TestFunctions.MultiObjective")]
    5857    [TestProperty("Time", "short")]
    59     public void SinglePointTest() {
     58    public void CrowdingTestSinglePoint() {
    6059      double[] point = new double[2];
    6160      point[0] = 0;
     
    6766
    6867    [TestMethod]
    69     [TestCategory("Problems.TestFunctions")]
     68    [TestCategory("Problems.TestFunctions.MultiObjective")]
    7069    [TestProperty("Time", "short")]
    71     public void DiagonalTest() {
     70    public void CrowdingTestDiagonal() {
    7271      double[] point = new double[2];
    7372      point[0] = 0;
     
    8685
    8786    [TestMethod]
    88     [TestCategory("Problems.TestFunctions")]
     87    [TestCategory("Problems.TestFunctions.MultiObjective")]
    8988    [TestProperty("Time", "short")]
    90     public void DiamondTest() {
     89    public void CrowdingTestDiamond() {
    9190      double[] point = new double[2];
    9291      point[0] = 0;
     
    112111    /// </summary>
    113112    [TestMethod]
    114     [TestCategory("Problems.TestFunctions")]
     113    [TestCategory("Problems.TestFunctions.MultiObjective")]
    115114    [TestProperty("Time", "short")]
    116     public void DeltoidTest() {
     115    public void CrowdingTestDeltoid() {
    117116      double[] point = new double[2];
    118117      point[0] = 0;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3/FastHyperVolumeTests.cs

    r14111 r14121  
    2020#endregion
    2121using System;
    22 using System.Collections.Generic;
    23 using HeuristicLab.Problems.TestFunctions.MultiObjective;
    2422using Microsoft.VisualStudio.TestTools.UnitTesting;
    2523
    26 namespace MultiObjectiveTestfunctionTests {
     24namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
    2725  [TestClass]
    2826  public class FastHypervolumeTest {
     
    4038    /// </summary>
    4139    [TestMethod]
    42     [TestCategory("Problems.TestFunctions")]
     40    [TestCategory("Problems.TestFunctions.MultiObjective")]
    4341    [TestProperty("Time", "short")]
    44     public void SinglePointTest() {
     42    public void FastHypervolumeTestSinglePoint() {
    4543      double[] point = new double[] { 0.5, 0.5, 0.5 };
    4644      double[][] front = { point };
     
    6361    /// </summary>
    6462    [TestMethod]
    65     [TestCategory("Problems.TestFunctions")]
     63    [TestCategory("Problems.TestFunctions.MultiObjective")]
    6664    [TestProperty("Time", "short")]
    67     public void RandomSinglePointTest() {
     65    public void FastHypervolumeTestRandomSinglePoint() {
    6866      //Front with a single Point
    6967      double[] point = new double[3];
    70       Random r = new Random();
     68      var r = new System.Random();
    7169
    7270      point[0] = r.NextDouble();
     
    10098    /// Hypervolume should be 0.25
    10199    /// </summary>
    102     //[TestMethod]
    103     public void DiagonalPointTest() {
     100    [TestMethod]
     101    [TestCategory("Problems.TestFunctions.MultiObjective")]
     102    [TestProperty("Time", "short")]
     103    public void FastHypervolumeTestDiagonalPoint() {
    104104      //Front with three points
    105105      double[] point1 = new double[] { 1, 0, 0 };
     
    110110      double[] referencePoint = new double[] { 1, 1, 1 };
    111111      double hv = Hypervolume.Calculate(front, referencePoint, new bool[3]);
    112       Assert.AreEqual(0.25, hv);
     112      Assert.AreEqual(0.5, hv);
    113113    }
    114 
    115 
    116     public void HypervolumeConsistencyTest() {
    117       double[] referencePoint = new double[] { 1, 1, 1 };
    118       bool[] maximization = new bool[3];
    119       List<double[]> points = new List<double[]>();
    120       Random r = new Random();
    121       for (int i = 0; i < 100; i++) {
    122         double[] p = new double[3];
    123         p[0] = r.NextDouble();
    124         p[1] = r.NextDouble();
    125         points.Add(p);
    126       }
    127       var front = NonDominatedSelect.SelectNonDominatedVectors(points, maximization, true);
    128 
    129       double dim3hv = Hypervolume.Calculate(front, referencePoint, new bool[3]);
    130       double dim2hv = Hypervolume.Calculate(front, referencePoint, maximization);
    131 
    132 
    133 
    134 
    135     }
    136 
    137 
    138114  }
    139 
    140 
    141115}
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3/GenerationalDistanceTest.cs

    r14111 r14121  
    2020#endregion
    2121using System;
    22 using HeuristicLab.Problems.TestFunctions.MultiObjective;
    2322using Microsoft.VisualStudio.TestTools.UnitTesting;
    2423
    25 namespace MultiObjectiveTestfunctionTests {
     24namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
    2625  [TestClass]
    2726  public class GenerationalDistanceTest {
     
    2928    [TestMethod]
    3029    [ExpectedException(typeof(ArgumentException))]
    31     [TestCategory("Problems.TestFunctions")]
     30    [TestCategory("Problems.TestFunctions.MultiObjective")]
    3231    [TestProperty("Time", "short")]
    33     public void EmptyOptimalFrontTest() {
     32    public void GenerationalDistanceTestEmptyOptimalFront() {
    3433
    3534      double[] point = new double[2];
     
    4342    [TestMethod]
    4443    [ExpectedException(typeof(ArgumentException))]
    45     [TestCategory("Problems.TestFunctions")]
     44    [TestCategory("Problems.TestFunctions.MultiObjective")]
    4645    [TestProperty("Time", "short")]
    47     public void EmptyFrontTest() {
     46    public void GenerationalDistanceTestEmptyFront() {
    4847
    4948      double[] point = new double[2];
     
    5655
    5756    [TestMethod]
    58     [TestCategory("Problems.TestFunctions")]
     57    [TestCategory("Problems.TestFunctions.MultiObjective")]
    5958    [TestProperty("Time", "short")]
    60     public void SamePointTest() {
     59    public void GenerationalDistanceTestSamePoint() {
    6160
    6261      double[] point = new double[2];
     
    7372
    7473    [TestMethod]
    75     [TestCategory("Problems.TestFunctions")]
     74    [TestCategory("Problems.TestFunctions.MultiObjective")]
    7675    [TestProperty("Time", "short")]
    77     public void SinglePointTest() {
     76    public void GenerationalDistanceTestSinglePoint() {
    7877      double[] point = new double[2];
    7978      point[0] = 0;
     
    8988
    9089    [TestMethod]
    91     [TestCategory("Problems.TestFunctions")]
     90    [TestCategory("Problems.TestFunctions.MultiObjective")]
    9291    [TestProperty("Time", "short")]
    93     public void DifferentSizesTest() {
     92    public void GenerationalDistanceTestDifferentSizes() {
    9493      double[] point = new double[2];
    9594      point[0] = 0;
     
    108107
    109108    [TestMethod]
    110     [TestCategory("Problems.TestFunctions")]
     109    [TestCategory("Problems.TestFunctions.MultiObjective")]
    111110    [TestProperty("Time", "short")]
    112     public void QuadraticTest() {
     111    public void GenerationalDistanceTestQuadratic() {
    113112      double[] point = new double[2];
    114113      point[0] = 0;
     
    128127      Assert.AreEqual(1, dist);
    129128    }
    130 
    131 
    132 
    133129  }
    134 
    135 
    136130}
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3/HyperVolumeTests.cs

    r14111 r14121  
    2020#endregion
    2121using System;
    22 using HeuristicLab.Problems.TestFunctions.MultiObjective;
    2322using Microsoft.VisualStudio.TestTools.UnitTesting;
    2423
    25 namespace MultiObjectiveTestfunctionTests {
     24namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
    2625  [TestClass]
    2726  public class HypervolumeTest {
     
    4039    /// </summary>
    4140    [TestMethod]
    42     [TestCategory("Problems.TestFunctions")]
    43     [TestProperty("Time", "short")]
    44     public void SinglePointTest() {
     41    [TestCategory("Problems.TestFunctions.MultiObjective")]
     42    [TestProperty("Time", "short")]
     43    public void HypervolumeTestSinglePoint() {
    4544
    4645      //Front with a single Point
     
    9796    /// </summary>
    9897    [TestMethod]
    99     [TestCategory("Problems.TestFunctions")]
    100     [TestProperty("Time", "short")]
    101     public void RandomSinglePointTest() {
    102       //Front with a single Point
    103       double[] point = new double[2];
    104       Random r = new Random();
     98    [TestCategory("Problems.TestFunctions.MultiObjective")]
     99    [TestProperty("Time", "short")]
     100    public void HypervolumeTestRandomSinglePoint() {
     101      //Front with a single Point
     102      double[] point = new double[2];
     103      var r = new System.Random();
    105104
    106105      point[0] = r.NextDouble();
     
    150149    /// </summary>
    151150    [TestMethod]
    152     [TestCategory("Problems.TestFunctions")]
    153     [TestProperty("Time", "short")]
    154     public void DiagonalPointTest() {
     151    [TestCategory("Problems.TestFunctions.MultiObjective")]
     152    [TestProperty("Time", "short")]
     153    public void HypervolumeTestDiagonalPoint() {
    155154      //Front with three points
    156155      double[] point1 = new double[2];
     
    200199    [TestMethod()]
    201200    [ExpectedException(typeof(ArgumentException))]
    202     [TestCategory("Problems.TestFunctions")]
    203     [TestProperty("Time", "short")]
    204     public void ReferencePointViolationNE() {
    205       //Front with a single Point
    206       double[] point = new double[2];
    207       point[0] = 0.5;
    208       point[1] = 0.5;
    209       double[][] front = { point };
    210 
    211       double[] referencePoint = new double[2];
    212       bool[] maximization;
    213 
    214       //Northeast
    215       maximization = new bool[] { true, true };
    216       referencePoint[0] = 1;
    217       referencePoint[1] = 1;
    218       double ne = Hypervolume.Calculate(front, referencePoint, maximization);
    219     }
    220 
    221     [TestMethod()]
    222     [ExpectedException(typeof(ArgumentException))]
    223     [TestCategory("Problems.TestFunctions")]
    224     [TestProperty("Time", "short")]
    225     public void ReferencePointViolationNW() {
     201    [TestCategory("Problems.TestFunctions.MultiObjective")]
     202    [TestProperty("Time", "short")]
     203    public void HypervolumeTestReferencePointViolationNE() {
     204      //Front with a single Point
     205      double[] point = new double[2];
     206      point[0] = 0.5;
     207      point[1] = 0.5;
     208      double[][] front = { point };
     209
     210      double[] referencePoint = new double[2];
     211      bool[] maximization;
     212
     213      //Northeast
     214      maximization = new bool[] { true, true };
     215      referencePoint[0] = 1;
     216      referencePoint[1] = 1;
     217      double ne = Hypervolume.Calculate(front, referencePoint, maximization);
     218    }
     219
     220    [TestMethod()]
     221    [ExpectedException(typeof(ArgumentException))]
     222    [TestCategory("Problems.TestFunctions.MultiObjective")]
     223    [TestProperty("Time", "short")]
     224    public void HypervolumeTestReferencePointViolationNW() {
    226225      //Front with a single Point
    227226      double[] point = new double[2];
     
    243242    [TestMethod()]
    244243    [ExpectedException(typeof(ArgumentException))]
    245     [TestCategory("Problems.TestFunctions")]
    246     [TestProperty("Time", "short")]
    247     public void ReferencePointViolationSW() {
     244    [TestCategory("Problems.TestFunctions.MultiObjective")]
     245    [TestProperty("Time", "short")]
     246    public void HypervolumeTestReferencePointViolationSW() {
    248247      //Front with a single Point
    249248      double[] point = new double[2];
     
    265264    [TestMethod()]
    266265    [ExpectedException(typeof(ArgumentException))]
    267     [TestCategory("Problems.TestFunctions")]
    268     [TestProperty("Time", "short")]
    269     public void ReferencePointViolationSE() {
     266    [TestCategory("Problems.TestFunctions.MultiObjective")]
     267    [TestProperty("Time", "short")]
     268    public void HypervolumeTestReferencePointViolationSE() {
    270269      //Front with a single Point
    271270      double[] point = new double[2];
     
    284283      Assert.AreEqual(0.25, se);
    285284    }
    286 
    287285  }
    288 
    289 
    290286}
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3/InvertedGenerationalDistanceTest.cs

    r14111 r14121  
    2020#endregion
    2121using System;
    22 using HeuristicLab.Problems.TestFunctions.MultiObjective;
    2322using Microsoft.VisualStudio.TestTools.UnitTesting;
    2423
    25 namespace MultiObjectiveTestfunctionTests {
     24namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
    2625  [TestClass]
    2726  public class InvertedGenerationalDistanceTest {
     
    2928    [TestMethod]
    3029    [ExpectedException(typeof(ArgumentException))]
    31     [TestCategory("Problems.TestFunctions")]
     30    [TestCategory("Problems.TestFunctions.MultiObjective")]
    3231    [TestProperty("Time", "short")]
    33     public void EmptyOptimalFrontTest() {
     32    public void InvertedGenerationalDistanceTestEmptyOptimalFront() {
    3433
    3534      double[] point = new double[2];
     
    4342    [TestMethod]
    4443    [ExpectedException(typeof(ArgumentException))]
    45     [TestCategory("Problems.TestFunctions")]
     44    [TestCategory("Problems.TestFunctions.MultiObjective")]
    4645    [TestProperty("Time", "short")]
    47     public void EmptyFrontTest() {
     46    public void InvertedGenerationalDistanceTestEmptyFront() {
    4847
    4948      double[] point = new double[2];
     
    5655
    5756    [TestMethod]
    58     [TestCategory("Problems.TestFunctions")]
     57    [TestCategory("Problems.TestFunctions.MultiObjective")]
    5958    [TestProperty("Time", "short")]
    60     public void SamePointTest() {
     59    public void InvertedGenerationalDistanceTestSamePoint() {
    6160      double[] point = new double[2];
    6261      point[0] = 0.5;
     
    7271
    7372    [TestMethod]
    74     [TestCategory("Problems.TestFunctions")]
     73    [TestCategory("Problems.TestFunctions.MultiObjective")]
    7574    [TestProperty("Time", "short")]
    76     public void SinglePointTest() {
     75    public void InvertedGenerationalDistanceTestSinglePoint() {
    7776      double[] point = new double[2];
    7877      point[0] = 0;
     
    8887
    8988    [TestMethod]
    90     [TestCategory("Problems.TestFunctions")]
     89    [TestCategory("Problems.TestFunctions.MultiObjective")]
    9190    [TestProperty("Time", "short")]
    92     public void DifferentSizesTest() {
     91    public void InvertedGenerationalDistanceTestDifferentSizes() {
    9392      double[] point = new double[2];
    9493      point[0] = 0;
     
    107106
    108107    [TestMethod]
    109     [TestCategory("Problems.TestFunctions")]
     108    [TestCategory("Problems.TestFunctions.MultiObjective")]
    110109    [TestProperty("Time", "short")]
    111     public void QuadraticTest() {
     110    public void InvertedGenerationalDistanceTestQuadratic() {
    112111      double[] point = new double[2];
    113112      point[0] = 0;
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions.MultiObjective-3.3/SpacingTest.cs

    r14111 r14121  
    2020#endregion
    2121using System;
    22 using HeuristicLab.Problems.TestFunctions.MultiObjective;
    2322using Microsoft.VisualStudio.TestTools.UnitTesting;
    2423
    25 namespace MultiObjectiveTestfunctionTests {
     24namespace HeuristicLab.Problems.TestFunctions.MultiObjective.Tests {
    2625  [TestClass]
    2726  public class SpacingTest {
    28 
    29 
    3027    [TestMethod]
    3128    [ExpectedException(typeof(ArgumentException))]
    32     [TestCategory("Problems.TestFunctions")]
     29    [TestCategory("Problems.TestFunctions.MultiObjective")]
    3330    [TestProperty("Time", "short")]
    34     public void EmptyFrontTest() {
     31    public void SpacingTestEmptyFront() {
    3532      double[][] front = { };
    3633
     
    3936
    4037    [TestMethod]
    41     [TestCategory("Problems.TestFunctions")]
     38    [TestCategory("Problems.TestFunctions.MultiObjective")]
    4239    [TestProperty("Time", "short")]
    43     public void SamePointTest() {
     40    public void SpacingTestSamePoint() {
    4441
    4542      double[] point = new double[2];
     
    5653
    5754    [TestMethod]
    58     [TestCategory("Problems.TestFunctions")]
     55    [TestCategory("Problems.TestFunctions.MultiObjective")]
    5956    [TestProperty("Time", "short")]
    60     public void SinglePointTest() {
     57    public void SpacingTestSinglePoint() {
    6158      double[] point = new double[2];
    6259      point[0] = 0;
     
    6865
    6966    [TestMethod]
    70     [TestCategory("Problems.TestFunctions")]
     67    [TestCategory("Problems.TestFunctions.MultiObjective")]
    7168    [TestProperty("Time", "short")]
    72     public void QuadraticTest() {
     69    public void SpacingTestQuadratic() {
    7370      double[] point = new double[2];
    7471      point[0] = 0;
     
    9087
    9188    [TestMethod]
    92     [TestCategory("Problems.TestFunctions")]
     89    [TestCategory("Problems.TestFunctions.MultiObjective")]
    9390    [TestProperty("Time", "short")]
    94     public void RectangularTest() {
     91    public void SpacingTestRectangular() {
    9592      double[] point = new double[2];
    9693      point[0] = 0;
     
    117114    /// </summary>
    118115    [TestMethod]
    119     [TestCategory("Problems.TestFunctions")]
     116    [TestCategory("Problems.TestFunctions.MultiObjective")]
    120117    [TestProperty("Time", "short")]
    121     public void DeltoidTest() {
     118    public void SpacingTestDeltoid() {
    122119      double[] point = new double[2];
    123120      point[0] = 0;
     
    137134      Assert.AreEqual(Math.Sqrt(3), dist);
    138135    }
    139 
    140 
    141136  }
    142 
    143 
    144137}
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Tests.csproj

    r14024 r14121  
    385385    <Reference Include="HeuristicLab.Problems.TestFunctions-3.3">
    386386      <HintPath>..\bin\HeuristicLab.Problems.TestFunctions-3.3.dll</HintPath>
     387      <Private>False</Private>
     388    </Reference>
     389    <Reference Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     390      <SpecificVersion>False</SpecificVersion>
     391      <HintPath>..\bin\HeuristicLab.Problems.TestFunctions.MultiObjective-3.3.dll</HintPath>
    387392      <Private>False</Private>
    388393    </Reference>
     
    594599    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\SumSquaresEvaluatorTest.cs" />
    595600    <Compile Include="HeuristicLab.Problems.TestFunctions-3.3\ZakharovEvaluatorTest.cs" />
     601    <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\CrowdingTest.cs" />
     602    <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\FastHyperVolumeTests.cs" />
     603    <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\GenerationalDistanceTest.cs" />
     604    <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\HyperVolumeTests.cs" />
     605    <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\InvertedGenerationalDistanceTest.cs" />
     606    <Compile Include="HeuristicLab.Problems.TestFunctions.MultiObjective-3.3\SpacingTest.cs" />
    596607    <Compile Include="HeuristicLab.Problems.TravelingSalesman-3.3\TSPMoveEvaluatorTest.cs" />
    597608    <Compile Include="HeuristicLab.Problems.LinearAssignment-3.3\LinearAssignmentProblemSolverTest.cs" />
Note: See TracChangeset for help on using the changeset viewer.