Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/13/19 22:56:49 (6 years ago)
Author:
abeham
Message:

#2521: Refactor Analyze method of encoding-specific problems, simplify Analyze of SO-TF

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2521_ProblemRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/PermutationProblem.cs

    r16948 r16950  
    6868    }
    6969
    70     public override void Analyze(Permutation[] individuals, double[] qualities, ResultCollection results, IRandom random) {
    71       base.Analyze(individuals, qualities, results, random);
    72       var orderedIndividuals = individuals.Zip(qualities, (i, q) => new { Individual = i, Quality = q }).OrderBy(z => z.Quality);
    73       var best = Maximization ? orderedIndividuals.Last().Individual : orderedIndividuals.First().Individual;
    74 
    75       results.AddOrUpdateResult("Best Solution", (IItem)best.Clone());
     70    public override void Analyze(Permutation[] permutations, double[] qualities, ResultCollection results, IRandom random) {
     71      base.Analyze(permutations, qualities, results, random);
     72      var best = GetBestSolution(permutations, qualities);
     73      results.AddOrUpdateResult("Best Solution", (IItem)best.Item1.Clone());
    7674    }
    7775
Note: See TracChangeset for help on using the changeset viewer.