- Timestamp:
- 02/04/09 22:44:07 (15 years ago)
- Location:
- branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/HeuristicLab.GP.StructureIdentification.csproj
r1052 r1201 72 72 <Compile Include="Constant.cs" /> 73 73 <Compile Include="FunctionLibraryInjector.cs" /> 74 <Compile Include="OffspringSelectionGP.cs" /> 75 <Compile Include="OffSpringSelectionGpEditor.cs"> 76 <SubType>UserControl</SubType> 77 </Compile> 78 <Compile Include="OffSpringSelectionGpEditor.Designer.cs"> 79 <DependentUpon>OffSpringSelectionGpEditor.cs</DependentUpon> 80 </Compile> 74 81 <Compile Include="StandardGpEditor.cs"> 75 82 <SubType>UserControl</SubType> … … 161 168 <Name>HeuristicLab.Random</Name> 162 169 </ProjectReference> 170 <ProjectReference Include="..\HeuristicLab.Selection.OffspringSelection\HeuristicLab.Selection.OffspringSelection.csproj"> 171 <Project>{205898D3-2717-4686-AF17-52409B7EC0C6}</Project> 172 <Name>HeuristicLab.Selection.OffspringSelection</Name> 173 </ProjectReference> 163 174 <ProjectReference Include="..\HeuristicLab.Selection\HeuristicLab.Selection.csproj"> 164 175 <Project>{F7CF0571-25CB-43D5-8443-0843A1E2861A}</Project> … … 171 182 </ItemGroup> 172 183 <ItemGroup> 184 <EmbeddedResource Include="OffSpringSelectionGpEditor.resx"> 185 <DependentUpon>OffSpringSelectionGpEditor.cs</DependentUpon> 186 </EmbeddedResource> 173 187 <EmbeddedResource Include="StandardGpEditor.resx"> 174 188 <DependentUpon>StandardGpEditor.cs</DependentUpon> -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/OffSpringSelectionGpEditor.Designer.cs
r1156 r1201 70 70 this.resetButton = new System.Windows.Forms.Button(); 71 71 this.cloneEngineButton = new System.Windows.Forms.Button(); 72 this.selectionPressureTextBox = new System.Windows.Forms.TextBox(); 73 this.selectionPressureLabel = new System.Windows.Forms.Label(); 72 74 this.tabControl.SuspendLayout(); 73 75 this.parametersTabPage.SuspendLayout(); … … 101 103 // parametersTabPage 102 104 // 105 this.parametersTabPage.Controls.Add(this.selectionPressureTextBox); 106 this.parametersTabPage.Controls.Add(this.selectionPressureLabel); 103 107 this.parametersTabPage.Controls.Add(this.viewProblemInitializationButton); 104 108 this.parametersTabPage.Controls.Add(this.setProblemInitializationButton); … … 128 132 // 129 133 this.viewProblemInitializationButton.Anchor = System.Windows.Forms.AnchorStyles.None; 130 this.viewProblemInitializationButton.Location = new System.Drawing.Point(410, 2 08);134 this.viewProblemInitializationButton.Location = new System.Drawing.Point(410, 241); 131 135 this.viewProblemInitializationButton.Name = "viewProblemInitializationButton"; 132 136 this.viewProblemInitializationButton.Size = new System.Drawing.Size(53, 20); … … 139 143 // 140 144 this.setProblemInitializationButton.Anchor = System.Windows.Forms.AnchorStyles.None; 141 this.setProblemInitializationButton.Location = new System.Drawing.Point(469, 2 08);145 this.setProblemInitializationButton.Location = new System.Drawing.Point(469, 241); 142 146 this.setProblemInitializationButton.Name = "setProblemInitializationButton"; 143 147 this.setProblemInitializationButton.Size = new System.Drawing.Size(43, 20); … … 150 154 // 151 155 this.problemInitializationTextBox.Anchor = System.Windows.Forms.AnchorStyles.None; 152 this.problemInitializationTextBox.Location = new System.Drawing.Point(218, 2 08);156 this.problemInitializationTextBox.Location = new System.Drawing.Point(218, 241); 153 157 this.problemInitializationTextBox.Name = "problemInitializationTextBox"; 154 158 this.problemInitializationTextBox.ReadOnly = true; … … 169 173 // 170 174 this.elitesTextBox.Anchor = System.Windows.Forms.AnchorStyles.None; 171 this.elitesTextBox.Location = new System.Drawing.Point(218, 1 56);175 this.elitesTextBox.Location = new System.Drawing.Point(218, 182); 172 176 this.elitesTextBox.Name = "elitesTextBox"; 173 177 this.elitesTextBox.Size = new System.Drawing.Size(186, 20); … … 178 182 this.problemInitializationLabel.Anchor = System.Windows.Forms.AnchorStyles.None; 179 183 this.problemInitializationLabel.AutoSize = true; 180 this.problemInitializationLabel.Location = new System.Drawing.Point(65, 2 11);184 this.problemInitializationLabel.Location = new System.Drawing.Point(65, 244); 181 185 this.problemInitializationLabel.Name = "problemInitializationLabel"; 182 186 this.problemInitializationLabel.Size = new System.Drawing.Size(105, 13); … … 188 192 this.elitesLabel.Anchor = System.Windows.Forms.AnchorStyles.None; 189 193 this.elitesLabel.AutoSize = true; 190 this.elitesLabel.Location = new System.Drawing.Point(6 5, 159);194 this.elitesLabel.Location = new System.Drawing.Point(66, 185); 191 195 this.elitesLabel.Name = "elitesLabel"; 192 196 this.elitesLabel.Size = new System.Drawing.Size(35, 13); … … 197 201 // 198 202 this.mutationRateTextBox.Anchor = System.Windows.Forms.AnchorStyles.None; 199 this.mutationRateTextBox.Location = new System.Drawing.Point(218, 1 30);203 this.mutationRateTextBox.Location = new System.Drawing.Point(218, 156); 200 204 this.mutationRateTextBox.Name = "mutationRateTextBox"; 201 205 this.mutationRateTextBox.Size = new System.Drawing.Size(186, 20); … … 206 210 this.mutationRateLabel.Anchor = System.Windows.Forms.AnchorStyles.None; 207 211 this.mutationRateLabel.AutoSize = true; 208 this.mutationRateLabel.Location = new System.Drawing.Point(6 5, 133);212 this.mutationRateLabel.Location = new System.Drawing.Point(66, 159); 209 213 this.mutationRateLabel.Name = "mutationRateLabel"; 210 214 this.mutationRateLabel.Size = new System.Drawing.Size(77, 13); … … 331 335 this.cloneEngineButton.Click += new System.EventHandler(this.cloneEngineButton_Click); 332 336 // 333 // StandardGpEditor 337 // selectionPressureTextBox 338 // 339 this.selectionPressureTextBox.Anchor = System.Windows.Forms.AnchorStyles.None; 340 this.selectionPressureTextBox.Location = new System.Drawing.Point(218, 130); 341 this.selectionPressureTextBox.Name = "selectionPressureTextBox"; 342 this.selectionPressureTextBox.Size = new System.Drawing.Size(186, 20); 343 this.selectionPressureTextBox.TabIndex = 17; 344 // 345 // selectionPressureLabel 346 // 347 this.selectionPressureLabel.Anchor = System.Windows.Forms.AnchorStyles.None; 348 this.selectionPressureLabel.AutoSize = true; 349 this.selectionPressureLabel.Location = new System.Drawing.Point(65, 133); 350 this.selectionPressureLabel.Name = "selectionPressureLabel"; 351 this.selectionPressureLabel.Size = new System.Drawing.Size(145, 13); 352 this.selectionPressureLabel.TabIndex = 16; 353 this.selectionPressureLabel.Text = "Maximum &Selection Pressure:"; 354 // 355 // OffspringSelectionGpEditor 334 356 // 335 357 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); … … 340 362 this.Controls.Add(this.abortButton); 341 363 this.Controls.Add(this.executeButton); 342 this.Name = " StandardGpEditor";364 this.Name = "OffspringSelectionGpEditor"; 343 365 this.Size = new System.Drawing.Size(526, 419); 344 366 this.tabControl.ResumeLayout(false); … … 376 398 private HeuristicLab.Core.ScopeView scopeView; 377 399 private System.Windows.Forms.Button viewProblemInitializationButton; 400 private System.Windows.Forms.TextBox selectionPressureTextBox; 401 private System.Windows.Forms.Label selectionPressureLabel; 378 402 } 379 403 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/OffSpringSelectionGpEditor.cs
r1156 r1201 34 34 private ChooseOperatorDialog chooseOperatorDialog; 35 35 36 public OffspringSelectionG pEditor OffspringSelectionGpEditor{37 get { return (OffspringSelectionG pEditor)Item; }36 public OffspringSelectionGP OffspringSelectionGP { 37 get { return (OffspringSelectionGP)Item; } 38 38 set { base.Item = value; } 39 39 } … … 42 42 InitializeComponent(); 43 43 } 44 public OffspringSelectionGpEditor(OffspringSelectionG pEditorosgp)44 public OffspringSelectionGpEditor(OffspringSelectionGP osgp) 45 45 : this() { 46 OffspringSelectionG pEditor= osgp;46 OffspringSelectionGP = osgp; 47 47 } 48 48 49 49 protected override void RemoveItemEvents() { 50 OffspringSelectionG pEditor.Engine.ExceptionOccurred -= new EventHandler<ExceptionEventArgs>(Engine_ExceptionOccurred);51 OffspringSelectionG pEditor.Engine.Finished -= new EventHandler(Engine_Finished);50 OffspringSelectionGP.Engine.ExceptionOccurred -= new EventHandler<ExceptionEventArgs>(Engine_ExceptionOccurred); 51 OffspringSelectionGP.Engine.Finished -= new EventHandler(Engine_Finished); 52 52 scopeView.Scope = null; 53 53 base.RemoveItemEvents(); … … 55 55 protected override void AddItemEvents() { 56 56 base.AddItemEvents(); 57 OffspringSelectionG pEditor.Engine.ExceptionOccurred += new EventHandler<ExceptionEventArgs>(Engine_ExceptionOccurred);58 OffspringSelectionG pEditor.Engine.Finished += new EventHandler(Engine_Finished);57 OffspringSelectionGP.Engine.ExceptionOccurred += new EventHandler<ExceptionEventArgs>(Engine_ExceptionOccurred); 58 OffspringSelectionGP.Engine.Finished += new EventHandler(Engine_Finished); 59 59 SetDataBinding(); 60 scopeView.Scope = OffspringSelectionG pEditor.Engine.GlobalScope;60 scopeView.Scope = OffspringSelectionGP.Engine.GlobalScope; 61 61 } 62 62 63 63 protected override void UpdateControls() { 64 64 base.UpdateControls(); 65 if (OffspringSelectionG pEditor== null) {65 if (OffspringSelectionGP == null) { 66 66 tabControl.Enabled = false; 67 67 } else { 68 68 tabControl.Enabled = true; 69 problemInitializationTextBox.Text = OffspringSelectionG pEditor.ProblemInjector.GetType().Name;69 problemInitializationTextBox.Text = OffspringSelectionGP.ProblemInjector.GetType().Name; 70 70 } 71 71 } 72 72 73 73 private void SetDataBinding() { 74 setRandomSeedRandomlyCheckBox.DataBindings.Add("Checked", OffspringSelectionGpEditor, "SetSeedRandomly"); 75 randomSeedTextBox.DataBindings.Add("Text", OffspringSelectionGpEditor, "Seed"); 76 populationSizeTextBox.DataBindings.Add("Text", OffspringSelectionGpEditor, "PopulationSize"); 77 maximumGenerationsTextBox.DataBindings.Add("Text", OffspringSelectionGpEditor, "MaxGenerations"); 78 mutationRateTextBox.DataBindings.Add("Text", OffspringSelectionGpEditor, "MutationRate"); 79 elitesTextBox.DataBindings.Add("Text", OffspringSelectionGpEditor, "Elites"); 74 setRandomSeedRandomlyCheckBox.DataBindings.Add("Checked", OffspringSelectionGP, "SetSeedRandomly"); 75 randomSeedTextBox.DataBindings.Add("Text", OffspringSelectionGP, "Seed"); 76 populationSizeTextBox.DataBindings.Add("Text", OffspringSelectionGP, "PopulationSize"); 77 maximumGenerationsTextBox.DataBindings.Add("Text", OffspringSelectionGP, "MaxGenerations"); 78 selectionPressureTextBox.DataBindings.Add("Text", OffspringSelectionGP, "SelectionPressureLimit"); 79 mutationRateTextBox.DataBindings.Add("Text", OffspringSelectionGP, "MutationRate"); 80 elitesTextBox.DataBindings.Add("Text", OffspringSelectionGP, "Elites"); 80 81 } 81 82 82 83 #region Button Events 83 84 private void viewProblemInjectorButton_Click(object sender, EventArgs e) { 84 IView view = OffspringSelectionG pEditor.ProblemInjector.CreateView();85 IView view = OffspringSelectionGP.ProblemInjector.CreateView(); 85 86 if(view != null) 86 87 PluginManager.ControlManager.ShowControl(view); … … 90 91 if (chooseOperatorDialog == null) chooseOperatorDialog = new ChooseOperatorDialog(); 91 92 if (chooseOperatorDialog.ShowDialog(this) == DialogResult.OK) { 92 OffspringSelectionG pEditor.ProblemInjector = chooseOperatorDialog.Operator;93 problemInitializationTextBox.Text = OffspringSelectionG pEditor.ProblemInjector.GetType().Name;93 OffspringSelectionGP.ProblemInjector = chooseOperatorDialog.Operator; 94 problemInitializationTextBox.Text = OffspringSelectionGP.ProblemInjector.GetType().Name; 94 95 } 95 96 } … … 97 98 executeButton.Enabled = false; 98 99 abortButton.Enabled = true; 99 OffspringSelectionG pEditor.Engine.Execute();100 OffspringSelectionGP.Engine.Execute(); 100 101 } 101 102 private void abortButton_Click(object sender, EventArgs e) { 102 StandardGP.Engine.Abort();103 OffspringSelectionGP.Engine.Abort(); 103 104 } 104 105 private void resetButton_Click(object sender, EventArgs e) { 105 StandardGP.Engine.Reset();106 OffspringSelectionGP.Engine.Reset(); 106 107 } 107 108 private void cloneEngineButton_Click(object sender, EventArgs e) { 108 IEngine clone = (IEngine) StandardGP.Engine.Clone();109 IEngine clone = (IEngine)OffspringSelectionGP.Engine.Clone(); 109 110 IEditor editor = ((IEditable)clone).CreateEditor(); 110 111 PluginManager.ControlManager.ShowControl(editor); … … 130 131 } 131 132 #endregion 132 133 134 133 } 135 134 } -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/OffspringSelectionGP.cs
r1156 r1201 34 34 using HeuristicLab.Data; 35 35 using HeuristicLab.Operators.Programmable; 36 using HeuristicLab.Selection.OffspringSelection; 36 37 37 38 namespace HeuristicLab.GP.StructureIdentification { … … 86 87 } 87 88 88 private IntData maxTreeSize ;89 private IntData maxTreeSize = new IntData(); 89 90 public int MaxTreeSize { 90 91 get { return maxTreeSize.Data; } … … 92 93 } 93 94 94 private IntData maxTreeHeight ;95 private IntData maxTreeHeight = new IntData(); 95 96 public int MaxTreeHeight { 96 97 get { return maxTreeHeight.Data; } … … 98 99 } 99 100 100 private DoubleData maxSelectionPressure; 101 public double MaxSelectionPressure { 102 get { return maxSelectionPressure.Data; } 103 set { maxSelectionPressure.Data = value; } 101 private DoubleData selectionPressureLimit = new DoubleData(); 102 public double SelectionPressureLimit { 103 get { return selectionPressureLimit.Data; } 104 set { selectionPressureLimit.Data = value; } 105 } 106 107 private DoubleData comparisonFactor = new DoubleData(); 108 public double ComparisonFactor { 109 get { return comparisonFactor.Data; } 110 set { comparisonFactor.Data = value; } 111 } 112 113 private DoubleData successRatioLimit = new DoubleData(); 114 public double SuccessRatioLimit { 115 get { return successRatioLimit.Data; } 116 set { successRatioLimit.Data = value; } 104 117 } 105 118 … … 120 133 MutationRate = 0.15; 121 134 Elites = 1; 122 MaxSelectionPressure = 300; 135 SelectionPressureLimit = 300; 136 ComparisonFactor = 1.0; 123 137 MaxTreeHeight = 10; 124 138 MaxTreeSize = 100; … … 131 145 private CombinedOperator CreateAlgorithm() { 132 146 CombinedOperator algo = new CombinedOperator(); 133 algo.Name = " StandardGP";147 algo.Name = "OffspringSelectionGP"; 134 148 SequentialProcessor seq = new SequentialProcessor(); 135 149 EmptyOperator problemInjectorPlaceholder = new EmptyOperator(); … … 139 153 randomInjector.Name = "Random Injector"; 140 154 VariableInjector globalInjector = CreateGlobalInjector(); 141 CombinedOperator initialization = CreateIni alization();155 CombinedOperator initialization = CreateInitialization(); 142 156 initialization.Name = "Initialization"; 143 157 FunctionLibraryInjector funLibInjector = new FunctionLibraryInjector(); … … 160 174 CombinedOperator manipulator = CreateManipulator(); 161 175 manipulator.Name = "Manipulator"; 162 TournamentSelector selector = new TournamentSelector();176 CombinedOperator selector = CreateSelector(); 163 177 selector.Name = "Selector"; 164 selector.GetVariableInfo("Selected").ActualName = "Parents";165 selector.GetVariableInfo("GroupSize").Local = false;166 selector.RemoveVariable("GroupSize");167 selector.GetVariableInfo("GroupSize").ActualName = "TournamentSize";168 178 LeftReducer cleanUp = new LeftReducer(); 169 179 … … 192 202 VariableInjector injector = new VariableInjector(); 193 203 injector.Name = "Global Injector"; 204 injector.AddVariable(new HeuristicLab.Core.Variable("ComparisonFactor", comparisonFactor)); 205 injector.AddVariable(new HeuristicLab.Core.Variable("Elites", elites)); 206 injector.AddVariable(new HeuristicLab.Core.Variable("EvaluatedSolutions", new IntData(0))); 194 207 injector.AddVariable(new HeuristicLab.Core.Variable("Generations", new IntData(0))); 208 injector.AddVariable(new HeuristicLab.Core.Variable("Maximization", new BoolData(false))); 195 209 injector.AddVariable(new HeuristicLab.Core.Variable("MaxGenerations", maxGenerations)); 196 injector.AddVariable(new HeuristicLab.Core.Variable("MutationRate", mutationRate));197 injector.AddVariable(new HeuristicLab.Core.Variable("PopulationSize", populationSize));198 injector.AddVariable(new HeuristicLab.Core.Variable("Parents", parents));199 injector.AddVariable(new HeuristicLab.Core.Variable("Elites", elites));200 injector.AddVariable(new HeuristicLab.Core.Variable("Maximization", new BoolData(false)));201 210 injector.AddVariable(new HeuristicLab.Core.Variable("MaxTreeHeight", maxTreeHeight)); 202 211 injector.AddVariable(new HeuristicLab.Core.Variable("MaxTreeSize", maxTreeSize)); 203 injector.AddVariable(new HeuristicLab.Core.Variable("EvaluatedSolutions", new IntData(0))); 212 injector.AddVariable(new HeuristicLab.Core.Variable("MutationRate", mutationRate)); 213 injector.AddVariable(new HeuristicLab.Core.Variable("Parents", parents)); 214 injector.AddVariable(new HeuristicLab.Core.Variable("PopulationSize", populationSize)); 215 injector.AddVariable(new HeuristicLab.Core.Variable("PunishmentFactor", new DoubleData(punishmentFactor))); 216 injector.AddVariable(new HeuristicLab.Core.Variable("SelectionPressureLimit", selectionPressureLimit)); 217 injector.AddVariable(new HeuristicLab.Core.Variable("SuccessRatioLimit", successRatioLimit)); 204 218 injector.AddVariable(new HeuristicLab.Core.Variable("TotalEvaluatedNodes", new DoubleData(0))); 205 injector.AddVariable(new HeuristicLab.Core.Variable("PunishmentFactor", new DoubleData(punishmentFactor)));206 219 injector.AddVariable(new HeuristicLab.Core.Variable("UseEstimatedTargetValue", new BoolData(useEstimatedTargetValue))); 207 220 return injector; … … 249 262 } 250 263 251 private CombinedOperator CreateIni alization() {264 private CombinedOperator CreateInitialization() { 252 265 CombinedOperator init = new CombinedOperator(); 253 266 SequentialProcessor seq = new SequentialProcessor(); … … 268 281 Counter evalCounter = new Counter(); 269 282 evalCounter.GetVariableInfo("Value").ActualName = "EvaluatedSolutions"; 270 283 Sorter sorter = new Sorter(); 284 sorter.GetVariableInfo("Descending").ActualName = "Maximization"; 285 sorter.GetVariableInfo("Value").ActualName = "Quality"; 271 286 seq.AddSubOperator(subScopesCreater); 272 287 seq.AddSubOperator(subScopesProc); 288 seq.AddSubOperator(sorter); 273 289 subScopesProc.AddSubOperator(individualSeq); 274 290 individualSeq.AddSubOperator(treeCreater); … … 282 298 } 283 299 300 private CombinedOperator CreateSelector() { 301 CombinedOperator selector = new CombinedOperator(); 302 SequentialProcessor seq = new SequentialProcessor(); 303 seq.Name = "Selector"; 304 EmptyOperator emptyOp = new EmptyOperator(); 305 ProportionalSelector femaleSelector = new ProportionalSelector(); 306 femaleSelector.GetVariableInfo("Selected").ActualName = "Parents"; 307 femaleSelector.GetVariableValue<BoolData>("CopySelected", null, false).Data = true; 308 309 RandomSelector maleSelector = new RandomSelector(); 310 maleSelector.GetVariableInfo("Selected").ActualName = "Parents"; 311 maleSelector.GetVariableValue<BoolData>("CopySelected", null, false).Data = true; 312 SequentialSubScopesProcessor seqSubScopesProc = new SequentialSubScopesProcessor(); 313 RightChildReducer rightChildReducer = new RightChildReducer(); 314 SubScopesMixer mixer = new SubScopesMixer(); 315 316 seqSubScopesProc.AddSubOperator(femaleSelector); 317 seqSubScopesProc.AddSubOperator(emptyOp); 318 319 seq.AddSubOperator(maleSelector); 320 seq.AddSubOperator(seqSubScopesProc); 321 seq.AddSubOperator(rightChildReducer); 322 seq.AddSubOperator(mixer); 323 324 selector.OperatorGraph.AddOperator(seq); 325 selector.OperatorGraph.InitialOperator = seq; 326 return selector; 327 } 328 284 329 private CombinedOperator CreateMainLoop() { 285 330 CombinedOperator main = new CombinedOperator(); 286 331 SequentialProcessor seq = new SequentialProcessor(); 332 SequentialProcessor offspringSelectionSeq = new SequentialProcessor(); 333 SequentialSubScopesProcessor subScopesProc = new SequentialSubScopesProcessor(); 334 EmptyOperator emptyOp = new EmptyOperator(); 335 OffspringSelector offspringSelector = new OffspringSelector(); 336 337 OperatorExtractor selector = new OperatorExtractor(); 338 selector.Name = "Selector (extr.)"; 339 selector.GetVariableInfo("Operator").ActualName = "Selector"; 340 287 341 CombinedOperator childCreater = CreateChildCreater(); 288 342 childCreater.Name = "Create children"; … … 314 368 Counter counter = new Counter(); 315 369 counter.GetVariableInfo("Value").ActualName = "Generations"; 316 LessThanComparator comparator = new LessThanComparator(); 317 comparator.GetVariableInfo("LeftSide").ActualName = "Generations"; 318 comparator.GetVariableInfo("RightSide").ActualName = "MaxGenerations"; 319 comparator.GetVariableInfo("Result").ActualName = "GenerationsCondition"; 320 ConditionalBranch cond = new ConditionalBranch(); 321 cond.GetVariableInfo("Condition").ActualName = "GenerationsCondition"; 322 323 seq.AddSubOperator(childCreater); 370 LessThanComparator selPresComparator = new LessThanComparator(); 371 selPresComparator.GetVariableInfo("LeftSide").ActualName = "SelectionPressure"; 372 selPresComparator.GetVariableInfo("RightSide").ActualName = "SelectionPressureLimit"; 373 selPresComparator.GetVariableInfo("Result").ActualName = "SelectionPressureCondition"; 374 LessThanComparator generationsComparator = new LessThanComparator(); 375 generationsComparator.GetVariableInfo("LeftSide").ActualName = "Generations"; 376 generationsComparator.GetVariableInfo("RightSide").ActualName = "MaxGenerations"; 377 generationsComparator.GetVariableInfo("Result").ActualName = "GenerationsCondition"; 378 ConditionalBranch selPresCondition = new ConditionalBranch(); 379 selPresCondition.GetVariableInfo("Condition").ActualName = "SelectionPressureCondition"; 380 ConditionalBranch generationsCondition = new ConditionalBranch(); 381 generationsCondition.GetVariableInfo("Condition").ActualName = "GenerationsCondition"; 382 383 subScopesProc.AddSubOperator(emptyOp); 384 subScopesProc.AddSubOperator(childCreater); 385 386 offspringSelector.AddSubOperator(offspringSelectionSeq); 387 388 offspringSelectionSeq.AddSubOperator(selector); 389 offspringSelectionSeq.AddSubOperator(subScopesProc); 390 offspringSelectionSeq.AddSubOperator(offspringSelector); 391 392 seq.AddSubOperator(offspringSelectionSeq); 324 393 seq.AddSubOperator(replacement); 325 394 seq.AddSubOperator(solutionStorer); … … 331 400 seq.AddSubOperator(validationQualityLogger); 332 401 seq.AddSubOperator(counter); 333 seq.AddSubOperator(comparator); 334 seq.AddSubOperator(cond); 335 cond.AddSubOperator(seq); 402 seq.AddSubOperator(selPresComparator); 403 seq.AddSubOperator(generationsComparator); 404 seq.AddSubOperator(selPresCondition); 405 selPresCondition.AddSubOperator(generationsCondition); 406 generationsCondition.AddSubOperator(seq); 336 407 337 408 main.OperatorGraph.AddOperator(seq); … … 346 417 SequentialProcessor bestSolutionProcessor = new SequentialProcessor(); 347 418 MeanAbsolutePercentageErrorEvaluator trainingMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator(); 348 trainingMapeEvaluator.Name = " ValidationMapeEvaluator";419 trainingMapeEvaluator.Name = "TrainingMapeEvaluator"; 349 420 trainingMapeEvaluator.GetVariableInfo("MAPE").ActualName = "TrainingMAPE"; 350 421 trainingMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart"; … … 358 429 progOperator.RemoveVariableInfo("Result"); 359 430 progOperator.AddVariableInfo(new HeuristicLab.Core.VariableInfo("EvaluatedSolutions", "", typeof(IntData), VariableKind.In)); 431 progOperator.AddVariableInfo(new HeuristicLab.Core.VariableInfo("SelectionPressure", "", typeof(DoubleData), VariableKind.In)); 360 432 progOperator.Code = @" 361 433 int evalSolutions = EvaluatedSolutions.Data; 434 double selectionPressure = SelectionPressure.Data; 362 435 scope.AddVariable(new Variable(""EvaluatedSolutions"", new IntData(evalSolutions))); 436 scope.AddVariable(new Variable(""SelectionPressure"", new DoubleData(selectionPressure))); 363 437 "; 364 438 solutionStorer.AddSubOperator(bestSolutionProcessor); … … 405 479 CombinedOperator childCreater = new CombinedOperator(); 406 480 SequentialProcessor seq = new SequentialProcessor(); 407 OperatorExtractor selector = new OperatorExtractor(); 408 selector.Name = "Selector (extr.)"; 409 selector.GetVariableInfo("Operator").ActualName = "Selector"; 410 SequentialSubScopesProcessor seqScopesProc = new SequentialSubScopesProcessor(); 411 EmptyOperator emptyOpt = new EmptyOperator(); 481 OffspringAnalyzer analyzer = new OffspringAnalyzer(); 412 482 SequentialProcessor selectedProc = new SequentialProcessor(); 413 483 OperatorExtractor crossover = new OperatorExtractor(); … … 434 504 sorter.GetVariableInfo("Descending").ActualName = "Maximization"; 435 505 sorter.GetVariableInfo("Value").ActualName = "Quality"; 436 437 438 seq.AddSubOperator(selector); 439 seq.AddSubOperator(seqScopesProc); 440 seqScopesProc.AddSubOperator(emptyOpt); 441 seqScopesProc.AddSubOperator(selectedProc); 506 seq.AddSubOperator(analyzer); 507 analyzer.AddSubOperator(selectedProc); 442 508 selectedProc.AddSubOperator(crossover); 443 509 selectedProc.AddSubOperator(individualProc); … … 448 514 individualSeqProc.AddSubOperator(validationEvaluator); 449 515 individualSeqProc.AddSubOperator(evalCounter); 450 se lectedProc.AddSubOperator(sorter);516 seq.AddSubOperator(sorter); 451 517 452 518 childCreater.OperatorGraph.AddOperator(seq); … … 456 522 457 523 public IEditor CreateEditor() { 458 return new Off SpringSelectionGpEditor(this);524 return new OffspringSelectionGpEditor(this); 459 525 } 460 526 -
branches/CEDMA-Refactoring-Ticket419/HeuristicLab.GP.StructureIdentification/StandardGP.cs
r1156 r1201 136 136 randomInjector.Name = "Random Injector"; 137 137 VariableInjector globalInjector = CreateGlobalInjector(); 138 CombinedOperator initialization = CreateIni alization();138 CombinedOperator initialization = CreateInitialization(); 139 139 initialization.Name = "Initialization"; 140 140 FunctionLibraryInjector funLibInjector = new FunctionLibraryInjector(); … … 247 247 } 248 248 249 private CombinedOperator CreateIni alization() {249 private CombinedOperator CreateInitialization() { 250 250 CombinedOperator init = new CombinedOperator(); 251 251 SequentialProcessor seq = new SequentialProcessor(); … … 266 266 Counter evalCounter = new Counter(); 267 267 evalCounter.GetVariableInfo("Value").ActualName = "EvaluatedSolutions"; 268 Sorter sorter = new Sorter(); 269 sorter.GetVariableInfo("Descending").ActualName = "Maximization"; 270 sorter.GetVariableInfo("Value").ActualName = "Quality"; 268 271 269 272 seq.AddSubOperator(subScopesCreater); 270 273 seq.AddSubOperator(subScopesProc); 274 seq.AddSubOperator(sorter); 275 271 276 subScopesProc.AddSubOperator(individualSeq); 272 277 individualSeq.AddSubOperator(treeCreater); … … 344 349 SequentialProcessor bestSolutionProcessor = new SequentialProcessor(); 345 350 MeanAbsolutePercentageErrorEvaluator trainingMapeEvaluator = new MeanAbsolutePercentageErrorEvaluator(); 346 trainingMapeEvaluator.Name = " ValidationMapeEvaluator";351 trainingMapeEvaluator.Name = "TrainingMapeEvaluator"; 347 352 trainingMapeEvaluator.GetVariableInfo("MAPE").ActualName = "TrainingMAPE"; 348 353 trainingMapeEvaluator.GetVariableInfo("SamplesStart").ActualName = "TrainingSamplesStart";
Note: See TracChangeset
for help on using the changeset viewer.