Changeset 2052 for trunk/sources/HeuristicLab.ES/3.2/ES.cs
- Timestamp:
- 06/17/09 00:30:11 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.ES/3.2/ES.cs
r1785 r2052 30 30 using HeuristicLab.Selection; 31 31 using HeuristicLab.RealVector; 32 using HeuristicLab.Evolutionary; 32 33 33 34 namespace HeuristicLab.ES { … … 36 37 /// </summary> 37 38 public class ES : ItemBase, IEditable { 39 38 40 #region Create Operators 39 41 /// <summary> … … 64 66 // place holder for ProblemInjector 65 67 EmptyOperator eo1 = new EmptyOperator(); 66 eo1.Name = " ProblemInjector";68 eo1.Name = "Empty Problem"; // was ProblemInjector 67 69 op.OperatorGraph.AddOperator(eo1); 68 70 co1.AddSubOperator(eo1); 71 co1.AddVariableInfo(new VariableInfo("ProblemInjector", "", typeof(IOperator), VariableKind.In)); 72 co1.GetVariableInfo("ProblemInjector").ActualName = "Empty Problem"; 69 73 70 74 CombinedOperator co2 = CreatePopulationInitialization(); … … 75 79 // place holder for SolutionGenerator 76 80 EmptyOperator eo2 = new EmptyOperator(); 77 eo2.Name = " SolutionGenerator";81 eo2.Name = "Empty Solution"; // was SolutionGenerator 78 82 op.OperatorGraph.AddOperator(eo2); 79 83 co2.AddSubOperator(eo2); 84 co2.AddVariableInfo(new VariableInfo("SolutionGenerator", "", typeof(IOperator), VariableKind.In)); 85 co2.GetVariableInfo("SolutionGenerator").ActualName = "Empty Solution"; 80 86 81 87 // place holder for Evaluator 82 88 EmptyOperator eo3 = new EmptyOperator(); 83 eo3.Name = "E valuator";89 eo3.Name = "Empty Evaluation"; // was Evaluator 84 90 op.OperatorGraph.AddOperator(eo3); 85 91 co2.AddSubOperator(eo3); 92 co2.AddVariableInfo(new VariableInfo("Evaluator", "", typeof(IOperator), VariableKind.In)); 93 co2.GetVariableInfo("Evaluator").ActualName = "Empty Evaluation"; 86 94 87 95 CombinedOperator co3 = CreateESMain(); … … 92 100 // place holder for Mutator 93 101 EmptyOperator eo4 = new EmptyOperator(); 94 eo4.Name = " Mutator";102 eo4.Name = "No Mutation"; // was Mutator 95 103 op.OperatorGraph.AddOperator(eo4); 96 104 co3.AddSubOperator(eo4); 105 co3.AddVariableInfo(new VariableInfo("Mutator", "", typeof(IOperator), VariableKind.In)); 106 co3.GetVariableInfo("Mutator").ActualName = "No Mutation"; 97 107 98 108 // place holder for Evaluator 99 109 co3.AddSubOperator(eo3); 110 co3.AddVariableInfo(new VariableInfo("Evaluator", "", typeof(IOperator), VariableKind.In)); 111 co3.GetVariableInfo("Evaluator").ActualName = "Empty Evaluation"; 100 112 101 113 // place holder for Recombinator 102 114 EmptyOperator eo5 = new EmptyOperator(); 103 eo5.Name = " Recombinator";115 eo5.Name = "No Recombination"; // was Recombinator 104 116 op.OperatorGraph.AddOperator(eo5); 105 117 co3.AddSubOperator(eo5); 118 co3.AddVariableInfo(new VariableInfo("Recombinator", "", typeof(IOperator), VariableKind.In)); 119 co3.GetVariableInfo("Recombinator").ActualName = "No Recombination"; 106 120 107 121 return op; … … 289 303 op.OperatorGraph.InitialOperator = sp1; 290 304 305 GreaterThanComparator gtc = new GreaterThanComparator(); 306 gtc.GetVariableInfo("LeftSide").ActualName = "ESrho"; 307 gtc.GetVariableInfo("RightSide").Local = true; 308 gtc.AddVariable(new Variable("RightSide", new IntData(1))); 309 gtc.GetVariableInfo("Result").ActualName = "UseRecombination"; 310 op.OperatorGraph.AddOperator(gtc); 311 sp1.AddSubOperator(gtc); 312 313 ConditionalBranch cb = new ConditionalBranch(); 314 cb.Name = "Use recombination?"; 315 cb.GetVariableInfo("Condition").ActualName = "UseRecombination"; 316 op.OperatorGraph.AddOperator(cb); 317 sp1.AddSubOperator(cb); 318 319 SequentialProcessor sp2 = new SequentialProcessor(); 320 op.OperatorGraph.AddOperator(sp2); 321 cb.AddSubOperator(sp2); 322 323 ChildrenInitializer ci = new ChildrenInitializer(); 324 ci.GetVariableInfo("ParentsPerChild").Local = false; 325 ci.RemoveVariable("ParentsPerChild"); 326 ci.GetVariableInfo("ParentsPerChild").ActualName = "ESrho"; 327 op.OperatorGraph.AddOperator(ci); 328 sp2.AddSubOperator(ci); 329 330 UniformSequentialSubScopesProcessor ussp0 = new UniformSequentialSubScopesProcessor(); 331 op.OperatorGraph.AddOperator(ussp0); 332 sp2.AddSubOperator(ussp0); 333 334 SequentialProcessor sp3 = new SequentialProcessor(); 335 op.OperatorGraph.AddOperator(sp3); 336 ussp0.AddSubOperator(sp3); 337 291 338 OperatorExtractor oe1 = new OperatorExtractor(); 292 339 oe1.Name = "Recombinator"; 293 340 oe1.GetVariableInfo("Operator").ActualName = "Recombinator"; 294 341 op.OperatorGraph.AddOperator(oe1); 295 sp 1.AddSubOperator(oe1);342 sp3.AddSubOperator(oe1); 296 343 297 344 UniformSequentialSubScopesProcessor ussp = new UniformSequentialSubScopesProcessor(); 298 345 op.OperatorGraph.AddOperator(ussp); 299 sp1.AddSubOperator(ussp);300 301 SequentialProcessor sp 2= new SequentialProcessor();302 op.OperatorGraph.AddOperator(sp 2);303 ussp.AddSubOperator(sp 2);346 cb.AddSubOperator(ussp); 347 348 SequentialProcessor sp4 = new SequentialProcessor(); 349 op.OperatorGraph.AddOperator(sp4); 350 ussp.AddSubOperator(sp4); 304 351 305 352 OperatorExtractor oe2 = new OperatorExtractor(); … … 307 354 oe2.GetVariableInfo("Operator").ActualName = "Mutator"; 308 355 op.OperatorGraph.AddOperator(oe2); 309 sp 2.AddSubOperator(oe2);356 sp4.AddSubOperator(oe2); 310 357 311 358 OperatorExtractor oe3 = new OperatorExtractor(); … … 313 360 oe3.GetVariableInfo("Operator").ActualName = "Evaluator"; 314 361 op.OperatorGraph.AddOperator(oe3); 315 sp 2.AddSubOperator(oe3);362 sp4.AddSubOperator(oe3); 316 363 317 364 Counter c = new Counter(); 318 365 c.GetVariableInfo("Value").ActualName = "EvaluatedSolutions"; 319 366 op.OperatorGraph.AddOperator(c); 320 sp2.AddSubOperator(c); 367 sp4.AddSubOperator(c); 368 369 sp3.AddSubOperator(oe2); 370 sp3.AddSubOperator(oe3); 371 sp3.AddSubOperator(c); 372 373 SubScopesRemover ssr = new SubScopesRemover(); 374 ssr.GetVariableInfo("SubScopeIndex").Local = true; 375 op.OperatorGraph.AddOperator(ssr); 376 sp3.AddSubOperator(ssr); 321 377 322 378 Sorter s = new Sorter(); … … 542 598 get { return myVariableInjection.SubOperators[0]; } 543 599 set { 544 value.Name = "ProblemInjector";600 myVariableInjection.GetVariableInfo("ProblemInjector").ActualName = value.Name; 545 601 myES.OperatorGraph.RemoveOperator(ProblemInjector.Guid); 546 602 myES.OperatorGraph.AddOperator(value); … … 555 611 get { return myPopulationInitialization.SubOperators[0]; } 556 612 set { 557 value.Name = "SolutionGenerator";613 myPopulationInitialization.GetVariableInfo("SolutionGenerator").ActualName = value.Name; 558 614 myES.OperatorGraph.RemoveOperator(SolutionGenerator.Guid); 559 615 myES.OperatorGraph.AddOperator(value); … … 567 623 get { return myPopulationInitialization.SubOperators[1]; } 568 624 set { 569 value.Name = "Evaluator"; 625 myPopulationInitialization.GetVariableInfo("Evaluator").ActualName = value.Name; 626 myESMain.GetVariableInfo("Evaluator").ActualName = value.Name; 570 627 myES.OperatorGraph.RemoveOperator(Evaluator.Guid); 571 628 myES.OperatorGraph.AddOperator(value); … … 580 637 get { return myESMain.SubOperators[0]; } 581 638 set { 582 value.Name = "Mutator";639 myESMain.GetVariableInfo("Mutator").ActualName = value.Name; 583 640 myES.OperatorGraph.RemoveOperator(Mutator.Guid); 584 641 myES.OperatorGraph.AddOperator(value); … … 592 649 get { return myESMain.SubOperators[2]; } 593 650 set { 594 value.Name = "Recombinator";651 myESMain.GetVariableInfo("Recombinator").ActualName = value.Name; 595 652 myES.OperatorGraph.RemoveOperator(Recombinator.Guid); 596 653 myES.OperatorGraph.AddOperator(value);
Note: See TracChangeset
for help on using the changeset viewer.