Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13876


Ignore:
Timestamp:
06/06/16 19:37:20 (8 years ago)
Author:
bburlacu
Message:

#1772: SchemaCreator: Replace cutpoints with wildcards from the bottom up when generating schemas. Add temporary workaround to restore parent links in child nodes if they become corrupted.

Location:
branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SchemaDiversification
Files:
2 edited

Legend:

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

    r13625 r13876  
    241241                       let fragment = (IFragment<ISymbolicExpressionTreeNode>)arc.Data
    242242                       select fragment.Index1).Distinct().ToArray();
    243         Array.Sort(indices);
     243        var levels = indices.Select(x => schema.Root.GetBranchLevel(nodes[x])).ToArray();
     244        Array.Sort(levels, indices);
     245        // order nodes by their depth so that cutpoints are replaced with wildcards from the bottom up
    244246        var nodesToReplace = indices.Select(x => nodes[x]).ToList();
    245247        for (int i = nodesToReplace.Count - 1; i >= 0; --i) {
  • branches/HeuristicLab.EvolutionTracking/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Tracking/SchemaDiversification/UpdateQualityOperator.cs

    r13527 r13876  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    7676    public override IOperation Apply() {
    7777      var tree = SymbolicExpressionTreeParameter.ActualValue;
     78      FixParentLinks(tree);
    7879      var problemData = ProblemDataParameter.ActualValue;
    7980      var estimationLimits = EstimationLimitsParameter.ActualValue;
     
    123124      return base.Apply();
    124125    }
     126
     127    private static void FixParentLinks(ISymbolicExpressionTree tree) {
     128      foreach (var node in tree.IterateNodesPrefix().Where(x => x.SubtreeCount > 0)) {
     129        foreach (var s in node.Subtrees) {
     130          if (s.Parent != node)
     131            s.Parent = node;
     132        }
     133      }
     134    }
    125135  }
    126136}
Note: See TracChangeset for help on using the changeset viewer.