Free cookie consent management tool by TermsFeed Policy Generator

Changeset 11824 for branches


Ignore:
Timestamp:
01/26/15 16:15:11 (10 years ago)
Author:
ascheibe
Message:

#2267 added switch to turn off diversity as selection criteria but still generate the analysis chart

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/VOSGA/HeuristicLab.Algorithms.VOffspringSelectionGeneticAlgorithm/WeightedParentsDiversityComparator.cs

    r11796 r11824  
    7171    public ILookupParameter<IntValue> GenerationsParameter {
    7272      get { return (LookupParameter<IntValue>)Parameters["Generations"]; }
     73    }
     74    public ValueParameter<BoolValue> EnableDivCriteriaParameter {
     75      get { return (ValueParameter<BoolValue>)Parameters["EnableDivCriteria"]; }
    7376    }
    7477
     
    114117      Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the population diversity analysis results should be stored."));
    115118      Parameters.Add(new LookupParameter<IntValue>("Generations", "The current number of generations."));
     119      Parameters.Add(new ValueParameter<BoolValue>("EnableDivCriteria", "Use diversity as additional offspring selection criteria.", new BoolValue(true)));
    116120
    117121      foreach (IDiscreteDoubleValueModifier modifier in ApplicationManager.Manager.GetInstances<IDiscreteDoubleValueModifier>().OrderBy(x => x.Name))
     
    132136      if (!Parameters.ContainsKey("Results"))
    133137        Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the population diversity analysis results should be stored."));
     138      if (!Parameters.ContainsKey("EnableDivCriteria"))
     139        Parameters.Add(new ValueParameter<BoolValue>("EnableDivCriteria", "Use diversity as additional offspring selection criteria.", new BoolValue(true)));
    134140    }
    135141
     
    203209      bool result = maximization && leftQuality > threshold || !maximization && leftQuality < threshold;
    204210
     211      //collect statistics
    205212      if (result) {
    206213        qualityCount++;
    207214      }
    208 
    209       result = result && resultDiversity;
    210 
    211215      if (resultDiversity) {
    212216        divCount++;
    213217      }
    214       if (result) {
     218      if (result && resultDiversity) {
    215219        successCount++;
    216220      }
    217221      overallCount++;
     222
     223      //use diveristiy criteria or not
     224      if (EnableDivCriteriaParameter.Value.Value) {
     225        result = result && resultDiversity;
     226      }
    218227
    219228      BoolValue resultValue = ResultParameter.ActualValue;
Note: See TracChangeset for help on using the changeset viewer.