Changeset 11388


Ignore:
Timestamp:
09/23/14 17:16:28 (8 years ago)
Author:
bburlacu
Message:

#1772: SymbolicDataAnalysisExpressionTracing: added more detailed comments; enforced a safer behaviour in the case of mutation when the traced subtree is contained inside the mutated tree fragment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SymbolicDataAnalysisExpressionTracing.cs

    r11350 r11388  
    6464
    6565        if (fragment == null) {
    66           // fragment == null can only mean that the individual is the previous generation elite
    67           // which got introduced in the next generation. skip elite, go up the graph to original individual
     66          // the fragment can be null for two reasons:
     67          // 1) the individual is an elite
     68          // 2) the crossover/mutation made no changes to the root parent (or there is a bug in fragment identification)
     69          if (index >= parents[0].Data.Length) {
     70            throw new InvalidOperationException("Index exceeds tree length.");
     71          }
    6872          node = parents[0];
    6973          continue;
     
    9296          } else if (fragment.Index1 < subtreeIndex) {
    9397            if (subtreeIndex < fragment.Index1 + fragmentLength) {
    94               // subtree contained in fragment, index stays the same
     98              // in the case of mutation, the fragment could have been introduced via a node replacement
     99              // there is no guarantee the subtree exists above this level, therefore the index is set to the fragment index
     100              index = fragment.Index1;
    95101            } else {
     102              // subtree outside of fragment
    96103              index += node.Data.NodeAt(fragment.Index1).GetLength() - fragmentLength;
    97104            }
     
    106113
    107114          yield return fragmentNode;
    108           var up = Trace(node, index, fragmentNode);
     115          var up = Trace(node, index, fragmentNode); // force immediate query execution
    109116          foreach (var v in up) { yield return v; }
    110117          break;
Note: See TracChangeset for help on using the changeset viewer.