Ignore:
Timestamp:
03/21/14 14:20:03 (6 years ago)
Author:
abeham
Message:

#2172:

  • Added hierarchy of parameters to enable this as a hidden parameter in OSGA, SASEGASA, Island-OSGA
    • New default value for Island-OSGA and SASEGASA is true (it will be set to false if loaded from an older file)
  • Changed visibility of some properties to public
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Selection/3.3/OffspringSelector.cs

    r10639 r10643  
    5757    }
    5858
    59     public FixedValueParameter<BoolValue> FillPopulationWithParentsParameter {
    60       get { return (FixedValueParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
     59    public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter {
     60      get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; }
    6161    }
    6262
     
    6464      get { return OffspringCreatorParameter.Value; }
    6565      set { OffspringCreatorParameter.Value = value; }
    66     }
    67 
    68     public bool FillPopulationWithParents {
    69       get { return FillPopulationWithParentsParameter.Value.Value; }
    70       set { FillPopulationWithParentsParameter.Value.Value = value; }
    7166    }
    7267
     
    7772      // BackwardsCompatibility3.3
    7873      #region Backwards compatible code, remove with 3.4
     74      if (Parameters.ContainsKey("FillPopulationWithParents") && Parameters["FillPopulationWithParents"] is FixedValueParameter<BoolValue>)
     75        Parameters.Remove("FillPopulationWithParents");
    7976      if (!Parameters.ContainsKey("FillPopulationWithParents"))
    80         Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individuals instead of lucky losers.", new BoolValue(false)));
     77        Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individuals instead of lucky losers."));
    8178      #endregion
    8279    }
     
    9693      Parameters.Add(new ScopeTreeLookupParameter<BoolValue>("SuccessfulOffspring", "True if the offspring was more successful than its parents.", 2));
    9794      Parameters.Add(new OperatorParameter("OffspringCreator", "The operator used to create new offspring."));
    98       Parameters.Add(new FixedValueParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individuals instead of lucky losers.", new BoolValue(false)));
     95      Parameters.Add(new ValueLookupParameter<BoolValue>("FillPopulationWithParents", "True if the population should be filled with parent individual or false if worse children should be used when the maximum selection pressure is exceeded."));
    9996    }
    10097
     
    10299      double maxSelPress = MaximumSelectionPressureParameter.ActualValue.Value;
    103100      double successRatio = SuccessRatioParameter.ActualValue.Value;
     101      bool fillPopulationWithParents = FillPopulationWithParentsParameter.ActualValue.Value;
    104102      IScope scope = ExecutionContext.Scope;
    105103      IScope parents = scope.SubScopes[0];
     
    153151        } else if (worseOffspringNeeded > 0 || tmpSelPress >= maxSelPress) {
    154152          IScope currentOffspring;
    155           if (!FillPopulationWithParents || worseOffspringNeeded > 0) {
     153          if (!fillPopulationWithParents || worseOffspringNeeded > 0) {
    156154            currentOffspring = offspring.SubScopes[i];
    157155            offspring.SubScopes.Remove(currentOffspring);
Note: See TracChangeset for help on using the changeset viewer.