Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/23/16 16:13:11 (7 years ago)
Author:
jkarder
Message:

#2524:

  • made sure that P3 results are updated after cancellation
  • fixed unit tests to also call Initialize
File:
1 edited

Legend:

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

    r14523 r14527  
    250250      // Loop until iteration limit reached or canceled.
    251251      while (ResultsIterations < MaximumIterations) {
    252         cancellationToken.ThrowIfCancellationRequested();
    253         double fitness = iterate();
    254 
    255         ResultsEvaluations = tracker.Evaluations;
    256         ResultsBestSolution = new BinaryVector(tracker.BestSolution);
    257         ResultsBestQuality = tracker.BestQuality;
    258         ResultsBestFoundOnEvaluation = tracker.BestFoundOnEvaluation;
    259         ResultsQualitiesBest.Values.Add(tracker.BestQuality);
    260         ResultsQualitiesIteration.Values.Add(fitness);
    261         ResultsLevels.Values.Add(pyramid.Count);
    262         ResultsSolutions.Values.Add(seen.Count);
    263 
    264         ResultsIterations++;
     252        double fitness = double.NaN;
     253
     254        try {
     255          fitness = iterate();
     256          ResultsIterations++;
     257          cancellationToken.ThrowIfCancellationRequested();
     258        } finally {
     259          ResultsEvaluations = tracker.Evaluations;
     260          ResultsBestSolution = new BinaryVector(tracker.BestSolution);
     261          ResultsBestQuality = tracker.BestQuality;
     262          ResultsBestFoundOnEvaluation = tracker.BestFoundOnEvaluation;
     263          ResultsQualitiesBest.Values.Add(tracker.BestQuality);
     264          ResultsQualitiesIteration.Values.Add(fitness);
     265          ResultsLevels.Values.Add(pyramid.Count);
     266          ResultsSolutions.Values.Add(seen.Count);
     267        }
    265268      }
    266269    }
Note: See TracChangeset for help on using the changeset viewer.