Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/23/13 15:56:50 (11 years ago)
Author:
ascheibe
Message:

#1886 fixed LPHull, seems to work now

Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/ConvexHullTest.cs

    r9945 r10081  
    2828using Microsoft.VisualStudio.TestTools.UnitTesting;
    2929
    30 namespace Visualization {
     30namespace AlgorithmBehaviorUnitTests {
    3131  [TestClass]
    3232  public class ConvexHullTest {
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/LPConvexHullTest.cs

    r10060 r10081  
    2828using Microsoft.VisualStudio.TestTools.UnitTesting;
    2929
    30 namespace Visualization {
     30namespace AlgorithmBehaviorUnitTests {
    3131  [TestClass]
    3232  public class LPConvexHullTest {
    3333    [TestMethod]
    3434    public void TestMethod1() {
    35       int nrOfSamples = 10;
     35      int nrOfSamples = 70;
    3636      int sampleSize = 2;
    3737      double[][] inputs = CreateRandomData(nrOfSamples, sampleSize);
     
    7070    }
    7171
     72    [TestMethod]
     73    public void TestExt() {
     74      var inputs = CreateDataExtremePoint1().ToList();
     75      double[] alpha = inputs.Last();
     76      bool result = LPHull.EXT(inputs, alpha, inputs.Count() - 1);
     77      Assert.IsTrue(result);
     78
     79      inputs = CreateDataExtremePoint2().ToList();
     80      alpha = inputs.Last();
     81      result = LPHull.EXT(inputs, alpha, inputs.Count() - 1);
     82      Assert.IsTrue(result);
     83
     84      inputs = CreateDataNonExtremePoint1().ToList();
     85      alpha = inputs.Last();
     86      result = LPHull.EXT(inputs, alpha, inputs.Count() - 1);
     87      Assert.IsFalse(result);
     88
     89      inputs = CreateDataOnHull().ToList();
     90      alpha = inputs.Last();
     91      result = LPHull.EXT(inputs, alpha, inputs.Count() - 1);
     92      Assert.IsFalse(result);
     93    }
     94
     95    private double[][] CreateDataExtremePoint1() {
     96      double[][] result = new double[5][];
     97
     98      result[0] = new double[] { 0.1, 0.1 };
     99      result[1] = new double[] { 1, 1 };
     100      result[2] = new double[] { 1, 0 };
     101      result[3] = new double[] { 0, 1 };
     102      result[4] = new double[] { 2.0, 1.4 };
     103
     104      return result;
     105    }
     106
     107    private double[][] CreateDataExtremePoint2() {
     108      double[][] result = new double[5][];
     109
     110      result[0] = new double[] { 0.1, 0.1 };
     111      result[1] = new double[] { 1, 1 };
     112      result[2] = new double[] { 1, 0 };
     113      result[3] = new double[] { 0, 1 };
     114      result[4] = new double[] { 1.0, 1.4 };
     115
     116      return result;
     117    }
     118
     119    private double[][] CreateDataNonExtremePoint1() {
     120      double[][] result = new double[5][];
     121
     122      result[0] = new double[] { 0.1, 0.1 };
     123      result[1] = new double[] { 1, 1 };
     124      result[2] = new double[] { 1, 0 };
     125      result[3] = new double[] { 0, 1 };
     126      result[4] = new double[] { 0.8, 0.4 };
     127
     128      return result;
     129    }
     130
     131    private double[][] CreateDataOnHull() {
     132      double[][] result = new double[5][];
     133
     134      result[0] = new double[] { 0.1, 0.1 };
     135      result[1] = new double[] { 1, 1 };
     136      result[2] = new double[] { 1, 0 };
     137      result[3] = new double[] { 0, 1 };
     138      result[4] = new double[] { 1.0, 0.5 };
     139
     140      return result;
     141    }
     142
    72143    private List<DefaultVertex> ConvertPermutationToVertex(double[][] data) {
    73144      List<DefaultVertex> result = new List<DefaultVertex>();
Note: See TracChangeset for help on using the changeset viewer.