Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/08/12 14:04:17 (12 years ago)
Author:
mkommend
Message:

#1081: Intermediate commit of trunk updates - interpreter changes must be redone.

Location:
branches/HeuristicLab.TimeSeries
Files:
1 deleted
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.TimeSeries

    • Property svn:ignore
      •  

        old new  
        2020bin
        2121protoc.exe
         22_ReSharper.HeuristicLab.TimeSeries-3.3
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding

  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineCreater.cs

    r7268 r8430  
    139139      // the grammar in the newly defined function is a clone of the grammar of the originating branch
    140140      defunNode.SetGrammar((ISymbolicExpressionTreeGrammar)selectedBody.Grammar.Clone());
     141
     142      var allowedChildSymbols = selectedBody.Grammar.GetAllowedChildSymbols(selectedBody.Symbol);
     143      foreach (var allowedChildSymbol in allowedChildSymbols)
     144        defunNode.Grammar.AddAllowedChildSymbol(defunNode.Symbol, allowedChildSymbol);
     145      var maxSubtrees = selectedBody.Grammar.GetMaximumSubtreeCount(selectedBody.Symbol);
     146      for (int i = 0; i < maxSubtrees; i++) {
     147        foreach (var allowedChildSymbol in selectedBody.Grammar.GetAllowedChildSymbols(selectedBody.Symbol, i))
     148          defunNode.Grammar.AddAllowedChildSymbol(defunNode.Symbol, allowedChildSymbol);
     149      }
     150
    141151      // remove all argument symbols from grammar except that one contained in cutpoints
    142152      var oldArgumentSymbols = selectedBody.Grammar.Symbols.OfType<Argument>().ToList();
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/ArchitectureManipulators/SubroutineDuplicater.cs

    r7268 r8430  
    7373      symbolicExpressionTree.Root.AddSubtree(duplicatedDefunBranch);
    7474      duplicatedDefunBranch.SetGrammar((ISymbolicExpressionTreeGrammar)selectedBranch.Grammar.Clone());
     75
     76      var allowedChildSymbols = selectedBranch.Grammar.GetAllowedChildSymbols(selectedBranch.Symbol);
     77      foreach (var allowedChildSymbol in allowedChildSymbols)
     78        duplicatedDefunBranch.Grammar.AddAllowedChildSymbol(duplicatedDefunBranch.Symbol, allowedChildSymbol);
     79      var maxSubtrees = selectedBranch.Grammar.GetMaximumSubtreeCount(selectedBranch.Symbol);
     80      for (int i = 0; i < maxSubtrees; i++) {
     81        foreach (var allowedChildSymbol in selectedBranch.Grammar.GetAllowedChildSymbols(selectedBranch.Symbol, i))
     82          duplicatedDefunBranch.Grammar.AddAllowedChildSymbol(duplicatedDefunBranch.Symbol, allowedChildSymbol);
     83      }
     84
    7585      // add an invoke symbol for each branch that is allowed to invoke the original function
    7686      foreach (var subtree in symbolicExpressionTree.Root.Subtrees.OfType<SymbolicExpressionTreeTopLevelNode>()) {
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/FullTreeCreator.cs

    r7268 r8430  
    161161          .Where(s => seedNode.Grammar.IsAllowedChildSymbol(seedNode.Symbol, s, i))
    162162          .ToList();
    163         var selectedSymbol = possibleSymbols.SelectRandom(random);
     163        var weights = possibleSymbols.Select(s => s.InitialFrequency).ToList();
     164        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
    164165        var tree = selectedSymbol.CreateTreeNode();
    165166        if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
     
    192193        if (!possibleSymbols.Any())
    193194          throw new InvalidOperationException("No symbols are available for the tree.");
    194 
    195         var selectedSymbol = possibleSymbols.SelectRandom(random);
     195        var weights = possibleSymbols.Select(s => s.InitialFrequency).ToList();
     196        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
    196197        var tree = selectedSymbol.CreateTreeNode();
    197198        if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/GrowTreeCreator.cs

    r7268 r8430  
    160160          .Where(s => seedNode.Grammar.IsAllowedChildSymbol(seedNode.Symbol, s, i))
    161161          .ToList();
    162         var selectedSymbol = possibleSymbols.SelectRandom(random);
     162        var weights = possibleSymbols.Select(s => s.InitialFrequency).ToList();
     163        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
    163164        var tree = selectedSymbol.CreateTreeNode();
    164165        if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
     
    178179        throw new ArgumentException("Cannot grow node of arity zero. Expected a function node.");
    179180
    180       var allowedSymbols = root.Grammar.AllowedSymbols
    181         .Where(s => s.InitialFrequency > 0.0)
    182         .ToList();
     181      var allowedSymbols = root.Grammar.AllowedSymbols.Where(s => s.InitialFrequency > 0.0).ToList();
    183182
    184183      for (var i = 0; i < arity; i++) {
     
    187186            root.Grammar.GetMinimumExpressionDepth(s) - 1 <= maxDepth - currentDepth)
    188187          .ToList();
     188
    189189        if (!possibleSymbols.Any())
    190190          throw new InvalidOperationException("No symbols are available for the tree.");
    191         var selectedSymbol = possibleSymbols.SelectRandom(random);
     191        var weights = possibleSymbols.Select(s => s.InitialFrequency).ToList();
     192        var selectedSymbol = possibleSymbols.SelectRandom(weights, random);
    192193        var tree = selectedSymbol.CreateTreeNode();
    193194        if (tree.HasLocalParameters) tree.ResetLocalParameters(random);
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Creators/ProbabilisticTreeCreator.cs

    r7268 r8430  
    176176        extensionPoints.Add(x);
    177177      }
    178       long minExtensionPointsLength = extensionPoints.Select(x => x.MinimumExtensionLength).Sum();
    179       long maxExtensionPointsLength = extensionPoints.Select(x => x.MaximumExtensionLength).Sum();
     178      //necessary to use long data type as the extension point length could be int.MaxValue
     179      long minExtensionPointsLength = extensionPoints.Select(x => (long)x.MinimumExtensionLength).Sum();
     180      long maxExtensionPointsLength = extensionPoints.Select(x => (long)x.MaximumExtensionLength).Sum();
    180181
    181182      // while there are pending extension points and we have not reached the limit of adding new extension points
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Crossovers/SymbolicExpressionTreeCrossover.cs

    r7615 r8430  
    5959      Parameters.Add(new ScopeTreeLookupParameter<ISymbolicExpressionTree>(ParentsParameterName, "The parent symbolic expression trees which should be crossed."));
    6060      Parameters.Add(new LookupParameter<ISymbolicExpressionTree>(ChildParameterName, "The child symbolic expression tree resulting from the crossover."));
     61      ParentsParameter.ActualName = "SymbolicExpressionTree";
     62      ChildParameter.ActualName = "SymbolicExpressionTree";
    6163    }
    6264
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.csproj

    r7886 r8430  
    163163    <Compile Include="Manipulators\ChangeNodeTypeManipulation.cs" />
    164164    <Compile Include="Interfaces\Operators\ISymbolicExpressionTreeManipulator.cs" />
     165    <Compile Include="Manipulators\RemoveBranchManipulation.cs" />
    165166    <Compile Include="Manipulators\ReplaceBranchManipulation.cs" />
    166167    <Compile Include="Manipulators\FullTreeShaker.cs" />
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Manipulators/OnePointShaker.cs

    r7268 r8430  
    5757
    5858    protected override void Manipulate(IRandom random, ISymbolicExpressionTree tree) {
     59      OnePointShaker.Shake(random, tree, ShakingFactor);
     60    }
     61
     62    public static void Shake(IRandom random, ISymbolicExpressionTree tree, double shakingFactor) {
    5963      List<ISymbolicExpressionTreeNode> parametricNodes = new List<ISymbolicExpressionTreeNode>();
    6064      tree.Root.ForEachNodePostfix(n => {
     
    6367      if (parametricNodes.Count > 0) {
    6468        var selectedPoint = parametricNodes.SelectRandom(random);
    65         selectedPoint.ShakeLocalParameters(random, ShakingFactor);
     69        selectedPoint.ShakeLocalParameters(random, shakingFactor);
    6670      }
    6771    }
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Plugin.cs.frame

    r7268 r8430  
    2626
    2727namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    28   [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.2.$WCREV$")]
     28  [Plugin("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding","Provides operators and related classes for the symbolic expression tree encoding.", "3.4.3.$WCREV$")]
    2929  [PluginFile("HeuristicLab.Encodings.SymbolicExpressionTreeEncoding-3.4.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Analysis", "3.3")]
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/Properties/AssemblyInfo.cs.frame

    r7268 r8430  
    4545
    4646[assembly: AssemblyVersion("3.4.0.0")]
    47 [assembly: AssemblyFileVersion("3.4.2.$WCREV$")]
     47[assembly: AssemblyFileVersion("3.4.3.$WCREV$")]
  • branches/HeuristicLab.TimeSeries/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTree.cs

    r7842 r8430  
    2323using System.Collections.Generic;
    2424using System.Drawing;
     25using System.Linq;
    2526using HeuristicLab.Common;
    2627using HeuristicLab.Core;
     
    7778    public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesBreadth() {
    7879      if (root == null)
    79         return new SymbolicExpressionTreeNode[0];
     80        return Enumerable.Empty<SymbolicExpressionTreeNode>();
    8081      return root.IterateNodesBreadth();
    8182    }
     
    8384    public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPrefix() {
    8485      if (root == null)
    85         return new SymbolicExpressionTreeNode[0];
     86        return Enumerable.Empty<SymbolicExpressionTreeNode>();
    8687      return root.IterateNodesPrefix();
    8788    }
    8889    public IEnumerable<ISymbolicExpressionTreeNode> IterateNodesPostfix() {
    8990      if (root == null)
    90         return new SymbolicExpressionTreeNode[0];
     91        return Enumerable.Empty<SymbolicExpressionTreeNode>();
    9192      return root.IterateNodesPostfix();
    9293    }
Note: See TracChangeset for help on using the changeset viewer.