Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/19/10 15:59:37 (14 years ago)
Author:
abeham
Message:

Updated RealVector encoding to use a double matrix as bounds #929

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/MichalewiczNonUniformAllPositionsManipulatorTest.cs

    r3061 r3123  
    8686      TestRandom random = new TestRandom();
    8787      RealVector parent, expected;
    88       DoubleValue min, max, generationsDependency;
     88      DoubleValue generationsDependency;
     89      DoubleMatrix bounds;
    8990      IntValue currentGeneration, maximumGenerations;
    9091      bool exceptionFired;
     
    9495      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    9596      expected = new RealVector(new double[] { 0.45, 0.22, 0.3, 0.6, 0.14 });
    96       min = new DoubleValue(0.3);
    97       max = new DoubleValue(0.7);
     97      bounds = new DoubleMatrix(new double[,] { { 0.3, 0.7 } });
    9898      generationsDependency = new DoubleValue(0.1);
    9999      currentGeneration = new IntValue(1);
    100100      maximumGenerations = new IntValue(4);
    101       MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency);
     101      MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, bounds, currentGeneration, maximumGenerations, generationsDependency);
    102102      Assert.IsTrue(Auxiliary.RealVectorIsAlmostEqualByPosition(expected, parent));
    103103      // The following test is not based on published examples
     
    106106      random.DoubleNumbers = new double[] { 0.2, 0.5, 0.7, 0.8, 0.9, 0.5, 0.2, 0.5, 0.7, 0.8 };
    107107      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    108       min = new DoubleValue(0.3);
    109       max = new DoubleValue(0.7);
     108      bounds = new DoubleMatrix(new double[,] { { 0.3, 0.7 } });
    110109      generationsDependency = new DoubleValue(0.1);
    111110      currentGeneration = new IntValue(5); //current generation > max generation
    112111      maximumGenerations = new IntValue(4);
    113112      try {
    114         MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, min, max, currentGeneration, maximumGenerations, generationsDependency);
     113        MichalewiczNonUniformAllPositionsManipulator.Apply(random, parent, bounds, currentGeneration, maximumGenerations, generationsDependency);
    115114      }
    116115      catch (System.ArgumentException) {
Note: See TracChangeset for help on using the changeset viewer.