Free cookie consent management tool by TermsFeed Policy Generator

Changeset 65


Ignore:
Timestamp:
03/14/08 01:05:05 (17 years ago)
Author:
swagner
Message:

Fixed ticket #52

  • adapted plugin HeuristicLab.SGA according to changes in CombinedOperator, OperatorExtractor and ItemList
Location:
trunk/sources/HeuristicLab.SGA
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.SGA/SGA.cs

    r2 r65  
    5656      sp.AddSubOperator(co1);
    5757
    58       // place holder for Problem Initializer
     58      // place holder for ProblemInjector
    5959      EmptyOperator eo1 = new EmptyOperator();
     60      eo1.Name = "ProblemInjector";
    6061      op.OperatorGraph.AddOperator(eo1);
    6162      co1.AddSubOperator(eo1);
     
    6667      sp.AddSubOperator(co2);
    6768
    68       // place holder for Solution Generator
     69      // place holder for SolutionGenerator
    6970      EmptyOperator eo2 = new EmptyOperator();
     71      eo2.Name = "SolutionGenerator";
    7072      op.OperatorGraph.AddOperator(eo2);
    7173      co2.AddSubOperator(eo2);
     
    7375      // place holder for Evaluator
    7476      EmptyOperator eo3 = new EmptyOperator();
     77      eo3.Name = "Evaluator";
    7578      op.OperatorGraph.AddOperator(eo3);
    7679      co2.AddSubOperator(eo3);
     
    8386      // place holder for Selector
    8487      EmptyOperator eo4 = new EmptyOperator();
     88      eo4.Name = "Selector";
    8589      op.OperatorGraph.AddOperator(eo4);
    8690      co3.AddSubOperator(eo4);
     
    8892      // place holder for Crossover
    8993      EmptyOperator eo5 = new EmptyOperator();
     94      eo5.Name = "Crossover";
    9095      op.OperatorGraph.AddOperator(eo5);
    9196      co3.AddSubOperator(eo5);
     
    9398      // place holder for Mutator
    9499      EmptyOperator eo6 = new EmptyOperator();
     100      eo6.Name = "Mutator";
    95101      op.OperatorGraph.AddOperator(eo6);
    96102      co3.AddSubOperator(eo6);
     
    112118
    113119      OperatorExtractor oe = new OperatorExtractor();
    114       oe.Name = "Problem Initializer";
    115       oe.GetVariable("Name").GetValue<StringData>().Data = "ProblemInitializer";
     120      oe.Name = "ProblemInjector";
     121      oe.GetVariableInfo("Operator").ActualName = "ProblemInjector";
    116122      op.OperatorGraph.AddOperator(oe);
    117123      sp.AddSubOperator(oe);
     
    128134      sp.AddSubOperator(vi);
    129135
    130       op.GetVariable("InjectSubOperators").GetValue<BoolData>().Data = true;
    131       op.GetVariable("SubOperatorNames").GetValue<ItemList>().Add(new StringData("ProblemInitializer"));
    132 
    133136      return op;
    134137    }
     
    153156
    154157      OperatorExtractor oe1 = new OperatorExtractor();
    155       oe1.Name = "Solution Generator";
    156       oe1.GetVariable("Name").GetValue<StringData>().Data = "SolutionGenerator";
     158      oe1.Name = "SolutionGenerator";
     159      oe1.GetVariableInfo("Operator").ActualName = "SolutionGenerator";
    157160      op.OperatorGraph.AddOperator(oe1);
    158161      sp2.AddSubOperator(oe1);
     
    160163      OperatorExtractor oe2 = new OperatorExtractor();
    161164      oe2.Name = "Evaluator";
    162       oe2.GetVariable("Name").GetValue<StringData>().Data = "Evaluator";
     165      oe2.GetVariableInfo("Operator").ActualName = "Evaluator";
    163166      op.OperatorGraph.AddOperator(oe2);
    164167      sp2.AddSubOperator(oe2);
     
    175178      sp1.AddSubOperator(s);
    176179
    177       op.GetVariable("InjectSubOperators").GetValue<BoolData>().Data = true;
    178       op.GetVariable("SubOperatorNames").GetValue<ItemList>().Add(new StringData("SolutionGenerator"));
    179       op.GetVariable("SubOperatorNames").GetValue<ItemList>().Add(new StringData("Evaluator"));
    180 
    181180      return op;
    182181    }
     
    189188      OperatorExtractor oe = new OperatorExtractor();
    190189      oe.Name = "Selector";
    191       oe.GetVariable("Name").GetValue<StringData>().Data = "Selector";
     190      oe.GetVariableInfo("Operator").ActualName = "Selector";
    192191      op.OperatorGraph.AddOperator(oe);
    193192      sp.AddSubOperator(oe);
     
    220219
    221220      DataCollector dc = new DataCollector();
    222       ItemList names = dc.GetVariable("VariableNames").GetValue<ItemList>();
     221      ItemList<StringData> names = dc.GetVariable("VariableNames").GetValue<ItemList<StringData>>();
    223222      names.Add(new StringData("BestQuality"));
    224223      names.Add(new StringData("AverageQuality"));
     
    252251      cb.AddSubOperator(sp);
    253252
    254       op.GetVariable("InjectSubOperators").GetValue<BoolData>().Data = true;
    255       op.GetVariable("SubOperatorNames").GetValue<ItemList>().Add(new StringData("Selector"));
    256       op.GetVariable("SubOperatorNames").GetValue<ItemList>().Add(new StringData("Crossover"));
    257       op.GetVariable("SubOperatorNames").GetValue<ItemList>().Add(new StringData("Mutator"));
    258       op.GetVariable("SubOperatorNames").GetValue<ItemList>().Add(new StringData("Evaluator"));
    259 
    260253      return op;
    261254    }
     
    268261      OperatorExtractor oe1 = new OperatorExtractor();
    269262      oe1.Name = "Crossover";
    270       oe1.GetVariable("Name").GetValue<StringData>().Data = "Crossover";
     263      oe1.GetVariableInfo("Operator").ActualName = "Crossover";
    271264      op.OperatorGraph.AddOperator(oe1);
    272265      sp1.AddSubOperator(oe1);
     
    287280      OperatorExtractor oe2 = new OperatorExtractor();
    288281      oe2.Name = "Mutator";
    289       oe2.GetVariable("Name").GetValue<StringData>().Data = "Mutator";
     282      oe2.GetVariableInfo("Operator").ActualName = "Mutator";
    290283      op.OperatorGraph.AddOperator(oe2);
    291284      hb.AddSubOperator(oe2);
     
    293286      OperatorExtractor oe3 = new OperatorExtractor();
    294287      oe3.Name = "Evaluator";
    295       oe3.GetVariable("Name").GetValue<StringData>().Data = "Evaluator";
     288      oe3.GetVariableInfo("Operator").ActualName = "Evaluator";
    296289      op.OperatorGraph.AddOperator(oe3);
    297290      sp2.AddSubOperator(oe3);
     
    401394    private CombinedOperator mySGA;
    402395    private IOperator myVariableInjection;
    403     public IOperator ProblemInitializer {
     396    public IOperator ProblemInjector {
    404397      get { return myVariableInjection.SubOperators[0]; }
    405398      set {
    406         mySGA.OperatorGraph.RemoveOperator(ProblemInitializer.Guid);
     399        value.Name = "ProblemInjector";
     400        mySGA.OperatorGraph.RemoveOperator(ProblemInjector.Guid);
    407401        mySGA.OperatorGraph.AddOperator(value);
    408402        myVariableInjection.AddSubOperator(value, 0);
     
    413407      get { return myPopulationInitialization.SubOperators[0]; }
    414408      set {
     409        value.Name = "SolutionGenerator";
    415410        mySGA.OperatorGraph.RemoveOperator(SolutionGenerator.Guid);
    416411        mySGA.OperatorGraph.AddOperator(value);
     
    421416      get { return myPopulationInitialization.SubOperators[1]; }
    422417      set {
     418        value.Name = "Evaluator";
    423419        mySGA.OperatorGraph.RemoveOperator(Evaluator.Guid);
    424420        mySGA.OperatorGraph.AddOperator(value);
     
    431427      get { return mySGAMain.SubOperators[0]; }
    432428      set {
     429        value.Name = "Selector";
    433430        mySGA.OperatorGraph.RemoveOperator(Selector.Guid);
    434431        mySGA.OperatorGraph.AddOperator(value);
     
    439436      get { return mySGAMain.SubOperators[1]; }
    440437      set {
     438        value.Name = "Crossover";
    441439        mySGA.OperatorGraph.RemoveOperator(Crossover.Guid);
    442440        mySGA.OperatorGraph.AddOperator(value);
     
    447445      get { return mySGAMain.SubOperators[2]; }
    448446      set {
     447        value.Name = "Mutator";
    449448        mySGA.OperatorGraph.RemoveOperator(Mutator.Guid);
    450449        mySGA.OperatorGraph.AddOperator(value);
  • trunk/sources/HeuristicLab.SGA/SGAEditor.cs

    r2 r65  
    6767      } else {
    6868        tabControl.Enabled = true;
    69         problemInitializationTextBox.Text = SGA.ProblemInitializer.Name;
    70         solutionGenerationTextBox.Text = SGA.SolutionGenerator.Name;
    71         selectionTextBox.Text = SGA.Selector.Name;
    72         crossoverTextBox.Text = SGA.Crossover.Name;
    73         mutationTextBox.Text = SGA.Mutator.Name;
    74         evaluationTextBox.Text = SGA.Evaluator.Name;
     69        problemInitializationTextBox.Text = SGA.ProblemInjector.GetType().Name;
     70        solutionGenerationTextBox.Text = SGA.SolutionGenerator.GetType().Name;
     71        selectionTextBox.Text = SGA.Selector.GetType().Name;
     72        crossoverTextBox.Text = SGA.Crossover.GetType().Name;
     73        mutationTextBox.Text = SGA.Mutator.GetType().Name;
     74        evaluationTextBox.Text = SGA.Evaluator.GetType().Name;
    7575      }
    7676    }
     
    8787    #region Button Events
    8888    private void viewProblemInitializationButton_Click(object sender, EventArgs e) {
    89       IView view = SGA.ProblemInitializer.CreateView();
     89      IView view = SGA.ProblemInjector.CreateView();
    9090      if (view != null)
    9191        PluginManager.ControlManager.ShowControl(view);
     
    119119      if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog();
    120120      if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    121         SGA.ProblemInitializer = chooseOperatorDialog.Operator;
    122         problemInitializationTextBox.Text = SGA.ProblemInitializer.Name;
     121        SGA.ProblemInjector = chooseOperatorDialog.Operator;
     122        problemInitializationTextBox.Text = SGA.ProblemInjector.GetType().Name;
    123123      }
    124124    }
     
    127127      if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    128128        SGA.SolutionGenerator= chooseOperatorDialog.Operator;
    129         solutionGenerationTextBox.Text = SGA.SolutionGenerator.Name;
     129        solutionGenerationTextBox.Text = SGA.SolutionGenerator.GetType().Name;
    130130      }
    131131    }
     
    134134      if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    135135        SGA.Selector = chooseOperatorDialog.Operator;
    136         selectionTextBox.Text = SGA.Selector.Name;
     136        selectionTextBox.Text = SGA.Selector.GetType().Name;
    137137      }
    138138    }
     
    141141      if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    142142        SGA.Crossover = chooseOperatorDialog.Operator;
    143         crossoverTextBox.Text = SGA.Crossover.Name;
     143        crossoverTextBox.Text = SGA.Crossover.GetType().Name;
    144144      }
    145145    }
     
    148148      if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    149149        SGA.Mutator = chooseOperatorDialog.Operator;
    150         mutationTextBox.Text = SGA.Mutator.Name;
     150        mutationTextBox.Text = SGA.Mutator.GetType().Name;
    151151      }
    152152    }
     
    155155      if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) {
    156156        SGA.Evaluator = chooseOperatorDialog.Operator;
    157         evaluationTextBox.Text = SGA.Evaluator.Name;
     157        evaluationTextBox.Text = SGA.Evaluator.GetType().Name;
    158158      }
    159159    }
Note: See TracChangeset for help on using the changeset viewer.