Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/23/16 19:31:18 (7 years ago)
Author:
bburlacu
Message:

#2685: Add correction step for values miscalculated due to cyclical symbol dependencies in the grammar. Updated unit test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.TestFunctions-3.3/MatyasEvaluatorTest.cs

    r14185 r14353  
    3737    [TestProperty("Time", "short")]
    3838    public void MatyasEvaluateFunctionTest() {
    39       MatyasEvaluator target = new MatyasEvaluator();
     39      var privateObject = new PrivateObject(typeof(MatyasEvaluator));
    4040      RealVector point = null;
    41       double expected = target.BestKnownQuality;
     41      double expected = (double)privateObject.GetProperty("BestKnownQuality");
    4242      double actual;
    43       for (int dimension = target.MinimumProblemSize; dimension <= System.Math.Min(10, target.MaximumProblemSize); dimension++) {
    44         point = target.GetBestKnownSolution(dimension);
    45         actual = target.Evaluate(point);
     43      int minimumProblemSize = (int)privateObject.GetProperty("MinimumProblemSize");
     44      int maximumProblemSize = (int)privateObject.GetProperty("MaximumProblemSize");
     45      for (int dimension = minimumProblemSize; dimension <= System.Math.Min(10, maximumProblemSize); dimension++) {
     46        point = (RealVector)privateObject.Invoke("GetBestKnownSolution", dimension);
     47        actual = (double)privateObject.Invoke("Evaluate", point);
    4648        Assert.AreEqual(expected, actual);
    4749      }
Note: See TracChangeset for help on using the changeset viewer.