Changeset 65
- Timestamp:
- 03/14/08 01:05:05 (17 years ago)
- Location:
- trunk/sources/HeuristicLab.SGA
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.SGA/SGA.cs
r2 r65 56 56 sp.AddSubOperator(co1); 57 57 58 // place holder for Problem Initializer58 // place holder for ProblemInjector 59 59 EmptyOperator eo1 = new EmptyOperator(); 60 eo1.Name = "ProblemInjector"; 60 61 op.OperatorGraph.AddOperator(eo1); 61 62 co1.AddSubOperator(eo1); … … 66 67 sp.AddSubOperator(co2); 67 68 68 // place holder for Solution 69 // place holder for SolutionGenerator 69 70 EmptyOperator eo2 = new EmptyOperator(); 71 eo2.Name = "SolutionGenerator"; 70 72 op.OperatorGraph.AddOperator(eo2); 71 73 co2.AddSubOperator(eo2); … … 73 75 // place holder for Evaluator 74 76 EmptyOperator eo3 = new EmptyOperator(); 77 eo3.Name = "Evaluator"; 75 78 op.OperatorGraph.AddOperator(eo3); 76 79 co2.AddSubOperator(eo3); … … 83 86 // place holder for Selector 84 87 EmptyOperator eo4 = new EmptyOperator(); 88 eo4.Name = "Selector"; 85 89 op.OperatorGraph.AddOperator(eo4); 86 90 co3.AddSubOperator(eo4); … … 88 92 // place holder for Crossover 89 93 EmptyOperator eo5 = new EmptyOperator(); 94 eo5.Name = "Crossover"; 90 95 op.OperatorGraph.AddOperator(eo5); 91 96 co3.AddSubOperator(eo5); … … 93 98 // place holder for Mutator 94 99 EmptyOperator eo6 = new EmptyOperator(); 100 eo6.Name = "Mutator"; 95 101 op.OperatorGraph.AddOperator(eo6); 96 102 co3.AddSubOperator(eo6); … … 112 118 113 119 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"; 116 122 op.OperatorGraph.AddOperator(oe); 117 123 sp.AddSubOperator(oe); … … 128 134 sp.AddSubOperator(vi); 129 135 130 op.GetVariable("InjectSubOperators").GetValue<BoolData>().Data = true;131 op.GetVariable("SubOperatorNames").GetValue<ItemList>().Add(new StringData("ProblemInitializer"));132 133 136 return op; 134 137 } … … 153 156 154 157 OperatorExtractor oe1 = new OperatorExtractor(); 155 oe1.Name = "Solution 156 oe1.GetVariable ("Name").GetValue<StringData>().Data= "SolutionGenerator";158 oe1.Name = "SolutionGenerator"; 159 oe1.GetVariableInfo("Operator").ActualName = "SolutionGenerator"; 157 160 op.OperatorGraph.AddOperator(oe1); 158 161 sp2.AddSubOperator(oe1); … … 160 163 OperatorExtractor oe2 = new OperatorExtractor(); 161 164 oe2.Name = "Evaluator"; 162 oe2.GetVariable ("Name").GetValue<StringData>().Data= "Evaluator";165 oe2.GetVariableInfo("Operator").ActualName = "Evaluator"; 163 166 op.OperatorGraph.AddOperator(oe2); 164 167 sp2.AddSubOperator(oe2); … … 175 178 sp1.AddSubOperator(s); 176 179 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 181 180 return op; 182 181 } … … 189 188 OperatorExtractor oe = new OperatorExtractor(); 190 189 oe.Name = "Selector"; 191 oe.GetVariable ("Name").GetValue<StringData>().Data= "Selector";190 oe.GetVariableInfo("Operator").ActualName = "Selector"; 192 191 op.OperatorGraph.AddOperator(oe); 193 192 sp.AddSubOperator(oe); … … 220 219 221 220 DataCollector dc = new DataCollector(); 222 ItemList names = dc.GetVariable("VariableNames").GetValue<ItemList>();221 ItemList<StringData> names = dc.GetVariable("VariableNames").GetValue<ItemList<StringData>>(); 223 222 names.Add(new StringData("BestQuality")); 224 223 names.Add(new StringData("AverageQuality")); … … 252 251 cb.AddSubOperator(sp); 253 252 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 260 253 return op; 261 254 } … … 268 261 OperatorExtractor oe1 = new OperatorExtractor(); 269 262 oe1.Name = "Crossover"; 270 oe1.GetVariable ("Name").GetValue<StringData>().Data= "Crossover";263 oe1.GetVariableInfo("Operator").ActualName = "Crossover"; 271 264 op.OperatorGraph.AddOperator(oe1); 272 265 sp1.AddSubOperator(oe1); … … 287 280 OperatorExtractor oe2 = new OperatorExtractor(); 288 281 oe2.Name = "Mutator"; 289 oe2.GetVariable ("Name").GetValue<StringData>().Data= "Mutator";282 oe2.GetVariableInfo("Operator").ActualName = "Mutator"; 290 283 op.OperatorGraph.AddOperator(oe2); 291 284 hb.AddSubOperator(oe2); … … 293 286 OperatorExtractor oe3 = new OperatorExtractor(); 294 287 oe3.Name = "Evaluator"; 295 oe3.GetVariable ("Name").GetValue<StringData>().Data= "Evaluator";288 oe3.GetVariableInfo("Operator").ActualName = "Evaluator"; 296 289 op.OperatorGraph.AddOperator(oe3); 297 290 sp2.AddSubOperator(oe3); … … 401 394 private CombinedOperator mySGA; 402 395 private IOperator myVariableInjection; 403 public IOperator ProblemIn itializer {396 public IOperator ProblemInjector { 404 397 get { return myVariableInjection.SubOperators[0]; } 405 398 set { 406 mySGA.OperatorGraph.RemoveOperator(ProblemInitializer.Guid); 399 value.Name = "ProblemInjector"; 400 mySGA.OperatorGraph.RemoveOperator(ProblemInjector.Guid); 407 401 mySGA.OperatorGraph.AddOperator(value); 408 402 myVariableInjection.AddSubOperator(value, 0); … … 413 407 get { return myPopulationInitialization.SubOperators[0]; } 414 408 set { 409 value.Name = "SolutionGenerator"; 415 410 mySGA.OperatorGraph.RemoveOperator(SolutionGenerator.Guid); 416 411 mySGA.OperatorGraph.AddOperator(value); … … 421 416 get { return myPopulationInitialization.SubOperators[1]; } 422 417 set { 418 value.Name = "Evaluator"; 423 419 mySGA.OperatorGraph.RemoveOperator(Evaluator.Guid); 424 420 mySGA.OperatorGraph.AddOperator(value); … … 431 427 get { return mySGAMain.SubOperators[0]; } 432 428 set { 429 value.Name = "Selector"; 433 430 mySGA.OperatorGraph.RemoveOperator(Selector.Guid); 434 431 mySGA.OperatorGraph.AddOperator(value); … … 439 436 get { return mySGAMain.SubOperators[1]; } 440 437 set { 438 value.Name = "Crossover"; 441 439 mySGA.OperatorGraph.RemoveOperator(Crossover.Guid); 442 440 mySGA.OperatorGraph.AddOperator(value); … … 447 445 get { return mySGAMain.SubOperators[2]; } 448 446 set { 447 value.Name = "Mutator"; 449 448 mySGA.OperatorGraph.RemoveOperator(Mutator.Guid); 450 449 mySGA.OperatorGraph.AddOperator(value); -
trunk/sources/HeuristicLab.SGA/SGAEditor.cs
r2 r65 67 67 } else { 68 68 tabControl.Enabled = true; 69 problemInitializationTextBox.Text = SGA.ProblemIn itializer.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; 75 75 } 76 76 } … … 87 87 #region Button Events 88 88 private void viewProblemInitializationButton_Click(object sender, EventArgs e) { 89 IView view = SGA.ProblemIn itializer.CreateView();89 IView view = SGA.ProblemInjector.CreateView(); 90 90 if (view != null) 91 91 PluginManager.ControlManager.ShowControl(view); … … 119 119 if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog(); 120 120 if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) { 121 SGA.ProblemIn itializer = chooseOperatorDialog.Operator;122 problemInitializationTextBox.Text = SGA.ProblemIn itializer.Name;121 SGA.ProblemInjector = chooseOperatorDialog.Operator; 122 problemInitializationTextBox.Text = SGA.ProblemInjector.GetType().Name; 123 123 } 124 124 } … … 127 127 if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) { 128 128 SGA.SolutionGenerator= chooseOperatorDialog.Operator; 129 solutionGenerationTextBox.Text = SGA.SolutionGenerator. Name;129 solutionGenerationTextBox.Text = SGA.SolutionGenerator.GetType().Name; 130 130 } 131 131 } … … 134 134 if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) { 135 135 SGA.Selector = chooseOperatorDialog.Operator; 136 selectionTextBox.Text = SGA.Selector. Name;136 selectionTextBox.Text = SGA.Selector.GetType().Name; 137 137 } 138 138 } … … 141 141 if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) { 142 142 SGA.Crossover = chooseOperatorDialog.Operator; 143 crossoverTextBox.Text = SGA.Crossover. Name;143 crossoverTextBox.Text = SGA.Crossover.GetType().Name; 144 144 } 145 145 } … … 148 148 if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) { 149 149 SGA.Mutator = chooseOperatorDialog.Operator; 150 mutationTextBox.Text = SGA.Mutator. Name;150 mutationTextBox.Text = SGA.Mutator.GetType().Name; 151 151 } 152 152 } … … 155 155 if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) { 156 156 SGA.Evaluator = chooseOperatorDialog.Operator; 157 evaluationTextBox.Text = SGA.Evaluator. Name;157 evaluationTextBox.Text = SGA.Evaluator.GetType().Name; 158 158 } 159 159 }
Note: See TracChangeset
for help on using the changeset viewer.