Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/25/08 13:11:27 (16 years ago)
Author:
gkronber
Message:

fixed #444 (TournamentSelector throws NullPointerException when all solutions of a group have quality of positive or negative infinity).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/CEDMA-Refactoring-Ticket419/HeuristicLab.Selection/TournamentSelector.cs

    r817 r1062  
    6767        if (source.SubScopes.Count < 1) throw new InvalidOperationException("No source scopes available to select.");
    6868
    69         double best = maximization ? double.MinValue : double.MaxValue;
    70         IScope selectedScope = null;
    71         for (int j = 0; j < groupSize; j++) {
     69        IScope selectedScope = source.SubScopes[random.Next(source.SubScopes.Count)];
     70        double best = selectedScope.GetVariableValue<DoubleData>(qualityInfo.FormalName, false).Data;
     71        for (int j = 1; j < groupSize; j++) {
    7272          IScope scope = source.SubScopes[random.Next(source.SubScopes.Count)];
    7373          double quality = scope.GetVariableValue<DoubleData>(qualityInfo.FormalName, false).Data;
Note: See TracChangeset for help on using the changeset viewer.