Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/02/14 18:28:44 (10 years ago)
Author:
gkronber
Message:

#2171: minor changes while reviewing the source code for the parameter optimization problem plugin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.ParameterOptimization/3.3/BestSolutionAnalyzer.cs

    r11019 r11077  
    9595      DoubleValue bestKnownQuality = BestKnownQualityParameter.ActualValue;
    9696
    97       int ind = -1;
    98       if (!max) ind = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
    99       else ind = qualities.Select((x, index) => new { index, x.Value }).OrderByDescending(x => x.Value).First().index;
     97      int indexOfBest = -1;
     98      if (!max) indexOfBest = qualities.Select((x, index) => new { index, x.Value }).OrderBy(x => x.Value).First().index;
     99      else indexOfBest = qualities.Select((x, index) => new { index, x.Value }).OrderByDescending(x => x.Value).First().index;
    100100
    101       var bestQuality = qualities[ind].Value;
    102       var bestParameterVector = (RealVector)parameterVectors[ind].Clone();
     101      var bestQuality = qualities[indexOfBest].Value;
     102      var bestParameterVector = (RealVector)parameterVectors[indexOfBest].Clone();
    103103      ResultCollection results = ResultsParameter.ActualValue;
    104104
     
    123123
    124124      //update best known quality
    125       if (bestKnownQuality == null || max && bestQuality > bestKnownQuality.Value
     125      if (bestKnownQuality == null
     126        || max && bestQuality > bestKnownQuality.Value
    126127        || !max && bestQuality < bestKnownQuality.Value) {
    127128        BestKnownQualityParameter.ActualValue = new DoubleValue(bestQuality);
Note: See TracChangeset for help on using the changeset viewer.