Changeset 15973 for branches/2522_RefactorPluginInfrastructure/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs
- Timestamp:
- 06/28/18 11:13:37 (6 years ago)
- Location:
- branches/2522_RefactorPluginInfrastructure
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2522_RefactorPluginInfrastructure
- Property svn:ignore
-
old new 24 24 protoc.exe 25 25 obj 26 .vs
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/2522_RefactorPluginInfrastructure/HeuristicLab.Algorithms.OffspringSelectionGeneticAlgorithm/3.3/IslandOffspringSelectionGeneticAlgorithm.cs
r13173 r15973 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 280 280 if (!Parameters.ContainsKey("FillPopulationWithParents")) 281 281 Parameters.Add(new FixedValueParameter<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.", new BoolValue(false)) { Hidden = true }); 282 283 var optionalMutatorParameter = MutatorParameter as OptionalConstrainedValueParameter<IManipulator>; 284 if (optionalMutatorParameter != null) { 285 Parameters.Remove(optionalMutatorParameter); 286 Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 287 foreach (var m in optionalMutatorParameter.ValidValues) 288 MutatorParameter.ValidValues.Add(m); 289 if (optionalMutatorParameter.Value == null) MutationProbability.Value = 0; // to guarantee that the old configuration results in the same behavior 290 else Mutator = optionalMutatorParameter.Value; 291 optionalMutatorParameter.ValidValues.Clear(); // to avoid dangling references to the old parameter its valid values are cleared 292 } 282 293 #endregion 283 294 … … 311 322 Parameters.Add(new ConstrainedValueParameter<ICrossover>("Crossover", "The operator used to cross solutions.")); 312 323 Parameters.Add(new ValueParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.", new PercentValue(0.05))); 313 Parameters.Add(new OptionalConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions."));324 Parameters.Add(new ConstrainedValueParameter<IManipulator>("Mutator", "The operator used to mutate solutions.")); 314 325 Parameters.Add(new ValueParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.", new IntValue(1))); 315 326 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 }); … … 642 653 IManipulator oldMutator = MutatorParameter.Value; 643 654 MutatorParameter.ValidValues.Clear(); 655 IManipulator defaultMutator = Problem.Operators.OfType<IManipulator>().FirstOrDefault(); 656 644 657 foreach (IManipulator mutator in Problem.Operators.OfType<IManipulator>().OrderBy(x => x.Name)) 645 658 MutatorParameter.ValidValues.Add(mutator); 659 646 660 if (oldMutator != null) { 647 661 IManipulator mutator = MutatorParameter.ValidValues.FirstOrDefault(x => x.GetType() == oldMutator.GetType()); 648 662 if (mutator != null) MutatorParameter.Value = mutator; 649 } 663 else oldMutator = null; 664 } 665 666 if (oldMutator == null && defaultMutator != null) 667 MutatorParameter.Value = defaultMutator; 650 668 } 651 669 private void UpdateAnalyzers() {
Note: See TracChangeset
for help on using the changeset viewer.