Changeset 13402 for trunk/sources/HeuristicLab.Algorithms.ALPS/3.3/AlpsOffspringSelectionGeneticAlgorithmMainOperator.cs
- Timestamp:
- 11/25/15 17:50:52 (8 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Algorithms.ALPS/3.3/AlpsOffspringSelectionGeneticAlgorithmMainOperator.cs
r13326 r13402 29 29 using HeuristicLab.Selection; 30 30 31 namespace HeuristicLab.Algorithms. OffspringSelectionGeneticAlgorithm{31 namespace HeuristicLab.Algorithms.ALPS { 32 32 /// <summary> 33 33 /// An operator which represents the main loop of an offspring selection genetic algorithm. 34 34 /// </summary> 35 [Item(" OffspringSelectionGeneticAlgorithmMainOperator", "An operator that represents the core of anoffspring selection genetic algorithm.")]35 [Item("AlpsOffspringSelectionGeneticAlgorithmMainOperator", "An operator that represents the core of an alps offspring selection genetic algorithm.")] 36 36 [StorableClass] 37 public sealed class OffspringSelectionGeneticAlgorithmMainOperator : AlgorithmOperator {37 public sealed class AlpsOffspringSelectionGeneticAlgorithmMainOperator : AlgorithmOperator { 38 38 #region Parameter properties 39 public ValueLookupParameter<IRandom> RandomParameter { 40 get { return (ValueLookupParameter<IRandom>)Parameters["Random"]; } 41 } 42 public ValueLookupParameter<BoolValue> MaximizationParameter { 43 get { return (ValueLookupParameter<BoolValue>)Parameters["Maximization"]; } 44 } 45 public ScopeTreeLookupParameter<DoubleValue> QualityParameter { 46 get { return (ScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 47 } 48 public ValueLookupParameter<IOperator> SelectorParameter { 49 get { return (ValueLookupParameter<IOperator>)Parameters["Selector"]; } 50 } 51 public ValueLookupParameter<IOperator> CrossoverParameter { 52 get { return (ValueLookupParameter<IOperator>)Parameters["Crossover"]; } 53 } 54 public ValueLookupParameter<PercentValue> MutationProbabilityParameter { 55 get { return (ValueLookupParameter<PercentValue>)Parameters["MutationProbability"]; } 56 } 57 public ValueLookupParameter<IOperator> MutatorParameter { 58 get { return (ValueLookupParameter<IOperator>)Parameters["Mutator"]; } 59 } 60 public ValueLookupParameter<IOperator> EvaluatorParameter { 61 get { return (ValueLookupParameter<IOperator>)Parameters["Evaluator"]; } 62 } 63 public LookupParameter<IntValue> EvaluatedSolutionsParameter { 64 get { return (LookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 65 } 66 public ValueLookupParameter<IntValue> ElitesParameter { 67 get { return (ValueLookupParameter<IntValue>)Parameters["Elites"]; } 39 public IValueLookupParameter<IRandom> RandomParameter { 40 get { return (IValueLookupParameter<IRandom>)Parameters["Random"]; } 41 } 42 public IValueLookupParameter<IOperator> EvaluatorParameter { 43 get { return (IValueLookupParameter<IOperator>)Parameters["Evaluator"]; } 44 } 45 public ILookupParameter<IntValue> EvaluatedSolutionsParameter { 46 get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 47 } 48 public IScopeTreeLookupParameter<DoubleValue> QualityParameter { 49 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Quality"]; } 50 } 51 public IValueLookupParameter<BoolValue> MaximizationParameter { 52 get { return (IValueLookupParameter<BoolValue>)Parameters["Maximization"]; } 53 } 54 55 public ILookupParameter<IntValue> PopulationSizeParameter { 56 get { return (ILookupParameter<IntValue>)Parameters["PopulationSize"]; } 57 } 58 59 public IValueLookupParameter<IOperator> SelectorParameter { 60 get { return (IValueLookupParameter<IOperator>)Parameters["Selector"]; } 61 } 62 public IValueLookupParameter<IOperator> CrossoverParameter { 63 get { return (IValueLookupParameter<IOperator>)Parameters["Crossover"]; } 64 } 65 public IValueLookupParameter<IOperator> MutatorParameter { 66 get { return (IValueLookupParameter<IOperator>)Parameters["Mutator"]; } 67 } 68 public IValueLookupParameter<PercentValue> MutationProbabilityParameter { 69 get { return (IValueLookupParameter<PercentValue>)Parameters["MutationProbability"]; } 70 } 71 public IValueLookupParameter<IntValue> ElitesParameter { 72 get { return (IValueLookupParameter<IntValue>)Parameters["Elites"]; } 68 73 } 69 74 public IValueLookupParameter<BoolValue> ReevaluateElitesParameter { 70 75 get { return (IValueLookupParameter<BoolValue>)Parameters["ReevaluateElites"]; } 71 76 } 72 public LookupParameter<DoubleValue> ComparisonFactorParameter { 73 get { return (LookupParameter<DoubleValue>)Parameters["ComparisonFactor"]; } 74 } 75 public LookupParameter<DoubleValue> CurrentSuccessRatioParameter { 76 get { return (LookupParameter<DoubleValue>)Parameters["CurrentSuccessRatio"]; } 77 } 78 public ValueLookupParameter<DoubleValue> SuccessRatioParameter { 79 get { return (ValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; } 80 } 81 public LookupParameter<DoubleValue> SelectionPressureParameter { 82 get { return (LookupParameter<DoubleValue>)Parameters["SelectionPressure"]; } 83 } 84 public ValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter { 85 get { return (ValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; } 86 } 87 public ValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter { 88 get { return (ValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; } 77 78 public ILookupParameter<DoubleValue> ComparisonFactorParameter { 79 get { return (ILookupParameter<DoubleValue>)Parameters["ComparisonFactor"]; } 80 } 81 public ILookupParameter<DoubleValue> CurrentSuccessRatioParameter { 82 get { return (ILookupParameter<DoubleValue>)Parameters["CurrentSuccessRatio"]; } 83 } 84 public IValueLookupParameter<DoubleValue> SuccessRatioParameter { 85 get { return (IValueLookupParameter<DoubleValue>)Parameters["SuccessRatio"]; } 86 } 87 public ILookupParameter<DoubleValue> SelectionPressureParameter { 88 get { return (ILookupParameter<DoubleValue>)Parameters["SelectionPressure"]; } 89 } 90 public IValueLookupParameter<DoubleValue> MaximumSelectionPressureParameter { 91 get { return (IValueLookupParameter<DoubleValue>)Parameters["MaximumSelectionPressure"]; } 92 } 93 public IValueLookupParameter<BoolValue> OffspringSelectionBeforeMutationParameter { 94 get { return (IValueLookupParameter<BoolValue>)Parameters["OffspringSelectionBeforeMutation"]; } 89 95 } 90 96 public IValueLookupParameter<BoolValue> FillPopulationWithParentsParameter { 91 97 get { return (IValueLookupParameter<BoolValue>)Parameters["FillPopulationWithParents"]; } 92 98 } 99 100 public IScopeTreeLookupParameter<DoubleValue> AgeParameter { 101 get { return (IScopeTreeLookupParameter<DoubleValue>)Parameters["Age"]; } 102 } 103 public IValueLookupParameter<DoubleValue> AgeInheritanceParameter { 104 get { return (IValueLookupParameter<DoubleValue>)Parameters["AgeInheritance"]; } 105 } 106 public IValueLookupParameter<DoubleValue> AgeIncrementParameter { 107 get { return (IValueLookupParameter<DoubleValue>)Parameters["AgeIncrement"]; } 108 } 93 109 #endregion 94 110 95 111 [StorableConstructor] 96 private OffspringSelectionGeneticAlgorithmMainOperator(bool deserializing) : base(deserializing) { }97 private OffspringSelectionGeneticAlgorithmMainOperator(OffspringSelectionGeneticAlgorithmMainOperator original, Cloner cloner)112 private AlpsOffspringSelectionGeneticAlgorithmMainOperator(bool deserializing) : base(deserializing) { } 113 private AlpsOffspringSelectionGeneticAlgorithmMainOperator(AlpsOffspringSelectionGeneticAlgorithmMainOperator original, Cloner cloner) 98 114 : base(original, cloner) { 99 115 } 100 116 public override IDeepCloneable Clone(Cloner cloner) { 101 return new OffspringSelectionGeneticAlgorithmMainOperator(this, cloner);102 } 103 public OffspringSelectionGeneticAlgorithmMainOperator()117 return new AlpsOffspringSelectionGeneticAlgorithmMainOperator(this, cloner); 118 } 119 public AlpsOffspringSelectionGeneticAlgorithmMainOperator() 104 120 : base() { 105 121 Initialize(); 106 122 } 107 123 108 [StorableHook(HookType.AfterDeserialization)]109 private void AfterDeserialization() {110 // BackwardsCompatibility3.3111 #region Backwards compatible code, remove with 3.4112 if (!Parameters.ContainsKey("ReevaluateElites")) {113 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)"));114 }115 if (!Parameters.ContainsKey("FillPopulationWithParents"))116 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."));117 #endregion118 }119 120 124 private void Initialize() { 121 #region Create parameters122 125 Parameters.Add(new ValueLookupParameter<IRandom>("Random", "A pseudo random number generator.")); 126 127 Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization.")); 128 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions.")); 129 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution.")); 123 130 Parameters.Add(new ValueLookupParameter<BoolValue>("Maximization", "True if the problem is a maximization problem, otherwise false.")); 124 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Quality", "The value which represents the quality of a solution.")); 131 132 Parameters.Add(new ValueLookupParameter<IntValue>("PopulationSize", "The size of the population of solutions in each layer.")); 125 133 Parameters.Add(new ValueLookupParameter<IOperator>("Selector", "The operator used to select solutions for reproduction.")); 126 134 Parameters.Add(new ValueLookupParameter<IOperator>("Crossover", "The operator used to cross solutions.")); 135 Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions.")); 127 136 Parameters.Add(new ValueLookupParameter<PercentValue>("MutationProbability", "The probability that the mutation operator is applied on a solution.")); 128 Parameters.Add(new ValueLookupParameter<IOperator>("Mutator", "The operator used to mutate solutions."));129 Parameters.Add(new ValueLookupParameter<IOperator>("Evaluator", "The operator used to evaluate solutions. This operator is executed in parallel, if an engine is used which supports parallelization."));130 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions."));131 137 Parameters.Add(new ValueLookupParameter<IntValue>("Elites", "The numer of elite solutions which are kept in each generation.")); 132 138 Parameters.Add(new ValueLookupParameter<BoolValue>("ReevaluateElites", "Flag to determine if elite individuals should be reevaluated (i.e., if stochastic fitness functions are used.)")); 139 133 140 Parameters.Add(new LookupParameter<DoubleValue>("ComparisonFactor", "The comparison factor is used to determine whether the offspring should be compared to the better parent, the worse parent or a quality value linearly interpolated between them. It is in the range [0;1].")); 134 141 Parameters.Add(new LookupParameter<DoubleValue>("CurrentSuccessRatio", "The current success ratio.")); … … 138 145 Parameters.Add(new ValueLookupParameter<BoolValue>("OffspringSelectionBeforeMutation", "True if the offspring selection step should be applied before mutation, false if it should be applied after mutation.")); 139 146 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.")); 140 #endregion 141 142 #region Create operators 143 Placeholder selector = new Placeholder(); 144 SubScopesProcessor subScopesProcessor1 = new SubScopesProcessor(); 145 ChildrenCreator childrenCreator = new ChildrenCreator(); 146 ConditionalBranch osBeforeMutationBranch = new ConditionalBranch(); 147 UniformSubScopesProcessor uniformSubScopesProcessor1 = new UniformSubScopesProcessor(); 148 Placeholder crossover1 = new Placeholder(); 149 UniformSubScopesProcessor uniformSubScopesProcessor2 = new UniformSubScopesProcessor(); 150 Placeholder evaluator1 = new Placeholder(); 151 SubScopesCounter subScopesCounter1 = new SubScopesCounter(); 152 WeightedParentsQualityComparator qualityComparer1 = new WeightedParentsQualityComparator(); 153 SubScopesRemover subScopesRemover1 = new SubScopesRemover(); 154 UniformSubScopesProcessor uniformSubScopesProcessor3 = new UniformSubScopesProcessor(); 155 StochasticBranch mutationBranch1 = new StochasticBranch(); 156 Placeholder mutator1 = new Placeholder(); 157 VariableCreator variableCreator1 = new VariableCreator(); 158 VariableCreator variableCreator2 = new VariableCreator(); 159 ConditionalSelector conditionalSelector = new ConditionalSelector(); 160 SubScopesProcessor subScopesProcessor2 = new SubScopesProcessor(); 161 UniformSubScopesProcessor uniformSubScopesProcessor4 = new UniformSubScopesProcessor(); 162 Placeholder evaluator2 = new Placeholder(); 163 SubScopesCounter subScopesCounter2 = new SubScopesCounter(); 164 MergingReducer mergingReducer1 = new MergingReducer(); 165 UniformSubScopesProcessor uniformSubScopesProcessor5 = new UniformSubScopesProcessor(); 166 Placeholder crossover2 = new Placeholder(); 167 StochasticBranch mutationBranch2 = new StochasticBranch(); 168 Placeholder mutator2 = new Placeholder(); 169 UniformSubScopesProcessor uniformSubScopesProcessor6 = new UniformSubScopesProcessor(); 170 Placeholder evaluator3 = new Placeholder(); 171 SubScopesCounter subScopesCounter3 = new SubScopesCounter(); 172 WeightedParentsQualityComparator qualityComparer2 = new WeightedParentsQualityComparator(); 173 SubScopesRemover subScopesRemover2 = new SubScopesRemover(); 174 OffspringSelector offspringSelector = new OffspringSelector(); 175 SubScopesProcessor subScopesProcessor3 = new SubScopesProcessor(); 176 BestSelector bestSelector = new BestSelector(); 177 WorstSelector worstSelector = new WorstSelector(); 178 RightReducer rightReducer = new RightReducer(); 179 LeftReducer leftReducer = new LeftReducer(); 180 MergingReducer mergingReducer2 = new MergingReducer(); 181 ConditionalBranch reevaluateElitesBranch = new ConditionalBranch(); 182 UniformSubScopesProcessor uniformSubScopesProcessor7 = new UniformSubScopesProcessor(); 183 Placeholder evaluator4 = new Placeholder(); 184 SubScopesCounter subScopesCounter4 = new SubScopesCounter(); 147 148 Parameters.Add(new ScopeTreeLookupParameter<DoubleValue>("Age", "The age of individuals.")); 149 Parameters.Add(new ValueLookupParameter<DoubleValue>("AgeInheritance", "A weight that determines the age of a child after crossover based on the older (1.0) and younger (0.0) parent.")); 150 Parameters.Add(new ValueLookupParameter<DoubleValue>("AgeIncrement", "The value the age the individuals is incremented if they survives a generation.")); 151 152 153 var selector = new Placeholder(); 154 var subScopesProcessor1 = new SubScopesProcessor(); 155 var childrenCreator = new ChildrenCreator(); 156 var osBeforeMutationBranch = new ConditionalBranch(); 157 var uniformSubScopesProcessor1 = new UniformSubScopesProcessor(); 158 var crossover1 = new Placeholder(); 159 var uniformSubScopesProcessor2 = new UniformSubScopesProcessor(); 160 var evaluator1 = new Placeholder(); 161 var subScopesCounter1 = new SubScopesCounter(); 162 var qualityComparer1 = new WeightedParentsQualityComparator(); 163 var ageCalculator1 = new WeightingReducer() { Name = "Calculate Age" }; 164 var subScopesRemover1 = new SubScopesRemover(); 165 var uniformSubScopesProcessor3 = new UniformSubScopesProcessor(); 166 var mutationBranch1 = new StochasticBranch(); 167 var mutator1 = new Placeholder(); 168 var variableCreator1 = new VariableCreator(); 169 var variableCreator2 = new VariableCreator(); 170 var conditionalSelector = new ConditionalSelector(); 171 var subScopesProcessor2 = new SubScopesProcessor(); 172 var uniformSubScopesProcessor4 = new UniformSubScopesProcessor(); 173 var evaluator2 = new Placeholder(); 174 var subScopesCounter2 = new SubScopesCounter(); 175 var mergingReducer1 = new MergingReducer(); 176 var uniformSubScopesProcessor5 = new UniformSubScopesProcessor(); 177 var crossover2 = new Placeholder(); 178 var mutationBranch2 = new StochasticBranch(); 179 var mutator2 = new Placeholder(); 180 var uniformSubScopesProcessor6 = new UniformSubScopesProcessor(); 181 var evaluator3 = new Placeholder(); 182 var subScopesCounter3 = new SubScopesCounter(); 183 var qualityComparer2 = new WeightedParentsQualityComparator(); 184 var ageCalculator2 = new WeightingReducer() { Name = "Calculate Age" }; 185 var subScopesRemover2 = new SubScopesRemover(); 186 var offspringSelector = new AlpsOffspringSelector(); 187 var subScopesProcessor3 = new SubScopesProcessor(); 188 var bestSelector = new BestSelector(); 189 var worstSelector = new WorstSelector(); 190 var rightReducer = new RightReducer(); 191 var leftReducer = new LeftReducer(); 192 var mergingReducer2 = new MergingReducer(); 193 var reevaluateElitesBranch = new ConditionalBranch(); 194 var uniformSubScopesProcessor7 = new UniformSubScopesProcessor(); 195 var evaluator4 = new Placeholder(); 196 var subScopesCounter4 = new SubScopesCounter(); 197 var incrementAgeProcessor = new UniformSubScopesProcessor(); 198 var ageIncrementor = new DoubleCounter() { Name = "Increment Age" }; 199 200 201 OperatorGraph.InitialOperator = selector; 185 202 186 203 selector.Name = "Selector (placeholder)"; 187 204 selector.OperatorParameter.ActualName = SelectorParameter.Name; 205 selector.Successor = subScopesProcessor1; 206 207 subScopesProcessor1.Operators.Add(new EmptyOperator()); 208 subScopesProcessor1.Operators.Add(childrenCreator); 209 subScopesProcessor1.Successor = offspringSelector; 188 210 189 211 childrenCreator.ParentsPerChild = new IntValue(2); 212 childrenCreator.Successor = osBeforeMutationBranch; 190 213 191 214 osBeforeMutationBranch.Name = "Apply OS before mutation?"; 192 215 osBeforeMutationBranch.ConditionParameter.ActualName = OffspringSelectionBeforeMutationParameter.Name; 216 osBeforeMutationBranch.TrueBranch = uniformSubScopesProcessor1; 217 osBeforeMutationBranch.FalseBranch = uniformSubScopesProcessor5; 218 osBeforeMutationBranch.Successor = null; 219 220 uniformSubScopesProcessor1.Operator = crossover1; 221 uniformSubScopesProcessor1.Successor = uniformSubScopesProcessor2; 193 222 194 223 crossover1.Name = "Crossover (placeholder)"; 195 224 crossover1.OperatorParameter.ActualName = CrossoverParameter.Name; 225 crossover1.Successor = null; 196 226 197 227 uniformSubScopesProcessor2.Parallel.Value = true; 228 uniformSubScopesProcessor2.Operator = evaluator1; 229 uniformSubScopesProcessor2.Successor = subScopesCounter1; 198 230 199 231 evaluator1.Name = "Evaluator (placeholder)"; 200 232 evaluator1.OperatorParameter.ActualName = EvaluatorParameter.Name; 233 evaluator1.Successor = qualityComparer1; 201 234 202 235 subScopesCounter1.Name = "Increment EvaluatedSolutions"; 203 236 subScopesCounter1.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 237 subScopesCounter1.Successor = uniformSubScopesProcessor3; 238 239 uniformSubScopesProcessor3.Operator = mutationBranch1; 240 uniformSubScopesProcessor3.Successor = conditionalSelector; 204 241 205 242 qualityComparer1.ComparisonFactorParameter.ActualName = ComparisonFactorParameter.Name; … … 208 245 qualityComparer1.RightSideParameter.ActualName = QualityParameter.Name; 209 246 qualityComparer1.ResultParameter.ActualName = "SuccessfulOffspring"; 247 qualityComparer1.Successor = ageCalculator1; 248 249 ageCalculator1.ParameterToReduce.ActualName = AgeParameter.Name; 250 ageCalculator1.TargetParameter.ActualName = AgeParameter.Name; 251 ageCalculator1.WeightParameter.ActualName = AgeInheritanceParameter.Name; 252 ageCalculator1.Successor = subScopesRemover1; 210 253 211 254 subScopesRemover1.RemoveAllSubScopes = true; 255 subScopesRemover1.Successor = null; 212 256 213 257 mutationBranch1.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name; 214 258 mutationBranch1.RandomParameter.ActualName = RandomParameter.Name; 259 mutationBranch1.FirstBranch = mutator1; 260 mutationBranch1.SecondBranch = variableCreator2; 261 mutationBranch1.Successor = null; 215 262 216 263 mutator1.Name = "Mutator (placeholder)"; 217 264 mutator1.OperatorParameter.ActualName = MutatorParameter.Name; 265 mutator1.Successor = variableCreator1; 218 266 219 267 variableCreator1.Name = "MutatedOffspring = true"; 220 268 variableCreator1.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(true), false)); 269 variableCreator1.Successor = null; 221 270 222 271 variableCreator2.Name = "MutatedOffspring = false"; 223 272 variableCreator2.CollectedValues.Add(new ValueParameter<BoolValue>("MutatedOffspring", null, new BoolValue(false), false)); 273 variableCreator2.Successor = null; 224 274 225 275 conditionalSelector.ConditionParameter.ActualName = "MutatedOffspring"; 226 276 conditionalSelector.ConditionParameter.Depth = 1; 227 277 conditionalSelector.CopySelected.Value = false; 278 conditionalSelector.Successor = subScopesProcessor2; 279 280 subScopesProcessor2.Operators.Add(new EmptyOperator()); 281 subScopesProcessor2.Operators.Add(uniformSubScopesProcessor4); 282 subScopesProcessor2.Successor = mergingReducer1; 283 284 mergingReducer1.Successor = null; 228 285 229 286 uniformSubScopesProcessor4.Parallel.Value = true; 287 uniformSubScopesProcessor4.Operator = evaluator2; 288 uniformSubScopesProcessor4.Successor = subScopesCounter2; 230 289 231 290 evaluator2.Name = "Evaluator (placeholder)"; 232 291 evaluator2.OperatorParameter.ActualName = EvaluatorParameter.Name; 292 evaluator2.Successor = null; 233 293 234 294 subScopesCounter2.Name = "Increment EvaluatedSolutions"; 235 295 subScopesCounter2.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 296 subScopesCounter2.Successor = null; 297 298 uniformSubScopesProcessor5.Operator = crossover2; 299 uniformSubScopesProcessor5.Successor = uniformSubScopesProcessor6; 236 300 237 301 crossover2.Name = "Crossover (placeholder)"; 238 302 crossover2.OperatorParameter.ActualName = CrossoverParameter.Name; 303 crossover2.Successor = mutationBranch2; 239 304 240 305 mutationBranch2.ProbabilityParameter.ActualName = MutationProbabilityParameter.Name; 241 306 mutationBranch2.RandomParameter.ActualName = RandomParameter.Name; 307 mutationBranch2.FirstBranch = mutator2; 308 mutationBranch2.SecondBranch = null; 309 mutationBranch2.Successor = null; 242 310 243 311 mutator2.Name = "Mutator (placeholder)"; 244 312 mutator2.OperatorParameter.ActualName = MutatorParameter.Name; 313 mutator2.Successor = null; 245 314 246 315 uniformSubScopesProcessor6.Parallel.Value = true; 316 uniformSubScopesProcessor6.Operator = evaluator3; 317 uniformSubScopesProcessor6.Successor = subScopesCounter3; 247 318 248 319 evaluator3.Name = "Evaluator (placeholder)"; 249 320 evaluator3.OperatorParameter.ActualName = EvaluatorParameter.Name; 321 evaluator3.Successor = qualityComparer2; 250 322 251 323 subScopesCounter3.Name = "Increment EvaluatedSolutions"; … … 257 329 qualityComparer2.RightSideParameter.ActualName = QualityParameter.Name; 258 330 qualityComparer2.ResultParameter.ActualName = "SuccessfulOffspring"; 331 qualityComparer2.Successor = ageCalculator2; 332 333 ageCalculator2.ParameterToReduce.ActualName = AgeParameter.Name; 334 ageCalculator2.TargetParameter.ActualName = AgeParameter.Name; 335 ageCalculator2.WeightParameter.ActualName = AgeInheritanceParameter.Name; 336 ageCalculator2.Successor = subScopesRemover2; 259 337 260 338 subScopesRemover2.RemoveAllSubScopes = true; 339 subScopesRemover2.Successor = null; 340 341 subScopesCounter3.Successor = null; 261 342 262 343 offspringSelector.CurrentSuccessRatioParameter.ActualName = CurrentSuccessRatioParameter.Name; … … 268 349 offspringSelector.SuccessfulOffspringParameter.ActualName = "SuccessfulOffspring"; 269 350 offspringSelector.FillPopulationWithParentsParameter.ActualName = FillPopulationWithParentsParameter.Name; 351 offspringSelector.PopulationSizeParameter.ActualName = PopulationSizeParameter.Name; 352 offspringSelector.OffspringCreator = selector; 353 offspringSelector.Successor = subScopesProcessor3; 354 355 subScopesProcessor3.Operators.Add(bestSelector); 356 subScopesProcessor3.Operators.Add(worstSelector); 357 subScopesProcessor3.Successor = mergingReducer2; 270 358 271 359 bestSelector.CopySelected = new BoolValue(false); … … 273 361 bestSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name; 274 362 bestSelector.QualityParameter.ActualName = QualityParameter.Name; 363 bestSelector.Successor = rightReducer; 364 365 rightReducer.Successor = reevaluateElitesBranch; 366 367 reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites"; 368 reevaluateElitesBranch.Name = "Reevaluate elites ?"; 369 reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor7; 370 reevaluateElitesBranch.FalseBranch = null; 371 reevaluateElitesBranch.Successor = null; 372 373 uniformSubScopesProcessor7.Parallel.Value = true; 374 uniformSubScopesProcessor7.Operator = evaluator4; 375 uniformSubScopesProcessor7.Successor = subScopesCounter4; 376 377 evaluator4.Name = "Evaluator (placeholder)"; 378 evaluator4.OperatorParameter.ActualName = EvaluatorParameter.Name; 379 380 subScopesCounter4.Name = "Increment EvaluatedSolutions"; 381 subScopesCounter4.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name; 382 subScopesCounter4.Successor = null; 275 383 276 384 worstSelector.CopySelected = new BoolValue(false); … … 278 386 worstSelector.NumberOfSelectedSubScopesParameter.ActualName = ElitesParameter.Name; 279 387 worstSelector.QualityParameter.ActualName = QualityParameter.Name; 280 281 reevaluateElitesBranch.ConditionParameter.ActualName = "ReevaluateElites";282 reevaluateElitesBranch.Name = "Reevaluate elites ?";283 284 uniformSubScopesProcessor7.Parallel.Value = true;285 286 evaluator4.Name = "Evaluator (placeholder)";287 evaluator4.OperatorParameter.ActualName = EvaluatorParameter.Name;288 289 subScopesCounter4.Name = "Increment EvaluatedSolutions";290 subScopesCounter4.ValueParameter.ActualName = EvaluatedSolutionsParameter.Name;291 #endregion292 293 #region Create operator graph294 OperatorGraph.InitialOperator = selector;295 selector.Successor = subScopesProcessor1;296 subScopesProcessor1.Operators.Add(new EmptyOperator());297 subScopesProcessor1.Operators.Add(childrenCreator);298 subScopesProcessor1.Successor = offspringSelector;299 childrenCreator.Successor = osBeforeMutationBranch;300 osBeforeMutationBranch.TrueBranch = uniformSubScopesProcessor1;301 osBeforeMutationBranch.FalseBranch = uniformSubScopesProcessor5;302 osBeforeMutationBranch.Successor = null;303 uniformSubScopesProcessor1.Operator = crossover1;304 uniformSubScopesProcessor1.Successor = uniformSubScopesProcessor2;305 crossover1.Successor = null;306 uniformSubScopesProcessor2.Operator = evaluator1;307 uniformSubScopesProcessor2.Successor = subScopesCounter1;308 evaluator1.Successor = qualityComparer1;309 qualityComparer1.Successor = subScopesRemover1;310 subScopesRemover1.Successor = null;311 subScopesCounter1.Successor = uniformSubScopesProcessor3;312 uniformSubScopesProcessor3.Operator = mutationBranch1;313 uniformSubScopesProcessor3.Successor = conditionalSelector;314 mutationBranch1.FirstBranch = mutator1;315 mutationBranch1.SecondBranch = variableCreator2;316 mutationBranch1.Successor = null;317 mutator1.Successor = variableCreator1;318 variableCreator1.Successor = null;319 variableCreator2.Successor = null;320 conditionalSelector.Successor = subScopesProcessor2;321 subScopesProcessor2.Operators.Add(new EmptyOperator());322 subScopesProcessor2.Operators.Add(uniformSubScopesProcessor4);323 subScopesProcessor2.Successor = mergingReducer1;324 uniformSubScopesProcessor4.Operator = evaluator2;325 uniformSubScopesProcessor4.Successor = subScopesCounter2;326 evaluator2.Successor = null;327 subScopesCounter2.Successor = null;328 mergingReducer1.Successor = null;329 uniformSubScopesProcessor5.Operator = crossover2;330 uniformSubScopesProcessor5.Successor = uniformSubScopesProcessor6;331 crossover2.Successor = mutationBranch2;332 mutationBranch2.FirstBranch = mutator2;333 mutationBranch2.SecondBranch = null;334 mutationBranch2.Successor = null;335 mutator2.Successor = null;336 uniformSubScopesProcessor6.Operator = evaluator3;337 uniformSubScopesProcessor6.Successor = subScopesCounter3;338 evaluator3.Successor = qualityComparer2;339 qualityComparer2.Successor = subScopesRemover2;340 subScopesRemover2.Successor = null;341 subScopesCounter3.Successor = null;342 offspringSelector.OffspringCreator = selector;343 offspringSelector.Successor = subScopesProcessor3;344 subScopesProcessor3.Operators.Add(bestSelector);345 subScopesProcessor3.Operators.Add(worstSelector);346 subScopesProcessor3.Successor = mergingReducer2;347 bestSelector.Successor = rightReducer;348 rightReducer.Successor = reevaluateElitesBranch;349 reevaluateElitesBranch.TrueBranch = uniformSubScopesProcessor7;350 uniformSubScopesProcessor7.Operator = evaluator4;351 uniformSubScopesProcessor7.Successor = subScopesCounter4;352 subScopesCounter4.Successor = null;353 reevaluateElitesBranch.FalseBranch = null;354 reevaluateElitesBranch.Successor = null;355 388 worstSelector.Successor = leftReducer; 389 356 390 leftReducer.Successor = null; 357 mergingReducer2.Successor = null; 358 #endregion 391 392 mergingReducer2.Successor = incrementAgeProcessor; 393 394 incrementAgeProcessor.Operator = ageIncrementor; 395 incrementAgeProcessor.Successor = null; 396 397 ageIncrementor.ValueParameter.ActualName = AgeParameter.Name; 398 ageIncrementor.IncrementParameter.Value = null; 399 ageIncrementor.IncrementParameter.ActualName = AgeIncrementParameter.Name; 400 ageIncrementor.Successor = null; 359 401 } 360 402
Note: See TracChangeset
for help on using the changeset viewer.