Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8989 for trunk


Ignore:
Timestamp:
12/03/12 13:48:23 (11 years ago)
Author:
jkarder
Message:

#1890: refactored DuplicatesSelector and ProgressiveOffspringPreserver

Location:
trunk/sources/HeuristicLab.Algorithms.RAPGA/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.RAPGA/3.3/DuplicatesSelector.cs

    r8926 r8989  
    5959
    6060      var marks = new bool[scopes.Count];
    61       for (int i = 0; i < scopes.Count; i++) {
    62         for (int j = i + 1; j < scopes.Count; j++) {
    63           if (SimilarityCalculator.Equals(scopes[i], scopes[j])) marks[j] = true;
    64         }
    65       }
     61      for (int i = 0; i < scopes.Count; i++)
     62        for (int j = i + 1; j < scopes.Count; j++)
     63          marks[j] = SimilarityCalculator.Equals(scopes[i], scopes[j]);
     64
    6665
    6766      var selected = new IScope[marks.Count(x => x)];
  • trunk/sources/HeuristicLab.Algorithms.RAPGA/3.3/ProgressiveOffspringPreserver.cs

    r8622 r8989  
    105105          // as long as offspring is available and not enough offspring has been preserved
    106106          while (i < createdOffspring.Length && OffspringList.Count < MaximumPopulationSize.Value - Elites.Value) {
    107             if (similarityMatrix[i].Any(x => x == 1.0)) createdOffspring[i] = null; // discard duplicates
     107            if (similarityMatrix[i].Any(x => x.IsAlmost(1.0))) createdOffspring[i] = null; // discard duplicates
    108108            else OffspringList.Add(createdOffspring[i]);
    109109            i++;
Note: See TracChangeset for help on using the changeset viewer.