Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/21/11 15:51:43 (13 years ago)
Author:
mkommend
Message:

#1479: Adapted symbolic expression encoding unit tests.

Location:
trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Grammars.cs

    r6803 r6814  
    2121
    2222using System.Collections.Generic;
     23using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2526using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     27using HeuristicLab.Problems.DataAnalysis.Symbolic;
    2628
    2729namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding_3._4.Tests {
     
    212214
    213215    public static ISymbolicExpressionGrammar CreateSimpleArithmeticGrammar() {
    214       var g = new SimpleArithmeticGrammar();
     216      var g = new TypeCoherentExpressionGrammar();
     217      g.ConfigureAsDefaultRegressionGrammar();
     218      g.Symbols.OfType<Variable>().First().Enabled = false;
     219      //var g = new SimpleArithmeticGrammar();
    215220      g.MaximumFunctionArguments = 0;
    216221      g.MinimumFunctionArguments = 0;
     
    221226
    222227    public static ISymbolicExpressionGrammar CreateArithmeticAndAdfGrammar() {
    223       var g = new SimpleArithmeticGrammar();
     228      var g = new TypeCoherentExpressionGrammar();
     229      g.ConfigureAsDefaultRegressionGrammar();
     230      g.Symbols.OfType<Variable>().First().Enabled = false;
    224231      g.MaximumFunctionArguments = 3;
    225232      g.MinimumFunctionArguments = 0;
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.Tests.csproj

    r5809 r6814  
    149149      <Name>HeuristicLab.PluginInfrastructure-3.3</Name>
    150150    </ProjectReference>
     151    <ProjectReference Include="..\..\..\HeuristicLab.Problems.DataAnalysis.Symbolic\3.4\HeuristicLab.Problems.DataAnalysis.Symbolic-3.4.csproj">
     152      <Project>{3D28463F-EC96-4D82-AFEE-38BE91A0CA00}</Project>
     153      <Name>HeuristicLab.Problems.DataAnalysis.Symbolic-3.4</Name>
     154    </ProjectReference>
    151155    <ProjectReference Include="..\..\..\HeuristicLab.Random\3.3\HeuristicLab.Random-3.3.csproj">
    152156      <Project>{F4539FB6-4708-40C9-BE64-0A1390AEA197}</Project>
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/ProbabilisticTreeCreaterTest.cs

    r5809 r6814  
    7272        Util.GetTerminalDistributionString(randomTrees) + Environment.NewLine
    7373        );
    74       Assert.IsTrue(Math.Round(1000.0 / (msPerRandomTreeCreation)) > 500); // must achieve more than 500 random trees / s
     74      Assert.IsTrue(Math.Round(1000.0 / (msPerRandomTreeCreation)) > 300); // must achieve more than 500 random trees / s
    7575    }
    7676  }
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Tests/Util.cs

    r6803 r6814  
    153153    public static void IsValid(ISymbolicExpressionTreeGrammar grammar) {
    154154      Assert.IsTrue(grammar.Symbols.Count() == grammar.Symbols.Distinct().Count());
    155       foreach (ISymbol symbol in grammar.Symbols) {
     155      foreach (ISymbol symbol in grammar.AllowedSymbols) {
    156156        Assert.IsTrue(grammar.GetMinimumSubtreeCount(symbol) <= grammar.GetMaximumExpressionLength(symbol));
    157157        Assert.IsTrue(grammar.GetAllowedChildSymbols(symbol).Count() == grammar.GetAllowedChildSymbols(symbol).Distinct().Count());
Note: See TracChangeset for help on using the changeset viewer.