Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/15/21 10:52:19 (3 years ago)
Author:
gkronber
Message:

#3140: various smaller changes in unit tests

Location:
branches/3140_NumberSymbol/HeuristicLab.Tests
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GPSymbolicRegressionSampleWithOSTest.cs

    r18119 r18126  
    6666        // Unfortunately, running the same test on a different machine results in different values
    6767        // For x86 environments the results below match but on x64 there is a difference
    68         // We tracked down the ConstantOptimizationEvaluator as a possible cause but have not
     68        // We tracked down the ParameterOptimizationEvaluator as a possible cause but have not
    6969        // been able to identify the real cause. Presumably, execution on a Xeon and a Core i7 processor
    7070        // leads to different results.
  • branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab-3.3/Samples/GeSymbolicRegressionSampleTest.cs

    r17180 r18126  
    113113        problem.SymbolicExpressionTreeGrammar.RemoveSymbol(c);
    114114      }
     115      var numbers = problem.SymbolicExpressionTreeGrammar.AllowedSymbols.OfType<Number>().ToList();
     116      foreach (var n in numbers) {
     117        problem.SymbolicExpressionTreeGrammar.RemoveSymbol(n);
     118      }
    115119
    116120      SamplesUtils.ConfigureOsGeneticAlgorithmParameters<GenderSpecificSelector, Encodings.IntegerVectorEncoding.SinglePointCrossover, Encodings.IntegerVectorEncoding.UniformOnePositionManipulator>(
  • branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionCrossoverTest.cs

    r17180 r18126  
    110110      grammar.MinimumFunctionDefinitions = 0;
    111111
    112       var trees = Util.CreateRandomTrees(twister, dataset, grammar, PopulationSize, 1, MaxTreeLength, 0, 0);
     112      var trees = Util.CreateRandomTrees(twister, dataset, grammar, PopulationSize, MaxTreeLength);
    113113      foreach (ISymbolicExpressionTree tree in trees) {
    114114        Util.InitTree(tree, twister, new List<string>(dataset.VariableNames));
  • branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs

    r17950 r18126  
    141141      grammar.ConfigureAsDefaultRegressionGrammar();
    142142
    143       var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 100, 0, 0);
     143      var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 100);
    144144      foreach (ISymbolicExpressionTree tree in randomTrees) {
    145145        Util.InitTree(tree, twister, new List<string>(dataset.VariableNames));
     
    155155
    156156      var grammar = new FullFunctionalExpressionGrammar();
    157       var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 100, 0, 0);
     157      var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 100);
    158158      foreach (ISymbolicExpressionTree tree in randomTrees) {
    159159        Util.InitTree(tree, twister, new List<string>(dataset.VariableNames));
     
    169169
    170170      var grammar = new ArithmeticExpressionGrammar();
    171       var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 100, 0, 0);
     171      var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 100);
    172172      foreach (SymbolicExpressionTree tree in randomTrees) {
    173173        Util.InitTree(tree, twister, new List<string>(dataset.VariableNames));
     
    249249
    250250      var rows = Enumerable.Range(0, numRows).ToList();
    251       var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 10, 0, 0);
     251      var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 10);
    252252      foreach (ISymbolicExpressionTree tree in randomTrees) {
    253253        Util.InitTree(tree, twister, new List<string>(dataset.VariableNames));
     
    299299      grammar.Symbols.First(x => x is Power).Enabled = false;
    300300
    301       var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 10, 0, 0);
     301      var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 10);
    302302      foreach (ISymbolicExpressionTree tree in randomTrees) {
    303303        Util.InitTree(tree, twister, new List<string>(dataset.VariableNames));
  • branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicExpressionTreeBottomUpSimilarityCalculatorTest.cs

    r18119 r18126  
    7777      var twister = new MersenneTwister(31415);
    7878      var ds = Util.CreateRandomDataset(twister, Rows, Columns);
    79       var trees = Util.CreateRandomTrees(twister, ds, grammar, N, 1, 100, 0, 0);
     79      var trees = Util.CreateRandomTrees(twister, ds, grammar, N, 100);
    8080
    8181      double s = 0;
     
    115115      var twister = new MersenneTwister(31415);
    116116      var ds = Util.CreateRandomDataset(twister, Rows, Columns);
    117       var trees = Util.CreateRandomTrees(twister, ds, grammar, N, 1, 100, 0, 0);
     117      var trees = Util.CreateRandomTrees(twister, ds, grammar, N, 100);
    118118
    119119      var similarityCalculator = new SymbolicExpressionTreeBottomUpSimilarityCalculator { MatchParameterValues = strict, MatchVariableWeights = strict };
  • branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/SymbolicExpressionTreeMaxCommonSubtreeSimilarityCalculatorTest.cs

    r11916 r18126  
    5353      var twister = new MersenneTwister(31415);
    5454      var ds = Util.CreateRandomDataset(twister, Rows, Columns);
    55       var trees = Util.CreateRandomTrees(twister, ds, grammar, N, 1, 100, 0, 0);
     55      var trees = Util.CreateRandomTrees(twister, ds, grammar, N, 100);
    5656
    5757      double s = 0;
  • branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic-3.4/Util.cs

    r17180 r18126  
    3535          varNode.Weight = twister.NextDouble() * 20.0 - 10.0;
    3636          varNode.VariableName = varNames[twister.Next(varNames.Count)];
    37         } else if (node is ConstantTreeNode) {
    38           var constantNode = node as ConstantTreeNode;
    39           constantNode.Value = twister.NextDouble() * 20.0 - 10.0;
     37        } else if (node is NumberTreeNode) {
     38          var numNode = node as NumberTreeNode;
     39          numNode.Value = twister.NextDouble() * 20.0 - 10.0;
    4040        }
    4141      }
     
    4444
    4545    public static ISymbolicExpressionTree[] CreateRandomTrees(MersenneTwister twister, Dataset dataset, ISymbolicExpressionGrammar grammar, int popSize) {
    46       return CreateRandomTrees(twister, dataset, grammar, popSize, 1, 200, 3, 3);
     46      return CreateRandomTrees(twister, dataset, grammar, popSize, 200);
    4747    }
    4848
    4949    public static ISymbolicExpressionTree[] CreateRandomTrees(MersenneTwister twister, Dataset dataset, ISymbolicExpressionGrammar grammar,
    50       int popSize, int minSize, int maxSize,
    51       int maxFunctionDefinitions, int maxFunctionArguments) {
     50      int popSize, int maxSize) {
    5251      foreach (Variable variableSymbol in grammar.Symbols.OfType<Variable>()) {
    5352        variableSymbol.VariableNames = dataset.VariableNames.Skip(1);
  • branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis-3.4/SymbolicDataAnalysisExpressionTreeInterpreterTest.cs

    r17180 r18126  
    6666      grammar.MinimumFunctionArguments = 0;
    6767      grammar.MinimumFunctionDefinitions = 0;
    68       var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 100, 0, 0);
     68      var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 100);
    6969      foreach (ISymbolicExpressionTree tree in randomTrees) {
    7070        Util.InitTree(tree, twister, new List<string>(dataset.VariableNames));
     
    8383      grammar.MinimumFunctionArguments = 0;
    8484      grammar.MinimumFunctionDefinitions = 0;
    85       var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 100, 0, 0);
     85      var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 100);
    8686      foreach (ISymbolicExpressionTree tree in randomTrees) {
    8787        Util.InitTree(tree, twister, new List<string>(dataset.VariableNames));
     
    100100      grammar.MinimumFunctionArguments = 0;
    101101      grammar.MinimumFunctionDefinitions = 0;
    102       var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 1, 100, 0, 0);
     102      var randomTrees = Util.CreateRandomTrees(twister, dataset, grammar, N, 100);
    103103      foreach (SymbolicExpressionTree tree in randomTrees) {
    104104        Util.InitTree(tree, twister, new List<string>(dataset.VariableNames));
  • branches/3140_NumberSymbol/HeuristicLab.Tests/HeuristicLab.Problems.DataAnalysis.Symbolic.TimeSeriesPrognosis-3.4/Util.cs

    r17180 r18126  
    3535          varNode.Weight = twister.NextDouble() * 20.0 - 10.0;
    3636          varNode.VariableName = varNames[twister.Next(varNames.Count)];
    37         } else if (node is ConstantTreeNode) {
    38           var constantNode = node as ConstantTreeNode;
    39           constantNode.Value = twister.NextDouble() * 20.0 - 10.0;
     37        } else if (node is NumberTreeNode) {
     38          var numNode = node as NumberTreeNode;
     39          numNode.Value = twister.NextDouble() * 20.0 - 10.0;
    4040        }
    4141      }
     
    4444
    4545    public static ISymbolicExpressionTree[] CreateRandomTrees(MersenneTwister twister, Dataset dataset, ISymbolicExpressionGrammar grammar, int popSize) {
    46       return CreateRandomTrees(twister, dataset, grammar, popSize, 1, 200, 3, 3);
     46      return CreateRandomTrees(twister, dataset, grammar, popSize, 200);
    4747    }
    4848
    4949    public static ISymbolicExpressionTree[] CreateRandomTrees(MersenneTwister twister, Dataset dataset, ISymbolicExpressionGrammar grammar,
    50       int popSize, int minSize, int maxSize,
    51       int maxFunctionDefinitions, int maxFunctionArguments) {
     50      int popSize, int maxSize) {
    5251      foreach (Variable variableSymbol in grammar.Symbols.OfType<Variable>()) {
    5352        variableSymbol.VariableNames = dataset.VariableNames.Skip(1);
Note: See TracChangeset for help on using the changeset viewer.