Changeset 12352


Ignore:
Timestamp:
04/28/15 17:14:39 (4 years ago)
Author:
ascheibe
Message:

#2267 improved offspring selector

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/OffspringSelectors/PopDivOffspringSelector.cs

    r12351 r12352  
    224224        if (takeWorseOffspring) {
    225225          IScope currentOffspring = offspring.SubScopes[i];
    226           offspring.SubScopes.Remove(currentOffspring);
    227           i--;
    228           population.Add(currentOffspring);
    229           worseOffspringNeeded--;
     226          Scope tmpScope = new Scope();
     227          tmpScope.SubScopes.AddRange(population);
     228          Scope tmpCurrentScope = new Scope();
     229          tmpCurrentScope.SubScopes.Add(currentOffspring);
     230          double curDiv = SimilarityCalculatorParameter.ActualValue.CalculateSolutionCrowdSimilarity(tmpCurrentScope, tmpScope)[0].Average();
     231          if (curDiv < avgPopDiv) {
     232            offspring.SubScopes.Remove(currentOffspring);
     233            i--;
     234            population.Add(currentOffspring);
     235            worseOffspringNeeded--;
     236          }
    230237        } else if (tmp.Value) {
    231238          IScope currentOffspring = offspring.SubScopes[i];
Note: See TracChangeset for help on using the changeset viewer.