Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9944


Ignore:
Timestamp:
09/10/13 17:23:25 (11 years ago)
Author:
gkronber
Message:

#2021 made fix in the way how the breath-first linear representation of the tree is translated to the prefix representation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Interpreter/SymbolicDataAnalysisExpressionTreeLinearInterpreter.cs

    r9871 r9944  
    333333
    334334    private static LinearInstruction[] GetPrefixSequence(LinearInstruction[] code, int startIndex) {
     335      var s = new Stack<int>();
    335336      var list = new List<LinearInstruction>();
    336       int i = startIndex;
    337       while (i != code.Length) {
     337      s.Push(startIndex);
     338      while (s.Any()) {
     339        int i = s.Pop();
    338340        var instr = code[i];
     341        // push instructions in reverse execution order
     342        for (int j = instr.nArguments - 1; j >= 0; j--) s.Push(instr.childIndex + j);
    339343        list.Add(instr);
    340         i = instr.nArguments > 0 ? instr.childIndex : i + 1;
    341344      }
    342345      return list.ToArray();
Note: See TracChangeset for help on using the changeset viewer.