Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/03/11 13:47:16 (14 years ago)
Author:
gkronber
Message:

Improved test cases for symbolic expression tree encoding and fixed minor bugs. #1336

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Tests/AllArchitectureAlteringOperatorsTest.cs

    r5367 r5411  
    8080            bool success = false;
    8181            op.ModifyArchitecture(random, selectedTree, grammar, maxTreeSize, maxTreeHeigth, maxDefuns, maxArgs, out success);
    82             if (!success) failedEvents++;
     82            if (!success) failedEvents++; // architecture manipulation might fail
    8383            Util.IsValid(selectedTree);
    8484            newTrees.Add(selectedTree);
     
    9393            bool success;
    9494            newTrees.Add(SubtreeCrossover.Cross(random, par0, par1, 0.9, MAX_TREE_SIZE, MAX_TREE_HEIGHT, out success));
    95             Assert.IsTrue(success);
     95            Assert.IsTrue(success); // crossover must succeed
    9696          }
    9797        }
     
    102102      Console.WriteLine("AllArchitectureAlteringOperators: " + Environment.NewLine +
    103103        "Operations / s: ~" + Math.Round(1000.0 / (msPerOperation)) + "operations / s)" + Environment.NewLine +
    104         "Failed events: " + failedEvents / (double)(POPULATION_SIZE * N_ITERATIONS) + "%" + Environment.NewLine +
     104        "Failed events: " + failedEvents * 100.0 / (double)(POPULATION_SIZE * N_ITERATIONS * 2.0) + "%" + Environment.NewLine +
    105105        Util.GetSizeDistributionString(trees, 200, 5) + Environment.NewLine +
    106106        Util.GetFunctionDistributionString(trees) + Environment.NewLine +
     
    108108        Util.GetTerminalDistributionString(trees) + Environment.NewLine
    109109        );
     110
     111      Assert.IsTrue(failedEvents * 100.0 / (POPULATION_SIZE * N_ITERATIONS * 2.0) < 25.0); // 75% of architecture operations must succeed
     112      Assert.IsTrue(Math.Round(1000.0 / (msPerOperation)) > 1000); // must achieve more than 1000 ops per second
    110113    }
    111114  }
Note: See TracChangeset for help on using the changeset viewer.