Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/20/17 11:39:53 (7 years ago)
Author:
pkimmesw
Message:

#2665 Added PlushEncoding, ZeroErrorDistributionAnalzer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Selector/LexicaseSelector.cs

    r15189 r15275  
    3737  /// <summary>
    3838  /// A lexicase selection operator which considers all successful evaluated training cases for selection.
    39   ///
    40   /// ToDo: LexicaseSelector and ICaseSingleObjectiveSelector are ISingleObjectiveOperator, which contains Maximization and Qualities which is not needed
    4139  /// </summary>
    4240  [Item("LexicaseSelector", "A lexicase selection operator which considers all successful evaluated training cases for selection.")]
     
    4543    public ILookupParameter<ItemArray<DoubleArray>> CaseQualitiesParameter
    4644    {
    47       get { return (ILookupParameter<ItemArray<DoubleArray>>)Parameters[PushProblem.CaseQualitiesScopeParameterName]; }
     45      get { return (ILookupParameter<ItemArray<DoubleArray>>)Parameters[IntegerVectorPushProblem.CaseQualitiesScopeParameterName]; }
    4846    }
    4947
     
    5755    public LexicaseSelector() {
    5856      Parameters.Add(new ScopeTreeLookupParameter<DoubleArray>(
    59         PushProblem.CaseQualitiesScopeParameterName,
     57        IntegerVectorPushProblem.CaseQualitiesScopeParameterName,
    6058        "The quality of every single training case for each individual."));
    6159    }
     
    6866      var selected = new IScope[count];
    6967      var caseQualities = CaseQualitiesParameter.ActualValue;
    70       var repeats = Math.Ceiling(count / (double)population.Count);
     68      var repeats = (int)Math.Ceiling(count / (double)population.Count);
    7169      var caseCount = caseQualities[0].Length;
    7270      var source = Enumerable.Range(0, population.Count).ToList();
     
    7775
    7876        // copy list if required
    79         var pool = k == repeats - 1 ? source : new List<int>(source);
     77        var pool = repeats == 1 ? source : new List<int>(source);
    8078        var countLimit = Math.Min(count - k * population.Count, population.Count);
    8179
    8280        for (var i = 0; i < countLimit; i++) {
    83           var bestIndividuals = pool;
     81          var candidates = pool;
    8482
    85           for (var j = 0; j < fitnessCaseIndexes.Count && bestIndividuals.Count > 1; j++)
    86             bestIndividuals = GetBestIndividuals(maximization, caseQualities, bestIndividuals, fitnessCaseIndexes[j]);
     83          for (var j = 0; j < fitnessCaseIndexes.Count && candidates.Count > 1; j++) {
     84            candidates = GetBestIndividuals(maximization, caseQualities, candidates, fitnessCaseIndexes[j]);
     85          }
    8786
    8887          /*  If only one individual remains, it is the chosen parent. If no more fitness cases are left, a parent is
    8988              chosen randomly from the remaining individuals */
    90           var bestIndividualIndex = bestIndividuals.Count == 1 ? bestIndividuals[0] : bestIndividuals.Random(random);
     89          var bestIndividualIndex = candidates.Count == 1 ? candidates[0] : candidates.Random(random);
    9190          var bestIndividual = population[bestIndividualIndex];
    9291
Note: See TracChangeset for help on using the changeset viewer.