Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6506


Ignore:
Timestamp:
07/04/11 22:17:22 (13 years ago)
Author:
abeham
Message:

#1571

  • fixed bug in the Polynomial*PositionManipulator
  • updated test case
Location:
trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/PolynomialAllPositionManipulator.cs

    r5445 r6506  
    8787        if (u < 0.5) {
    8888          delta = Math.Pow(2 * u, 1.0 / (contiguity.Value + 1)) - 1.0;
    89         } else if (u > 0.5) {
    90           delta = 1.0 - Math.Pow(2.0 - 2.0 * u, 1.0 / contiguity.Value + 1);
    91         } else if (u == 0.5) delta = 0;
     89        } else if (u >= 0.5) {
     90          delta = 1.0 - Math.Pow(2.0 - 2.0 * u, 1.0 / (contiguity.Value + 1));
     91        }
    9292
    9393        vector[index] += delta * maxManipulation.Value;
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Manipulators/PolynomialOnePositionManipulator.cs

    r5445 r6506  
    8989      if (u < 0.5) {
    9090        delta = Math.Pow(2 * u, 1.0 / (contiguity + 1)) - 1.0;
    91       } else if (u > 0.5) {
    92         delta = 1.0 - Math.Pow(2.0 - 2.0 * u, 1.0 / contiguity + 1);
    93       } else delta = 0;
     91      } else if (u >= 0.5) {
     92        delta = 1.0 - Math.Pow(2.0 - 2.0 * u, 1.0 / (contiguity + 1));
     93      }
    9494
    9595      return delta;
  • trunk/sources/HeuristicLab.Encodings.RealVectorEncoding/3.3/Tests/PolynomialAllPositionManipulatorTest.cs

    r5445 r6506  
    9292      random.DoubleNumbers = new double[] { 0.2, 0.7, 0.8, 0.01, 0.1 };
    9393      parent = new RealVector(new double[] { 0.2, 0.2, 0.3, 0.5, 0.1 });
    94       expected = new RealVector(new double[] { 0.120213215256006, 0.336631954950876, 0.474551336679454, 0.322759240811056, -0.0182075293954083 });
     94      expected = new RealVector(new double[] { 0.120213215256006, 0.249415354697564, 0.379786784743994, 0.322759240811056, -0.0182075293954083 });
    9595      contiguity = new DoubleValue(0.8);
    9696      maxManipulation = new DoubleValue(0.2);
     
    106106      try {
    107107        PolynomialAllPositionManipulator.Apply(random, parent, contiguity, maxManipulation);
    108       }
    109       catch (System.ArgumentException) {
     108      } catch (System.ArgumentException) {
    110109        exceptionFired = true;
    111110      }
Note: See TracChangeset for help on using the changeset viewer.