Changeset 15006
- Timestamp:
- 05/31/17 12:10:09 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.GeneticAlgorithm/3.3/GeneticAlgorithm.cs
r14185 r15006 156 156 Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions.")); 157 157 Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05))); 158 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));158 Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 159 159 Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1))); 160 160 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", new BoolValue(false)) { Hidden = true }); … … 221 221 Parameters.Add(new FixedValueParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)", (BoolValue)new BoolValue(false).AsReadOnly()) { Hidden = true }); 222 222 } 223 var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>; 224 if (optionalMutatorParameter != null) { 225 Parameters.Remove(optionalMutatorParameter); 226 Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 227 foreach (var m in optionalMutatorParameter.ValidValues) 228 MutatorParameter.ValidValues.Add(m); 229 if (optionalMutatorParameter.Value == null) MutationProbability.Value = 0; // to guarantee that the old configuration results in the same behavior 230 else Mutator = optionalMutatorParameter.Value; 231 optionalMutatorParameter.ValidValues.Clear(); // to avoid dangling references to the old parameter its valid values are cleared 232 } 223 233 #endregion 224 234
Note: See TracChangeset
for help on using the changeset viewer.