Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/13/12 13:20:38 (12 years ago)
Author:
bburlacu
Message:

#1772: New analyzer: SymbolicExpressionTreeRelativeLengthAnalyzer. Rewrote the SymbolicExpressionTreeFragmentsAnalyzer, added generic wrapper to wrap HL objects as items.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomSelector.cs

    r7779 r7997  
    2121
    2222using System.Collections.Generic;
     23using System.Linq;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    6970
    7071      for (int i = 0; i < count; i++) {
    71         if (copy)
    72           selected[i] = (IScope)scopes[random.Next(scopes.Count)].Clone();
    73         else {
     72        if (copy) {
     73          int index = random.Next(scopes.Count);
     74          selected[i] = (IScope)scopes[index].Clone();
     75          // map the selected (cloned) tree to the original tree
     76          var original = scopes[index].Variables.First().Value;
     77          var clone = selected[i].Variables.First().Value;
     78          GlobalCloneMap.Add(clone, original);
     79        } else {
    7480          int index = random.Next(scopes.Count);
    7581          selected[i] = scopes[index];
Note: See TracChangeset for help on using the changeset viewer.