Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4848 for trunk


Ignore:
Timestamp:
11/19/10 11:23:37 (13 years ago)
Author:
gkronber
Message:

Reviewed classes HeatMap, HeatMapHistory, PopulationDiversityAnalyzer, DataTableHistory, !TSPPopulationDiversityAnalyzer and made minor changes. #1188

Location:
trunk/sources/HeuristicLab.Analysis/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis/3.3/HeatMap.cs

    r4739 r4848  
    3939      get { return title; }
    4040      set {
    41         if (!(title.Equals(value) || (value == null) && (title == string.Empty))) {
    42           title = value == null ? string.Empty : value;
     41        if (value == null) value = string.Empty;
     42        if (title != value) {
     43          title = value;
    4344          OnTitleChanged();
    4445        }
  • trunk/sources/HeuristicLab.Analysis/3.3/PopulationDiversityAnalyzer.cs

    r4777 r4848  
    7575      int updateInterval = UpdateIntervalParameter.Value.Value;
    7676      IntValue updateCounter = UpdateCounterParameter.ActualValue;
     77      // if counter does not yet exist then initialize it with update interval
     78      // to make sure the solutions are analyzed on the first application of this operator
    7779      if (updateCounter == null) {
    7880        updateCounter = new IntValue(updateInterval);
     
    8082      } else updateCounter.Value++;
    8183
     84      //analyze solutions only every 'updateInterval' times
    8285      if (updateCounter.Value == updateInterval) {
    8386        updateCounter.Value = 0;
     
    9396          T[] sortedSolutions = null;
    9497          if (max)
    95             sortedSolutions = solutions.Select((x, index) => new { Solution = x, Quality = qualities[index] }).OrderByDescending(x => x.Quality).Select(x => x.Solution).ToArray();
    96           else
    97             sortedSolutions = solutions.Select((x, index) => new { Solution = x, Quality = qualities[index] }).OrderBy(x => x.Quality).Select(x => x.Solution).ToArray();
     98            sortedSolutions = solutions
     99              .Select((x, index) => new { Solution = x, Quality = qualities[index] })
     100              .OrderByDescending(x => x.Quality)
     101              .Select(x => x.Solution)
     102              .ToArray();
     103          else
     104            sortedSolutions = solutions
     105              .Select((x, index) => new { Solution = x, Quality = qualities[index] })
     106              .OrderBy(x => x.Quality)
     107              .Select(x => x.Solution)
     108              .ToArray();
    98109
    99110          // calculate solution similarities
     
    102113          // calculate minimum, average and maximum similarities
    103114          double similarity;
    104           double[] minSimilarities = new double[sortedSolutions.Length];
    105           double[] avgSimilarities = new double[sortedSolutions.Length];
    106           double[] maxSimilarities = new double[sortedSolutions.Length];
     115          double[] minSimilarities = new double[count];
     116          double[] avgSimilarities = new double[count];
     117          double[] maxSimilarities = new double[count];
    107118          for (int i = 0; i < count; i++) {
    108119            minSimilarities[i] = 1;
Note: See TracChangeset for help on using the changeset viewer.