Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2052


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

Improved ES GUI according to #674

Location:
trunk/sources/HeuristicLab.ES/3.2
Files:
4 added
5 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);
  • trunk/sources/HeuristicLab.ES/3.2/ESEditor.Designer.cs

    r1529 r2052  
    6565      this.commaRadioButton = new System.Windows.Forms.RadioButton();
    6666      this.plusRadioButton = new System.Windows.Forms.RadioButton();
    67       this.setRecombinationButton = new System.Windows.Forms.Button();
    68       this.viewRecombinationButton = new System.Windows.Forms.Button();
    69       this.recombinationTextBox = new System.Windows.Forms.TextBox();
     67      this.customizeRecombinationButton = new System.Windows.Forms.Button();
    7068      this.recombinationLabel = new System.Windows.Forms.Label();
    7169      this.rhoTextBox = new System.Windows.Forms.TextBox();
    7270      this.rhoLabel = new System.Windows.Forms.Label();
    73       this.setEvaluationButton = new System.Windows.Forms.Button();
    74       this.setMutationButton = new System.Windows.Forms.Button();
    75       this.setSolutionGenerationButton = new System.Windows.Forms.Button();
    76       this.viewEvaluationButton = new System.Windows.Forms.Button();
    77       this.viewMutationButton = new System.Windows.Forms.Button();
    78       this.viewSolutionGenerationButton = new System.Windows.Forms.Button();
    79       this.viewProblemInitializationButton = new System.Windows.Forms.Button();
    80       this.setProblemInitializationButton = new System.Windows.Forms.Button();
    81       this.evaluationTextBox = new System.Windows.Forms.TextBox();
    82       this.mutationTextBox = new System.Windows.Forms.TextBox();
    83       this.solutionGenerationTextBox = new System.Windows.Forms.TextBox();
    84       this.problemInitializationTextBox = new System.Windows.Forms.TextBox();
     71      this.customizeEvaluationButton = new System.Windows.Forms.Button();
     72      this.customizeMutationButton = new System.Windows.Forms.Button();
     73      this.customizeSolutionGenerationButton = new System.Windows.Forms.Button();
     74      this.customizeProblemInitializationButton = new System.Windows.Forms.Button();
    8575      this.setRandomSeedRandomlyCheckBox = new System.Windows.Forms.CheckBox();
    8676      this.problemDimensionTextBox = new System.Windows.Forms.TextBox();
     
    113103      this.cloneEngineButton = new System.Windows.Forms.Button();
    114104      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     105      this.openOperatorLibraryButton = new System.Windows.Forms.Button();
     106      this.openOperatorLibraryFileDialog = new System.Windows.Forms.OpenFileDialog();
     107      this.problemInitializationComboBox = new System.Windows.Forms.ComboBox();
     108      this.solutionGenerationComboBox = new System.Windows.Forms.ComboBox();
     109      this.mutationComboBox = new System.Windows.Forms.ComboBox();
     110      this.evaluationComboBox = new System.Windows.Forms.ComboBox();
     111      this.recombinationComboBox = new System.Windows.Forms.ComboBox();
    115112      this.tabControl.SuspendLayout();
    116113      this.parametersTabPage.SuspendLayout();
     
    146143      // parametersTabPage
    147144      //
     145      this.parametersTabPage.AutoScroll = true;
     146      this.parametersTabPage.Controls.Add(this.recombinationComboBox);
     147      this.parametersTabPage.Controls.Add(this.evaluationComboBox);
     148      this.parametersTabPage.Controls.Add(this.mutationComboBox);
     149      this.parametersTabPage.Controls.Add(this.solutionGenerationComboBox);
     150      this.parametersTabPage.Controls.Add(this.problemInitializationComboBox);
     151      this.parametersTabPage.Controls.Add(this.openOperatorLibraryButton);
    148152      this.parametersTabPage.Controls.Add(this.leftBracketLabelRight);
    149153      this.parametersTabPage.Controls.Add(this.semicolonLabel);
     
    152156      this.parametersTabPage.Controls.Add(this.successRuleGroupBox);
    153157      this.parametersTabPage.Controls.Add(this.parentSelectionGroupBox);
    154       this.parametersTabPage.Controls.Add(this.setRecombinationButton);
    155       this.parametersTabPage.Controls.Add(this.viewRecombinationButton);
    156       this.parametersTabPage.Controls.Add(this.recombinationTextBox);
     158      this.parametersTabPage.Controls.Add(this.customizeRecombinationButton);
    157159      this.parametersTabPage.Controls.Add(this.recombinationLabel);
    158160      this.parametersTabPage.Controls.Add(this.rhoTextBox);
    159161      this.parametersTabPage.Controls.Add(this.rhoLabel);
    160       this.parametersTabPage.Controls.Add(this.setEvaluationButton);
    161       this.parametersTabPage.Controls.Add(this.setMutationButton);
    162       this.parametersTabPage.Controls.Add(this.setSolutionGenerationButton);
    163       this.parametersTabPage.Controls.Add(this.viewEvaluationButton);
    164       this.parametersTabPage.Controls.Add(this.viewMutationButton);
    165       this.parametersTabPage.Controls.Add(this.viewSolutionGenerationButton);
    166       this.parametersTabPage.Controls.Add(this.viewProblemInitializationButton);
    167       this.parametersTabPage.Controls.Add(this.setProblemInitializationButton);
    168       this.parametersTabPage.Controls.Add(this.evaluationTextBox);
    169       this.parametersTabPage.Controls.Add(this.mutationTextBox);
    170       this.parametersTabPage.Controls.Add(this.solutionGenerationTextBox);
    171       this.parametersTabPage.Controls.Add(this.problemInitializationTextBox);
     162      this.parametersTabPage.Controls.Add(this.customizeEvaluationButton);
     163      this.parametersTabPage.Controls.Add(this.customizeMutationButton);
     164      this.parametersTabPage.Controls.Add(this.customizeSolutionGenerationButton);
     165      this.parametersTabPage.Controls.Add(this.customizeProblemInitializationButton);
    172166      this.parametersTabPage.Controls.Add(this.setRandomSeedRandomlyCheckBox);
    173167      this.parametersTabPage.Controls.Add(this.problemDimensionTextBox);
     
    353347      this.plusRadioButton.CheckedChanged += new System.EventHandler(this.plusRadioButton_CheckedChanged);
    354348      //
    355       // setRecombinationButton
    356       //
    357       this.setRecombinationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    358       this.setRecombinationButton.Location = new System.Drawing.Point(419, 458);
    359       this.setRecombinationButton.Name = "setRecombinationButton";
    360       this.setRecombinationButton.Size = new System.Drawing.Size(43, 20);
    361       this.setRecombinationButton.TabIndex = 47;
    362       this.setRecombinationButton.Text = "Set...";
    363       this.setRecombinationButton.UseVisualStyleBackColor = true;
    364       this.setRecombinationButton.Click += new System.EventHandler(this.setRecombinationButton_Click);
    365       //
    366       // viewRecombinationButton
    367       //
    368       this.viewRecombinationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    369       this.viewRecombinationButton.Location = new System.Drawing.Point(360, 458);
    370       this.viewRecombinationButton.Name = "viewRecombinationButton";
    371       this.viewRecombinationButton.Size = new System.Drawing.Size(53, 20);
    372       this.viewRecombinationButton.TabIndex = 46;
    373       this.viewRecombinationButton.Text = "View...";
    374       this.viewRecombinationButton.UseVisualStyleBackColor = true;
    375       this.viewRecombinationButton.Click += new System.EventHandler(this.viewRecombinationButton_Click);
    376       //
    377       // recombinationTextBox
    378       //
    379       this.recombinationTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
    380       this.recombinationTextBox.Location = new System.Drawing.Point(168, 458);
    381       this.recombinationTextBox.Name = "recombinationTextBox";
    382       this.recombinationTextBox.ReadOnly = true;
    383       this.recombinationTextBox.Size = new System.Drawing.Size(186, 20);
    384       this.recombinationTextBox.TabIndex = 45;
     349      // customizeRecombinationButton
     350      //
     351      this.customizeRecombinationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
     352      this.customizeRecombinationButton.Location = new System.Drawing.Point(360, 461);
     353      this.customizeRecombinationButton.Name = "customizeRecombinationButton";
     354      this.customizeRecombinationButton.Size = new System.Drawing.Size(74, 21);
     355      this.customizeRecombinationButton.TabIndex = 46;
     356      this.customizeRecombinationButton.Text = "Customize...";
     357      this.customizeRecombinationButton.UseVisualStyleBackColor = true;
     358      this.customizeRecombinationButton.Click += new System.EventHandler(this.viewRecombinationButton_Click);
    385359      //
    386360      // recombinationLabel
     
    388362      this.recombinationLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
    389363      this.recombinationLabel.AutoSize = true;
    390       this.recombinationLabel.Location = new System.Drawing.Point(6, 461);
     364      this.recombinationLabel.Location = new System.Drawing.Point(6, 462);
    391365      this.recombinationLabel.Name = "recombinationLabel";
    392366      this.recombinationLabel.Size = new System.Drawing.Size(81, 13);
     
    413387      this.rhoLabel.Text = "Rho (ρ):";
    414388      //
    415       // setEvaluationButton
    416       //
    417       this.setEvaluationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    418       this.setEvaluationButton.Location = new System.Drawing.Point(419, 432);
    419       this.setEvaluationButton.Name = "setEvaluationButton";
    420       this.setEvaluationButton.Size = new System.Drawing.Size(43, 20);
    421       this.setEvaluationButton.TabIndex = 43;
    422       this.setEvaluationButton.Text = "Set...";
    423       this.setEvaluationButton.UseVisualStyleBackColor = true;
    424       this.setEvaluationButton.Click += new System.EventHandler(this.setEvaluationButton_Click);
    425       //
    426       // setMutationButton
    427       //
    428       this.setMutationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    429       this.setMutationButton.Location = new System.Drawing.Point(419, 406);
    430       this.setMutationButton.Name = "setMutationButton";
    431       this.setMutationButton.Size = new System.Drawing.Size(43, 20);
    432       this.setMutationButton.TabIndex = 39;
    433       this.setMutationButton.Text = "Set...";
    434       this.setMutationButton.UseVisualStyleBackColor = true;
    435       this.setMutationButton.Click += new System.EventHandler(this.setMutationButton_Click);
    436       //
    437       // setSolutionGenerationButton
    438       //
    439       this.setSolutionGenerationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    440       this.setSolutionGenerationButton.Location = new System.Drawing.Point(419, 380);
    441       this.setSolutionGenerationButton.Name = "setSolutionGenerationButton";
    442       this.setSolutionGenerationButton.Size = new System.Drawing.Size(43, 20);
    443       this.setSolutionGenerationButton.TabIndex = 35;
    444       this.setSolutionGenerationButton.Text = "Set...";
    445       this.setSolutionGenerationButton.UseVisualStyleBackColor = true;
    446       this.setSolutionGenerationButton.Click += new System.EventHandler(this.setSolutionGenerationButton_Click);
    447       //
    448       // viewEvaluationButton
    449       //
    450       this.viewEvaluationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    451       this.viewEvaluationButton.Location = new System.Drawing.Point(360, 432);
    452       this.viewEvaluationButton.Name = "viewEvaluationButton";
    453       this.viewEvaluationButton.Size = new System.Drawing.Size(53, 20);
    454       this.viewEvaluationButton.TabIndex = 42;
    455       this.viewEvaluationButton.Text = "View...";
    456       this.viewEvaluationButton.UseVisualStyleBackColor = true;
    457       this.viewEvaluationButton.Click += new System.EventHandler(this.viewEvaluationButton_Click);
    458       //
    459       // viewMutationButton
    460       //
    461       this.viewMutationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    462       this.viewMutationButton.Location = new System.Drawing.Point(360, 406);
    463       this.viewMutationButton.Name = "viewMutationButton";
    464       this.viewMutationButton.Size = new System.Drawing.Size(53, 20);
    465       this.viewMutationButton.TabIndex = 38;
    466       this.viewMutationButton.Text = "View...";
    467       this.viewMutationButton.UseVisualStyleBackColor = true;
    468       this.viewMutationButton.Click += new System.EventHandler(this.viewMutationButton_Click);
    469       //
    470       // viewSolutionGenerationButton
    471       //
    472       this.viewSolutionGenerationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    473       this.viewSolutionGenerationButton.Location = new System.Drawing.Point(360, 380);
    474       this.viewSolutionGenerationButton.Name = "viewSolutionGenerationButton";
    475       this.viewSolutionGenerationButton.Size = new System.Drawing.Size(53, 20);
    476       this.viewSolutionGenerationButton.TabIndex = 34;
    477       this.viewSolutionGenerationButton.Text = "View...";
    478       this.viewSolutionGenerationButton.UseVisualStyleBackColor = true;
    479       this.viewSolutionGenerationButton.Click += new System.EventHandler(this.viewSolutionGenerationButton_Click);
    480       //
    481       // viewProblemInitializationButton
    482       //
    483       this.viewProblemInitializationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    484       this.viewProblemInitializationButton.Location = new System.Drawing.Point(360, 354);
    485       this.viewProblemInitializationButton.Name = "viewProblemInitializationButton";
    486       this.viewProblemInitializationButton.Size = new System.Drawing.Size(53, 20);
    487       this.viewProblemInitializationButton.TabIndex = 30;
    488       this.viewProblemInitializationButton.Text = "View...";
    489       this.viewProblemInitializationButton.UseVisualStyleBackColor = true;
    490       this.viewProblemInitializationButton.Click += new System.EventHandler(this.viewProblemInitializationButton_Click);
    491       //
    492       // setProblemInitializationButton
    493       //
    494       this.setProblemInitializationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
    495       this.setProblemInitializationButton.Location = new System.Drawing.Point(419, 354);
    496       this.setProblemInitializationButton.Name = "setProblemInitializationButton";
    497       this.setProblemInitializationButton.Size = new System.Drawing.Size(43, 20);
    498       this.setProblemInitializationButton.TabIndex = 31;
    499       this.setProblemInitializationButton.Text = "Set...";
    500       this.setProblemInitializationButton.UseVisualStyleBackColor = true;
    501       this.setProblemInitializationButton.Click += new System.EventHandler(this.setProblemInitializationButton_Click);
    502       //
    503       // evaluationTextBox
    504       //
    505       this.evaluationTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
    506       this.evaluationTextBox.Location = new System.Drawing.Point(168, 432);
    507       this.evaluationTextBox.Name = "evaluationTextBox";
    508       this.evaluationTextBox.ReadOnly = true;
    509       this.evaluationTextBox.Size = new System.Drawing.Size(186, 20);
    510       this.evaluationTextBox.TabIndex = 41;
    511       //
    512       // mutationTextBox
    513       //
    514       this.mutationTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
    515       this.mutationTextBox.Location = new System.Drawing.Point(168, 406);
    516       this.mutationTextBox.Name = "mutationTextBox";
    517       this.mutationTextBox.ReadOnly = true;
    518       this.mutationTextBox.Size = new System.Drawing.Size(186, 20);
    519       this.mutationTextBox.TabIndex = 37;
    520       //
    521       // solutionGenerationTextBox
    522       //
    523       this.solutionGenerationTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
    524       this.solutionGenerationTextBox.Location = new System.Drawing.Point(168, 380);
    525       this.solutionGenerationTextBox.Name = "solutionGenerationTextBox";
    526       this.solutionGenerationTextBox.ReadOnly = true;
    527       this.solutionGenerationTextBox.Size = new System.Drawing.Size(186, 20);
    528       this.solutionGenerationTextBox.TabIndex = 33;
    529       //
    530       // problemInitializationTextBox
    531       //
    532       this.problemInitializationTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
    533       this.problemInitializationTextBox.Location = new System.Drawing.Point(168, 354);
    534       this.problemInitializationTextBox.Name = "problemInitializationTextBox";
    535       this.problemInitializationTextBox.ReadOnly = true;
    536       this.problemInitializationTextBox.Size = new System.Drawing.Size(186, 20);
    537       this.problemInitializationTextBox.TabIndex = 29;
     389      // customizeEvaluationButton
     390      //
     391      this.customizeEvaluationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
     392      this.customizeEvaluationButton.Location = new System.Drawing.Point(360, 407);
     393      this.customizeEvaluationButton.Name = "customizeEvaluationButton";
     394      this.customizeEvaluationButton.Size = new System.Drawing.Size(74, 22);
     395      this.customizeEvaluationButton.TabIndex = 42;
     396      this.customizeEvaluationButton.Text = "Customize...";
     397      this.customizeEvaluationButton.UseVisualStyleBackColor = true;
     398      this.customizeEvaluationButton.Click += new System.EventHandler(this.viewEvaluationButton_Click);
     399      //
     400      // customizeMutationButton
     401      //
     402      this.customizeMutationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
     403      this.customizeMutationButton.Location = new System.Drawing.Point(360, 434);
     404      this.customizeMutationButton.Name = "customizeMutationButton";
     405      this.customizeMutationButton.Size = new System.Drawing.Size(74, 21);
     406      this.customizeMutationButton.TabIndex = 38;
     407      this.customizeMutationButton.Text = "Customize...";
     408      this.customizeMutationButton.UseVisualStyleBackColor = true;
     409      this.customizeMutationButton.Click += new System.EventHandler(this.viewMutationButton_Click);
     410      //
     411      // customizeSolutionGenerationButton
     412      //
     413      this.customizeSolutionGenerationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
     414      this.customizeSolutionGenerationButton.Location = new System.Drawing.Point(360, 380);
     415      this.customizeSolutionGenerationButton.Name = "customizeSolutionGenerationButton";
     416      this.customizeSolutionGenerationButton.Size = new System.Drawing.Size(74, 21);
     417      this.customizeSolutionGenerationButton.TabIndex = 34;
     418      this.customizeSolutionGenerationButton.Text = "Customize...";
     419      this.customizeSolutionGenerationButton.UseVisualStyleBackColor = true;
     420      this.customizeSolutionGenerationButton.Click += new System.EventHandler(this.viewSolutionGenerationButton_Click);
     421      //
     422      // customizeProblemInitializationButton
     423      //
     424      this.customizeProblemInitializationButton.Anchor = System.Windows.Forms.AnchorStyles.None;
     425      this.customizeProblemInitializationButton.Location = new System.Drawing.Point(360, 353);
     426      this.customizeProblemInitializationButton.Name = "customizeProblemInitializationButton";
     427      this.customizeProblemInitializationButton.Size = new System.Drawing.Size(74, 21);
     428      this.customizeProblemInitializationButton.TabIndex = 30;
     429      this.customizeProblemInitializationButton.Text = "Customize...";
     430      this.customizeProblemInitializationButton.UseVisualStyleBackColor = true;
     431      this.customizeProblemInitializationButton.Click += new System.EventHandler(this.viewProblemInitializationButton_Click);
    538432      //
    539433      // setRandomSeedRandomlyCheckBox
     
    569463      this.evaluationLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
    570464      this.evaluationLabel.AutoSize = true;
    571       this.evaluationLabel.Location = new System.Drawing.Point(6, 435);
     465      this.evaluationLabel.Location = new System.Drawing.Point(6, 410);
    572466      this.evaluationLabel.Name = "evaluationLabel";
    573467      this.evaluationLabel.Size = new System.Drawing.Size(60, 13);
     
    579473      this.mutationLabel.Anchor = System.Windows.Forms.AnchorStyles.None;
    580474      this.mutationLabel.AutoSize = true;
    581       this.mutationLabel.Location = new System.Drawing.Point(6, 409);
     475      this.mutationLabel.Location = new System.Drawing.Point(6, 437);
    582476      this.mutationLabel.Name = "mutationLabel";
    583477      this.mutationLabel.Size = new System.Drawing.Size(51, 13);
     
    830724      this.toolTip.InitialDelay = 200;
    831725      this.toolTip.ReshowDelay = 40;
     726      //
     727      // openOperatorLibraryButton
     728      //
     729      this.openOperatorLibraryButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     730      this.openOperatorLibraryButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     731      this.openOperatorLibraryButton.Image = global::HeuristicLab.ES.Properties.Resources.OpenProblem;
     732      this.openOperatorLibraryButton.Location = new System.Drawing.Point(464, 6);
     733      this.openOperatorLibraryButton.Name = "openOperatorLibraryButton";
     734      this.openOperatorLibraryButton.Size = new System.Drawing.Size(23, 23);
     735      this.openOperatorLibraryButton.TabIndex = 48;
     736      this.openOperatorLibraryButton.UseVisualStyleBackColor = true;
     737      this.openOperatorLibraryButton.Click += new System.EventHandler(this.openOperatorLibraryButton_Click);
     738      //
     739      // openOperatorLibraryFileDialog
     740      //
     741      this.openOperatorLibraryFileDialog.FileName = "OperatorLibrary";
     742      this.openOperatorLibraryFileDialog.Filter = "HL files|*.hl|All files|*.*";
     743      //
     744      // problemInitializationComboBox
     745      //
     746      this.problemInitializationComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
     747      this.problemInitializationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     748      this.problemInitializationComboBox.FormattingEnabled = true;
     749      this.problemInitializationComboBox.Items.AddRange(new object[] {
     750            "Set..."});
     751      this.problemInitializationComboBox.Location = new System.Drawing.Point(168, 353);
     752      this.problemInitializationComboBox.Name = "problemInitializationComboBox";
     753      this.problemInitializationComboBox.Size = new System.Drawing.Size(186, 21);
     754      this.problemInitializationComboBox.TabIndex = 49;
     755      this.problemInitializationComboBox.SelectedIndexChanged += new System.EventHandler(this.problemInitializationComboBox_SelectedIndexChanged);
     756      //
     757      // solutionGenerationComboBox
     758      //
     759      this.solutionGenerationComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
     760      this.solutionGenerationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     761      this.solutionGenerationComboBox.FormattingEnabled = true;
     762      this.solutionGenerationComboBox.Items.AddRange(new object[] {
     763            "Set..."});
     764      this.solutionGenerationComboBox.Location = new System.Drawing.Point(168, 380);
     765      this.solutionGenerationComboBox.Name = "solutionGenerationComboBox";
     766      this.solutionGenerationComboBox.Size = new System.Drawing.Size(186, 21);
     767      this.solutionGenerationComboBox.TabIndex = 50;
     768      this.solutionGenerationComboBox.SelectedIndexChanged += new System.EventHandler(this.solutionGenerationComboBox_SelectedIndexChanged);
     769      //
     770      // mutationComboBox
     771      //
     772      this.mutationComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
     773      this.mutationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     774      this.mutationComboBox.FormattingEnabled = true;
     775      this.mutationComboBox.Items.AddRange(new object[] {
     776            "Set..."});
     777      this.mutationComboBox.Location = new System.Drawing.Point(168, 434);
     778      this.mutationComboBox.Name = "mutationComboBox";
     779      this.mutationComboBox.Size = new System.Drawing.Size(186, 21);
     780      this.mutationComboBox.TabIndex = 51;
     781      this.mutationComboBox.SelectedIndexChanged += new System.EventHandler(this.mutationComboBox_SelectedIndexChanged);
     782      //
     783      // evaluationComboBox
     784      //
     785      this.evaluationComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
     786      this.evaluationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     787      this.evaluationComboBox.FormattingEnabled = true;
     788      this.evaluationComboBox.Items.AddRange(new object[] {
     789            "Set..."});
     790      this.evaluationComboBox.Location = new System.Drawing.Point(168, 407);
     791      this.evaluationComboBox.Name = "evaluationComboBox";
     792      this.evaluationComboBox.Size = new System.Drawing.Size(186, 21);
     793      this.evaluationComboBox.TabIndex = 52;
     794      this.evaluationComboBox.SelectedIndexChanged += new System.EventHandler(this.evaluationComboBox_SelectedIndexChanged);
     795      //
     796      // recombinationComboBox
     797      //
     798      this.recombinationComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
     799      this.recombinationComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     800      this.recombinationComboBox.FormattingEnabled = true;
     801      this.recombinationComboBox.Items.AddRange(new object[] {
     802            "Set..."});
     803      this.recombinationComboBox.Location = new System.Drawing.Point(168, 461);
     804      this.recombinationComboBox.Name = "recombinationComboBox";
     805      this.recombinationComboBox.Size = new System.Drawing.Size(186, 21);
     806      this.recombinationComboBox.TabIndex = 53;
     807      this.recombinationComboBox.SelectedIndexChanged += new System.EventHandler(this.recombinationComboBox_SelectedIndexChanged);
    832808      //
    833809      // ESEditor
     
    879855    private System.Windows.Forms.Label solutionGenerationLabel;
    880856    private System.Windows.Forms.Button cloneEngineButton;
    881     private System.Windows.Forms.TextBox mutationTextBox;
    882     private System.Windows.Forms.TextBox solutionGenerationTextBox;
    883     private System.Windows.Forms.TextBox problemInitializationTextBox;
    884     private System.Windows.Forms.TextBox evaluationTextBox;
    885     private System.Windows.Forms.Button setProblemInitializationButton;
    886     private System.Windows.Forms.Button setEvaluationButton;
    887     private System.Windows.Forms.Button setMutationButton;
    888     private System.Windows.Forms.Button setSolutionGenerationButton;
    889857    private HeuristicLab.Core.ScopeView scopeView;
    890     private System.Windows.Forms.Button viewEvaluationButton;
    891     private System.Windows.Forms.Button viewMutationButton;
    892     private System.Windows.Forms.Button viewSolutionGenerationButton;
    893     private System.Windows.Forms.Button viewProblemInitializationButton;
     858    private System.Windows.Forms.Button customizeEvaluationButton;
     859    private System.Windows.Forms.Button customizeMutationButton;
     860    private System.Windows.Forms.Button customizeSolutionGenerationButton;
     861    private System.Windows.Forms.Button customizeProblemInitializationButton;
    894862    private System.Windows.Forms.TextBox generalLearningRateTextBox;
    895863    private System.Windows.Forms.Label generalLearningRateLabel;
    896     private System.Windows.Forms.Button setRecombinationButton;
    897     private System.Windows.Forms.Button viewRecombinationButton;
    898     private System.Windows.Forms.TextBox recombinationTextBox;
     864    private System.Windows.Forms.Button customizeRecombinationButton;
    899865    private System.Windows.Forms.Label recombinationLabel;
    900866    private System.Windows.Forms.TextBox rhoTextBox;
     
    921887    private System.Windows.Forms.TextBox shakingFactorsUpperBoundTextBox;
    922888    private System.Windows.Forms.Label problemDimensionVariableNameLabel;
     889    private System.Windows.Forms.Button openOperatorLibraryButton;
     890    private System.Windows.Forms.OpenFileDialog openOperatorLibraryFileDialog;
     891    private System.Windows.Forms.ComboBox problemInitializationComboBox;
     892    private System.Windows.Forms.ComboBox recombinationComboBox;
     893    private System.Windows.Forms.ComboBox evaluationComboBox;
     894    private System.Windows.Forms.ComboBox mutationComboBox;
     895    private System.Windows.Forms.ComboBox solutionGenerationComboBox;
    923896  }
    924897}
  • trunk/sources/HeuristicLab.ES/3.2/ESEditor.cs

    r1529 r2052  
    3636  public partial class ESEditor : EditorBase {
    3737    private ChooseOperatorDialog chooseOperatorDialog;
     38    private OperatorLibrary operatorLibrary;
     39    private List<IOperator> problemInitializers;
     40    private int selectedProblemInitializer;
     41    private List<IOperator> solutionGenerators;
     42    private int selectedSolutionGenerator;
     43    private List<IOperator> mutators;
     44    private int selectedMutator;
     45    private List<IOperator> evaluators;
     46    private int selectedEvaluator;
     47    private List<IOperator> recombinators;
     48    private int selectedRecombinator;
    3849
    3950    /// <summary>
     
    5263    public ESEditor() {
    5364      InitializeComponent();
     65      problemInitializers = new List<IOperator>();
     66      selectedProblemInitializer = -1;
     67      solutionGenerators = new List<IOperator>();
     68      selectedSolutionGenerator = -1;
     69      mutators = new List<IOperator>();
     70      selectedMutator = -1;
     71      evaluators = new List<IOperator>();
     72      selectedEvaluator = -1;
     73      recombinators = new List<IOperator>();
     74      selectedRecombinator = -1;
    5475    }
    5576    /// <summary>
     
    6081      : this() {
    6182      ES = es;
     83    }
     84
     85    private int AddOperator(ComboBox comboBox, IOperator iOperator, List<IOperator> list) {
     86      for (int i = 0; i < comboBox.Items.Count - 1; i++) {
     87        if ((comboBox.Items[i] as string).CompareTo(iOperator.Name) > 0) {
     88          comboBox.Items.Insert(i, iOperator.Name);
     89          list.Insert(i, iOperator);
     90          return i;
     91        }
     92      }
     93      int index = comboBox.Items.Count - 1;
     94      comboBox.Items.Insert(index, iOperator.Name);
     95      list.Add(iOperator);
     96      return index;
     97    }
     98    private int SetOperator(ComboBox comboBox, IOperator iOperator, List<IOperator> list) {
     99      int index;
     100      if ((index = list.FindIndex(op => op.Name.Equals(iOperator.Name))) >= 0) {
     101        comboBox.Items.RemoveAt(index);
     102        list.RemoveAt(index);
     103        return AddOperator(comboBox, iOperator, list);
     104      } else return -1;
    62105    }
    63106
     
    106149      } else {
    107150        tabControl.Enabled = true;
    108         problemInitializationTextBox.Text = ES.ProblemInjector.GetType().Name;
    109         solutionGenerationTextBox.Text = ES.SolutionGenerator.GetType().Name;
    110         mutationTextBox.Text = ES.Mutator.GetType().Name;
    111         evaluationTextBox.Text = ES.Evaluator.GetType().Name;
    112         recombinationTextBox.Text = ES.Recombinator.GetType().Name;
     151        int index;
     152        if (!((index = problemInitializers.FindIndex(op => op.Name.Equals(ES.ProblemInjector.Name))) >= 0)) {
     153          index = AddOperator(problemInitializationComboBox, ES.ProblemInjector, problemInitializers);
     154          if (index <= selectedProblemInitializer) selectedProblemInitializer++;
     155        }
     156        problemInitializationComboBox.SelectedIndex = index;
     157        if (!((index = solutionGenerators.FindIndex(op => op.Name.Equals(ES.SolutionGenerator.Name))) >= 0)) {
     158          index = AddOperator(solutionGenerationComboBox, ES.SolutionGenerator, solutionGenerators);
     159          if (index <= selectedSolutionGenerator) selectedSolutionGenerator++;
     160        }
     161        solutionGenerationComboBox.SelectedIndex = index;
     162        if (!((index = evaluators.FindIndex(op => op.Name.Equals(ES.Evaluator.Name))) >= 0)) {
     163          index = AddOperator(evaluationComboBox, ES.Evaluator, evaluators);
     164          if (index <= selectedEvaluator) selectedEvaluator++;
     165        }
     166        evaluationComboBox.SelectedIndex = index;
     167        if (!((index = mutators.FindIndex(op => op.Name.Equals(ES.Mutator.Name))) >= 0)) {
     168          index = AddOperator(mutationComboBox, ES.Mutator, mutators);
     169          if (index <= selectedMutator) selectedMutator++;
     170        }
     171        mutationComboBox.SelectedIndex = index;
     172        if (!((index = recombinators.FindIndex(op => op.Name.Equals(ES.Recombinator.Name))) >= 0)) {
     173          index = AddOperator(recombinationComboBox, ES.Recombinator, recombinators);
     174          if (index <= selectedRecombinator) selectedRecombinator++;
     175        }
     176        recombinationComboBox.SelectedIndex = index;
    113177        plusRadioButton.Checked = ES.PlusNotation;
    114178        commaRadioButton.Checked = !ES.PlusNotation;
     
    157221    }
    158222    private void setProblemInitializationButton_Click(object sender, EventArgs e) {
    159       if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
    160       if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    161         ES.ProblemInjector = chooseOperatorDialog.Operator;
    162         problemInitializationTextBox.Text = ES.ProblemInjector.GetType().Name;
    163       }
    164     }
    165     private void setSolutionGenerationButton_Click(object sender, EventArgs e) {
    166       if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
    167       if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    168         ES.SolutionGenerator= chooseOperatorDialog.Operator;
    169         solutionGenerationTextBox.Text = ES.SolutionGenerator.GetType().Name;
    170       }
    171     }
    172     private void setMutationButton_Click(object sender, EventArgs e) {
    173       if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
    174       if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    175         ES.Mutator = chooseOperatorDialog.Operator;
    176         mutationTextBox.Text = ES.Mutator.GetType().Name;
    177       }
    178     }
    179     private void setEvaluationButton_Click(object sender, EventArgs e) {
    180       if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
    181       if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    182         ES.Evaluator = chooseOperatorDialog.Operator;
    183         evaluationTextBox.Text = ES.Evaluator.GetType().Name;
    184       }
    185     }
    186     private void setRecombinationButton_Click(object sender, EventArgs e) {
    187       if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
    188       if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    189         ES.Recombinator = chooseOperatorDialog.Operator;
    190         recombinationTextBox.Text = ES.Recombinator.GetType().Name;
    191       }
     223     
    192224    }
    193225    private void executeButton_Click(object sender, EventArgs e) {
     
    254286      }
    255287    }
     288
     289    private void openOperatorLibraryButton_Click(object sender, EventArgs e) {
     290      if (openOperatorLibraryFileDialog.ShowDialog() == DialogResult.OK) {
     291
     292        operatorLibrary = (PersistenceManager.Load(openOperatorLibraryFileDialog.FileName) as OperatorLibrary);
     293        if (operatorLibrary == null) {
     294          MessageBox.Show("The selected file is not an operator library");
     295          return;
     296        }
     297        foreach (IOperatorGroup topLevelGroup in operatorLibrary.Group.SubGroups) {
     298          if (topLevelGroup.Name.Equals("Problem")) {
     299            foreach (IOperatorGroup group in topLevelGroup.SubGroups) {
     300              if (group.Name.Equals("Initialization")) {
     301                foreach (IOperator op in group.Operators) {
     302                  int index = SetOperator(problemInitializationComboBox, (IOperator)op.Clone(), problemInitializers);
     303                  if (index < 0) {
     304                    index = AddOperator(problemInitializationComboBox, (IOperator)op.Clone(), problemInitializers);
     305                    if (index <= selectedProblemInitializer) selectedProblemInitializer++;
     306                  }
     307                }
     308              } else if (group.Name.Equals("Solution generation")) {
     309                foreach (IOperator op in group.Operators) {
     310                  int index = SetOperator(solutionGenerationComboBox, (IOperator)op.Clone(), solutionGenerators);
     311                  if (index < 0) {
     312                    index = AddOperator(solutionGenerationComboBox, (IOperator)op.Clone(), solutionGenerators);
     313                    if (index <= selectedSolutionGenerator) selectedSolutionGenerator++;
     314                  }
     315                }
     316              } else if (group.Name.Equals("Evaluation")) {
     317                foreach (IOperator op in group.Operators) {
     318                  int index = SetOperator(evaluationComboBox, (IOperator)op.Clone(), evaluators);
     319                  if (index < 0) {
     320                    index = AddOperator(evaluationComboBox, (IOperator)op.Clone(), evaluators);
     321                    if (index <= selectedEvaluator) selectedEvaluator++;
     322                  }
     323                }
     324              }
     325            }
     326          } else if (topLevelGroup.Name.Equals("ES")) {
     327            foreach (IOperatorGroup group in topLevelGroup.SubGroups) {
     328              if (group.Name.Equals("Mutation")) {
     329                foreach (IOperator op in group.Operators) {
     330                  int index = SetOperator(mutationComboBox, (IOperator)op.Clone(), mutators);
     331                  if (index < 0) {
     332                    index = AddOperator(mutationComboBox, (IOperator)op.Clone(), mutators);
     333                    if (index <= selectedMutator) selectedMutator++;
     334                  }
     335                }
     336              } else if (group.Name.Equals("Recombination")) {
     337                foreach (IOperator op in group.Operators) {
     338                  int index = SetOperator(recombinationComboBox, (IOperator)op.Clone(), recombinators);
     339                  if (index < 0) {
     340                    index = AddOperator(recombinationComboBox, (IOperator)op.Clone(), recombinators);
     341                    if (index <= selectedRecombinator) selectedRecombinator++;
     342                  }
     343                }
     344              }
     345            }
     346          }
     347        }
     348        problemInitializationComboBox.SelectedIndexChanged -= new EventHandler(problemInitializationComboBox_SelectedIndexChanged);
     349        problemInitializationComboBox.SelectedIndex = selectedProblemInitializer;
     350        problemInitializationComboBox.SelectedIndexChanged += new EventHandler(problemInitializationComboBox_SelectedIndexChanged);
     351        solutionGenerationComboBox.SelectedIndexChanged -= new EventHandler(solutionGenerationComboBox_SelectedIndexChanged);
     352        solutionGenerationComboBox.SelectedIndex = selectedSolutionGenerator;
     353        solutionGenerationComboBox.SelectedIndexChanged += new EventHandler(solutionGenerationComboBox_SelectedIndexChanged);
     354        evaluationComboBox.SelectedIndexChanged -= new EventHandler(evaluationComboBox_SelectedIndexChanged);
     355        evaluationComboBox.SelectedIndex = selectedEvaluator;
     356        evaluationComboBox.SelectedIndexChanged += new EventHandler(evaluationComboBox_SelectedIndexChanged);
     357        mutationComboBox.SelectedIndexChanged -= new EventHandler(mutationComboBox_SelectedIndexChanged);
     358        mutationComboBox.SelectedIndex = selectedMutator;
     359        mutationComboBox.SelectedIndexChanged += new EventHandler(mutationComboBox_SelectedIndexChanged);
     360        recombinationComboBox.SelectedIndexChanged -= new EventHandler(recombinationComboBox_SelectedIndexChanged);
     361        recombinationComboBox.SelectedIndex = selectedRecombinator;
     362        recombinationComboBox.SelectedIndexChanged += new EventHandler(recombinationComboBox_SelectedIndexChanged);
     363      }
     364    }
     365
     366    private void problemInitializationComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     367      int index = problemInitializationComboBox.SelectedIndex;
     368      if (index != selectedProblemInitializer) {
     369        if (index == problemInitializationComboBox.Items.Count - 1) {
     370          if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
     371          if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
     372            selectedProblemInitializer = -1;
     373            index = SetOperator(problemInitializationComboBox, chooseOperatorDialog.Operator, problemInitializers);
     374            if (index < 0) index = AddOperator(problemInitializationComboBox, chooseOperatorDialog.Operator, problemInitializers);
     375          } else {
     376            problemInitializationComboBox.SelectedIndex = selectedProblemInitializer;
     377            return;
     378          }
     379        }
     380        if (index >= 0) {
     381          ES.ProblemInjector = problemInitializers[index];
     382          selectedProblemInitializer = index;
     383          problemInitializationComboBox.SelectedIndex = index;
     384        }
     385      }
     386    }
     387
     388    private void solutionGenerationComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     389      int index = solutionGenerationComboBox.SelectedIndex;
     390      if (index != selectedSolutionGenerator) {
     391        if (index == solutionGenerationComboBox.Items.Count - 1) {
     392          if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
     393          if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
     394            selectedSolutionGenerator = -1;
     395            index = SetOperator(solutionGenerationComboBox, chooseOperatorDialog.Operator, solutionGenerators);
     396            if (index < 0) AddOperator(solutionGenerationComboBox, chooseOperatorDialog.Operator, solutionGenerators);
     397          } else {
     398            solutionGenerationComboBox.SelectedIndex = selectedSolutionGenerator;
     399            return;
     400          }
     401        }
     402        if (index >= 0) {
     403          ES.SolutionGenerator = solutionGenerators[index];
     404          selectedSolutionGenerator = index;
     405          solutionGenerationComboBox.SelectedIndex = selectedSolutionGenerator;
     406        }
     407      }
     408    }
     409
     410    private void evaluationComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     411      int index = evaluationComboBox.SelectedIndex;
     412      if (index != selectedEvaluator) {
     413        if (index == evaluationComboBox.Items.Count - 1) {
     414          if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
     415          if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
     416            selectedEvaluator = -1;
     417            index = SetOperator(evaluationComboBox, chooseOperatorDialog.Operator, evaluators);
     418            if (index < 0) index = AddOperator(evaluationComboBox, chooseOperatorDialog.Operator, evaluators);
     419          } else {
     420            evaluationComboBox.SelectedIndex = selectedEvaluator;
     421            return;
     422          }
     423        }
     424        if (index >= 0) {
     425          ES.Evaluator = evaluators[index];
     426          selectedEvaluator = index;
     427          evaluationComboBox.SelectedIndex = index;
     428        }
     429      }
     430    }
     431
     432    private void mutationComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     433      int index = mutationComboBox.SelectedIndex;
     434      if (index != selectedMutator) {
     435        if (index == mutationComboBox.Items.Count - 1) {
     436          if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
     437          if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
     438            selectedMutator = -1;
     439            index = SetOperator(mutationComboBox, chooseOperatorDialog.Operator, mutators);
     440            if (index < 0) index = AddOperator(mutationComboBox, chooseOperatorDialog.Operator, mutators);
     441          } else {
     442            mutationComboBox.SelectedIndex = selectedMutator;
     443            return;
     444          }
     445        }
     446        if (index >= 0) {
     447          ES.Mutator = mutators[index];
     448          selectedMutator = index;
     449          mutationComboBox.SelectedIndex = index;
     450        }
     451      }
     452    }
     453
     454    private void recombinationComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     455      int index = recombinationComboBox.SelectedIndex;
     456      if (index != selectedRecombinator) {
     457        if (index == recombinationComboBox.Items.Count - 1) {
     458          if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
     459          if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
     460            selectedRecombinator = -1;
     461            index = SetOperator(recombinationComboBox, chooseOperatorDialog.Operator, recombinators);
     462            if (index < 0) index = AddOperator(recombinationComboBox, chooseOperatorDialog.Operator, recombinators);
     463          } else {
     464            recombinationComboBox.SelectedIndex = selectedRecombinator;
     465            return;
     466          }
     467        }
     468        if (index >= 0) {
     469          ES.Recombinator = recombinators[index];
     470          selectedRecombinator = index;
     471          recombinationComboBox.SelectedIndex = index;
     472        }
     473      }
     474    }
    256475  }
    257476}
  • trunk/sources/HeuristicLab.ES/3.2/ESEditor.resx

    r1529 r2052  
    131131Use the colon ; to separate two numbers.</value>
    132132  </data>
     133  <metadata name="openOperatorLibraryFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     134    <value>97, 3</value>
     135  </metadata>
    133136  <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
    134137    <value>26</value>
  • trunk/sources/HeuristicLab.ES/3.2/HeuristicLab.ES-3.2.csproj

    r1534 r2052  
    9595    </Compile>
    9696    <Compile Include="Properties\AssemblyInfo.cs" />
     97    <Compile Include="Properties\Resources.Designer.cs">
     98      <AutoGen>True</AutoGen>
     99      <DesignTime>True</DesignTime>
     100      <DependentUpon>Resources.resx</DependentUpon>
     101    </Compile>
    97102    <Compile Include="SelfAdaptiveMutationStrengthAdjuster.cs" />
    98103    <Compile Include="VariableStrengthRepeatingManipulator.cs" />
     
    106111      <Project>{F473D9AF-3F09-4296-9F28-3C65118DAFFA}</Project>
    107112      <Name>HeuristicLab.Data-3.2</Name>
     113    </ProjectReference>
     114    <ProjectReference Include="..\..\HeuristicLab.Evolutionary\3.2\HeuristicLab.Evolutionary-3.2.csproj">
     115      <Project>{F5614C53-153C-4A37-A608-121E1C087F07}</Project>
     116      <Name>HeuristicLab.Evolutionary-3.2</Name>
    108117    </ProjectReference>
    109118    <ProjectReference Include="..\..\HeuristicLab.Logging\3.2\HeuristicLab.Logging-3.2.csproj">
     
    145154      <SubType>Designer</SubType>
    146155    </EmbeddedResource>
     156    <EmbeddedResource Include="Properties\Resources.resx">
     157      <Generator>ResXFileCodeGenerator</Generator>
     158      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     159    </EmbeddedResource>
     160  </ItemGroup>
     161  <ItemGroup>
     162    <None Include="Resources\OpenProblem.gif" />
    147163  </ItemGroup>
    148164  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
Note: See TracChangeset for help on using the changeset viewer.