Changeset 432
- Timestamp:
- 08/03/08 23:53:44 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.StructureIdentification
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.StructureIdentification/GPOperatorGroup.cs
r431 r432 32 32 namespace HeuristicLab.StructureIdentification { 33 33 public class GPOperatorGroup : OperatorGroup { 34 public GPOperatorGroup()35 : base() {36 }37 38 public override void AddOperator(IOperator op) {39 base.AddOperator(op);40 41 var localVariableInfos = op.VariableInfos.Where(f => f.Local);42 43 if(op.GetVariable(GPOperatorLibrary.MIN_TREE_HEIGHT) == null) {44 op.AddVariable(new Variable(GPOperatorLibrary.MIN_TREE_HEIGHT, new IntData(-1)));45 }46 if(op.GetVariable(GPOperatorLibrary.MIN_TREE_SIZE) == null) {47 op.AddVariable(new Variable(GPOperatorLibrary.MIN_TREE_SIZE, new IntData(-1)));48 }49 if(op.GetVariable(GPOperatorLibrary.TICKETS) == null) {50 op.AddVariable(new Variable(GPOperatorLibrary.TICKETS, new DoubleData(1.0)));51 }52 OnOperatorAdded(op);53 }54 55 56 34 private Dictionary<IOperator, int> minTreeHeight = new Dictionary<IOperator, int>(); 57 35 private Dictionary<IOperator, int> minTreeSize = new Dictionary<IOperator, int>(); 58 36 private SubOperatorsConstraintAnalyser constraintAnalyser = new SubOperatorsConstraintAnalyser(); 37 38 public GPOperatorGroup() 39 : base() { 40 } 41 42 public override void AddOperator(IOperator op) { 43 base.AddOperator(op); 44 var localVariableInfos = op.VariableInfos.Where(f => f.Local); 45 46 if(op.GetVariable(GPOperatorLibrary.MIN_TREE_HEIGHT) == null) { 47 op.AddVariable(new Variable(GPOperatorLibrary.MIN_TREE_HEIGHT, new IntData(-1))); 48 } 49 if(op.GetVariable(GPOperatorLibrary.MIN_TREE_SIZE) == null) { 50 op.AddVariable(new Variable(GPOperatorLibrary.MIN_TREE_SIZE, new IntData(-1))); 51 } 52 if(op.GetVariable(GPOperatorLibrary.TICKETS) == null) { 53 op.AddVariable(new Variable(GPOperatorLibrary.TICKETS, new DoubleData(1.0))); 54 } 55 foreach(IConstraint c in op.Constraints) { 56 if(c is SubOperatorTypeConstraint || c is AllSubOperatorsTypeConstraint) c.Changed += new EventHandler(UpdateTreeBounds); 57 } 58 OnOperatorAdded(op); 59 } 60 61 void UpdateTreeBounds(object sender, EventArgs e) { 62 RecalculateMinimalTreeBounds(); 63 } 59 64 60 65 private void RecalculateMinimalTreeBounds() { … … 108 113 } 109 114 110 111 115 private int RecalculateMinimalTreeHeight(IOperator op) { 112 116 // check for memoized value … … 176 180 op.RemoveVariable(GPOperatorLibrary.MIN_TREE_HEIGHT); 177 181 op.RemoveVariable(GPOperatorLibrary.TICKETS); 182 foreach(IConstraint c in op.Constraints) { 183 if(c is SubOperatorTypeConstraint || c is AllSubOperatorsTypeConstraint) c.Changed -= new EventHandler(UpdateTreeBounds); 184 } 178 185 OnOperatorRemoved(op); 179 186 } … … 196 203 } 197 204 } 198 199 internal void Prepare() {200 RecalculateMinimalTreeBounds();201 }202 205 } 203 206 -
trunk/sources/HeuristicLab.StructureIdentification/GPOperatorLibrary.cs
r431 r432 83 83 84 84 #endregion 85 86 internal void Prepare() {87 GPOperatorGroup.Prepare();88 }89 85 } 90 86 } -
trunk/sources/HeuristicLab.StructureIdentification/GPOperatorLibraryEditor.Designer.cs
r423 r432 56 56 this.mutationListView = new System.Windows.Forms.ListView(); 57 57 this.mutationVariableView = new HeuristicLab.Core.VariableView(); 58 this.preprocessButton = new System.Windows.Forms.Button();59 58 this.tabControl.SuspendLayout(); 60 59 this.operatorLibraryTabPage.SuspendLayout(); … … 94 93 // operatorLibraryTabPage 95 94 // 96 this.operatorLibraryTabPage.Controls.Add(this.preprocessButton);97 95 this.operatorLibraryTabPage.Controls.Add(this.operatorLibraryEditor); 98 96 this.operatorLibraryTabPage.Location = new System.Drawing.Point(4, 22); … … 202 200 this.mutationVariableView.TabIndex = 0; 203 201 this.mutationVariableView.Variable = null; 204 //205 // preprocessButton206 //207 this.preprocessButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));208 this.preprocessButton.Location = new System.Drawing.Point(440, 509);209 this.preprocessButton.Name = "preprocessButton";210 this.preprocessButton.Size = new System.Drawing.Size(75, 23);211 this.preprocessButton.TabIndex = 1;212 this.preprocessButton.Text = "Prepare";213 this.preprocessButton.UseVisualStyleBackColor = true;214 this.preprocessButton.Click += new System.EventHandler(this.preprocessButton_Click);215 202 // 216 203 // GPOperatorLibraryEditor … … 248 235 private System.Windows.Forms.ListView initListView; 249 236 private System.Windows.Forms.ListView mutationListView; 250 private System.Windows.Forms.Button preprocessButton;251 237 } 252 238 } -
trunk/sources/HeuristicLab.StructureIdentification/GPOperatorLibraryEditor.cs
r429 r432 151 151 } 152 152 } 153 154 private void preprocessButton_Click(object sender, EventArgs e) {155 ((GPOperatorLibrary)OperatorLibrary).Prepare();156 }157 153 } 158 154 }
Note: See TracChangeset
for help on using the changeset viewer.