Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/13/15 12:57:28 (10 years ago)
Author:
mkommend
Message:

#2174: Adapted script template for programmable problem (single-objective).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Programmable/3.3/Templates/CompiledSingleObjectiveProblemDefinition.cs

    r11949 r12001  
    4444      // Write or update results given the range of vectors and resulting qualities
    4545      // Uncomment the following lines if you want to retrieve the best individual
    46       //var bestIndex = Maximization ?
    47       //         qualities.Select((v, i) => Tuple.Create(i, v)).OrderByDescending(x => x.Item2).First().Item1
    48       //       : qualities.Select((v, i) => Tuple.Create(i, v)).OrderBy(x => x.Item2).First().Item1;
    49       //var best = individuals[bestIndex];
     46
     47      //var orderedIndividuals = individuals.Zip(qualities, (i, q) => new { Individual = i, Quality = q }).OrderBy(z => z.Quality);
     48      //var best = Maximization ? orderedIndividuals.Last().Individual : orderedIndividuals.First().Individual;
     49
     50      //if (!results.ContainsKey("Best Solution")) {
     51      //  results.Add(new Result("Best Solution", typeof(RealVector)));
     52      //}
     53      //results["Best Solution"].Value = (IItem)best.RealVector("r").Clone();
    5054    }
    5155
Note: See TracChangeset for help on using the changeset viewer.