Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
09/10/13 15:56:35 (11 years ago)
Author:
bburlacu
Message:

#1772: Re-added tracking code (record copies of individuals in the GlobalCloneMap)

Location:
branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3
Files:
3 edited

Legend:

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

    r9456 r9943  
    104104          currentQuality += list[index];
    105105        }
    106         if (copy)
     106        if (copy) {
    107107          selected[i] = (IScope)scopes[index].Clone();
    108         else {
     108          var original = scopes[index].Variables.First().Value;
     109          var clone = selected[i].Variables.First().Value;
     110          GlobalCloneMap.Add(clone, original);
     111        } else {
    109112          selected[i] = scopes[index];
    110113          scopes.RemoveAt(index);
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/RandomSelector.cs

    r9456 r9943  
    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          var index = random.Next(scopes.Count);
     74          selected[i] = (IScope)scopes[index].Clone();
     75          var original = scopes[index].Variables.First().Value;
     76          var clone = selected[i].Variables.First().Value;
     77          GlobalCloneMap.Add(clone, original);
     78        } else {
    7479          int index = random.Next(scopes.Count);
    7580          selected[i] = scopes[index];
  • branches/HeuristicLab.EvolutionaryTracking/HeuristicLab.Selection/3.3/TournamentSelector.cs

    r9456 r9943  
    7979        }
    8080
    81         if (copy)
     81        if (copy) {
    8282          selected[i] = (IScope)scopes[best].Clone();
    83         else {
     83          var original = scopes[best].Variables.First().Value;
     84          var clone = selected[i].Variables.First().Value;
     85          GlobalCloneMap.Add(clone, original);
     86        } else {
    8487          selected[i] = scopes[best];
    8588          scopes.RemoveAt(best);
Note: See TracChangeset for help on using the changeset viewer.