Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/17/09 00:30:11 (15 years ago)
Author:
abeham
Message:

Improved ES GUI according to #674

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.ES/3.2/ES.cs

    r1785 r2052  
    3030using HeuristicLab.Selection;
    3131using HeuristicLab.RealVector;
     32using HeuristicLab.Evolutionary;
    3233
    3334namespace HeuristicLab.ES {
     
    3637  /// </summary>
    3738  public class ES : ItemBase, IEditable {
     39
    3840    #region Create Operators
    3941    /// <summary>
     
    6466      // place holder for ProblemInjector
    6567      EmptyOperator eo1 = new EmptyOperator();
    66       eo1.Name = "ProblemInjector";
     68      eo1.Name = "Empty Problem"; // was ProblemInjector
    6769      op.OperatorGraph.AddOperator(eo1);
    6870      co1.AddSubOperator(eo1);
     71      co1.AddVariableInfo(new VariableInfo("ProblemInjector", "", typeof(IOperator), VariableKind.In));
     72      co1.GetVariableInfo("ProblemInjector").ActualName = "Empty Problem";
    6973
    7074      CombinedOperator co2 = CreatePopulationInitialization();
     
    7579      // place holder for SolutionGenerator
    7680      EmptyOperator eo2 = new EmptyOperator();
    77       eo2.Name = "SolutionGenerator";
     81      eo2.Name = "Empty Solution"; // was SolutionGenerator
    7882      op.OperatorGraph.AddOperator(eo2);
    7983      co2.AddSubOperator(eo2);
     84      co2.AddVariableInfo(new VariableInfo("SolutionGenerator", "", typeof(IOperator), VariableKind.In));
     85      co2.GetVariableInfo("SolutionGenerator").ActualName = "Empty Solution";
    8086
    8187      // place holder for Evaluator
    8288      EmptyOperator eo3 = new EmptyOperator();
    83       eo3.Name = "Evaluator";
     89      eo3.Name = "Empty Evaluation"; // was Evaluator
    8490      op.OperatorGraph.AddOperator(eo3);
    8591      co2.AddSubOperator(eo3);
     92      co2.AddVariableInfo(new VariableInfo("Evaluator", "", typeof(IOperator), VariableKind.In));
     93      co2.GetVariableInfo("Evaluator").ActualName = "Empty Evaluation";
    8694
    8795      CombinedOperator co3 = CreateESMain();
     
    92100      // place holder for Mutator
    93101      EmptyOperator eo4 = new EmptyOperator();
    94       eo4.Name = "Mutator";
     102      eo4.Name = "No Mutation"; // was Mutator
    95103      op.OperatorGraph.AddOperator(eo4);
    96104      co3.AddSubOperator(eo4);
     105      co3.AddVariableInfo(new VariableInfo("Mutator", "", typeof(IOperator), VariableKind.In));
     106      co3.GetVariableInfo("Mutator").ActualName = "No Mutation";
    97107
    98108      // place holder for Evaluator
    99109      co3.AddSubOperator(eo3);
     110      co3.AddVariableInfo(new VariableInfo("Evaluator", "", typeof(IOperator), VariableKind.In));
     111      co3.GetVariableInfo("Evaluator").ActualName = "Empty Evaluation";
    100112
    101113      // place holder for Recombinator
    102114      EmptyOperator eo5 = new EmptyOperator();
    103       eo5.Name = "Recombinator";
     115      eo5.Name = "No Recombination"; // was Recombinator
    104116      op.OperatorGraph.AddOperator(eo5);
    105117      co3.AddSubOperator(eo5);
     118      co3.AddVariableInfo(new VariableInfo("Recombinator", "", typeof(IOperator), VariableKind.In));
     119      co3.GetVariableInfo("Recombinator").ActualName = "No Recombination";
    106120
    107121      return op;
     
    289303      op.OperatorGraph.InitialOperator = sp1;
    290304
     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
    291338      OperatorExtractor oe1 = new OperatorExtractor();
    292339      oe1.Name = "Recombinator";
    293340      oe1.GetVariableInfo("Operator").ActualName = "Recombinator";
    294341      op.OperatorGraph.AddOperator(oe1);
    295       sp1.AddSubOperator(oe1);
     342      sp3.AddSubOperator(oe1);
    296343
    297344      UniformSequentialSubScopesProcessor ussp = new UniformSequentialSubScopesProcessor();
    298345      op.OperatorGraph.AddOperator(ussp);
    299       sp1.AddSubOperator(ussp);
    300 
    301       SequentialProcessor sp2 = new SequentialProcessor();
    302       op.OperatorGraph.AddOperator(sp2);
    303       ussp.AddSubOperator(sp2);
     346      cb.AddSubOperator(ussp);
     347
     348      SequentialProcessor sp4 = new SequentialProcessor();
     349      op.OperatorGraph.AddOperator(sp4);
     350      ussp.AddSubOperator(sp4);
    304351
    305352      OperatorExtractor oe2 = new OperatorExtractor();
     
    307354      oe2.GetVariableInfo("Operator").ActualName = "Mutator";
    308355      op.OperatorGraph.AddOperator(oe2);
    309       sp2.AddSubOperator(oe2);
     356      sp4.AddSubOperator(oe2);
    310357
    311358      OperatorExtractor oe3 = new OperatorExtractor();
     
    313360      oe3.GetVariableInfo("Operator").ActualName = "Evaluator";
    314361      op.OperatorGraph.AddOperator(oe3);
    315       sp2.AddSubOperator(oe3);
     362      sp4.AddSubOperator(oe3);
    316363
    317364      Counter c = new Counter();
    318365      c.GetVariableInfo("Value").ActualName = "EvaluatedSolutions";
    319366      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);
    321377
    322378      Sorter s = new Sorter();
     
    542598      get { return myVariableInjection.SubOperators[0]; }
    543599      set {
    544         value.Name = "ProblemInjector";
     600        myVariableInjection.GetVariableInfo("ProblemInjector").ActualName = value.Name;
    545601        myES.OperatorGraph.RemoveOperator(ProblemInjector.Guid);
    546602        myES.OperatorGraph.AddOperator(value);
     
    555611      get { return myPopulationInitialization.SubOperators[0]; }
    556612      set {
    557         value.Name = "SolutionGenerator";
     613        myPopulationInitialization.GetVariableInfo("SolutionGenerator").ActualName = value.Name;
    558614        myES.OperatorGraph.RemoveOperator(SolutionGenerator.Guid);
    559615        myES.OperatorGraph.AddOperator(value);
     
    567623      get { return myPopulationInitialization.SubOperators[1]; }
    568624      set {
    569         value.Name = "Evaluator";
     625        myPopulationInitialization.GetVariableInfo("Evaluator").ActualName = value.Name;
     626        myESMain.GetVariableInfo("Evaluator").ActualName = value.Name;
    570627        myES.OperatorGraph.RemoveOperator(Evaluator.Guid);
    571628        myES.OperatorGraph.AddOperator(value);
     
    580637      get { return myESMain.SubOperators[0]; }
    581638      set {
    582         value.Name = "Mutator";
     639        myESMain.GetVariableInfo("Mutator").ActualName = value.Name;
    583640        myES.OperatorGraph.RemoveOperator(Mutator.Guid);
    584641        myES.OperatorGraph.AddOperator(value);
     
    592649      get { return myESMain.SubOperators[2]; }
    593650      set {
    594         value.Name = "Recombinator";
     651        myESMain.GetVariableInfo("Recombinator").ActualName = value.Name;
    595652        myES.OperatorGraph.RemoveOperator(Recombinator.Guid);
    596653        myES.OperatorGraph.AddOperator(value);
Note: See TracChangeset for help on using the changeset viewer.