Changeset 4102
- Timestamp:
- 07/25/10 02:57:07 (14 years ago)
- Location:
- trunk/sources
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.Designer.cs
r4011 r4102 47 47 private void InitializeComponent() { 48 48 this.tabControl = new System.Windows.Forms.TabControl(); 49 this.parametersTabPage = new System.Windows.Forms.TabPage();50 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView();51 49 this.problemTabPage = new System.Windows.Forms.TabPage(); 52 50 this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 53 51 this.openProblemButton = new System.Windows.Forms.Button(); 54 52 this.newProblemButton = new System.Windows.Forms.Button(); 53 this.parametersTabPage = new System.Windows.Forms.TabPage(); 54 this.parameterCollectionView = new HeuristicLab.Core.Views.ParameterCollectionView(); 55 55 this.resultsTabPage = new System.Windows.Forms.TabPage(); 56 56 this.resultsView = new HeuristicLab.Optimization.Views.ResultCollectionView(); … … 64 64 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 65 65 this.stopButton = new System.Windows.Forms.Button(); 66 this.storeAlgorithmInEachRunCheckBox = new System.Windows.Forms.CheckBox(); 66 67 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 67 68 this.tabControl.SuspendLayout(); 69 this.problemTabPage.SuspendLayout(); 68 70 this.parametersTabPage.SuspendLayout(); 69 this.problemTabPage.SuspendLayout();70 71 this.resultsTabPage.SuspendLayout(); 71 72 this.runsTabPage.SuspendLayout(); … … 96 97 this.tabControl.Size = new System.Drawing.Size(679, 400); 97 98 this.tabControl.TabIndex = 4; 98 //99 // parametersTabPage100 //101 this.parametersTabPage.Controls.Add(this.parameterCollectionView);102 this.parametersTabPage.Location = new System.Drawing.Point(4, 22);103 this.parametersTabPage.Name = "parametersTabPage";104 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3);105 this.parametersTabPage.Size = new System.Drawing.Size(671, 374);106 this.parametersTabPage.TabIndex = 1;107 this.parametersTabPage.Text = "Parameters";108 this.parametersTabPage.UseVisualStyleBackColor = true;109 //110 // parameterCollectionView111 //112 this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)113 | System.Windows.Forms.AnchorStyles.Left)114 | System.Windows.Forms.AnchorStyles.Right)));115 this.parameterCollectionView.Content = null;116 this.parameterCollectionView.Location = new System.Drawing.Point(6, 6);117 this.parameterCollectionView.Name = "parameterCollectionView";118 this.parameterCollectionView.Size = new System.Drawing.Size(659, 362);119 this.parameterCollectionView.TabIndex = 0;120 99 // 121 100 // problemTabPage … … 135 114 // 136 115 this.problemViewHost.AllowDrop = true; 116 this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 117 | System.Windows.Forms.AnchorStyles.Left) 118 | System.Windows.Forms.AnchorStyles.Right))); 119 this.problemViewHost.Caption = "View"; 137 120 this.problemViewHost.Content = null; 138 this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)139 | System.Windows.Forms.AnchorStyles.Left)140 | System.Windows.Forms.AnchorStyles.Right)));141 121 this.problemViewHost.Location = new System.Drawing.Point(6, 36); 142 122 this.problemViewHost.Name = "problemViewHost"; 123 this.problemViewHost.ReadOnly = false; 143 124 this.problemViewHost.Size = new System.Drawing.Size(659, 332); 144 125 this.problemViewHost.TabIndex = 3; 145 126 this.problemViewHost.ViewType = null; 146 this.problemViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.problemViewHost_DragEnterOver);147 127 this.problemViewHost.DragDrop += new System.Windows.Forms.DragEventHandler(this.problemViewHost_DragDrop); 148 128 this.problemViewHost.DragEnter += new System.Windows.Forms.DragEventHandler(this.problemViewHost_DragEnterOver); 129 this.problemViewHost.DragOver += new System.Windows.Forms.DragEventHandler(this.problemViewHost_DragEnterOver); 149 130 // 150 131 // openProblemButton … … 170 151 this.newProblemButton.Click += new System.EventHandler(this.newProblemButton_Click); 171 152 // 153 // parametersTabPage 154 // 155 this.parametersTabPage.Controls.Add(this.parameterCollectionView); 156 this.parametersTabPage.Location = new System.Drawing.Point(4, 22); 157 this.parametersTabPage.Name = "parametersTabPage"; 158 this.parametersTabPage.Padding = new System.Windows.Forms.Padding(3); 159 this.parametersTabPage.Size = new System.Drawing.Size(671, 374); 160 this.parametersTabPage.TabIndex = 1; 161 this.parametersTabPage.Text = "Parameters"; 162 this.parametersTabPage.UseVisualStyleBackColor = true; 163 // 164 // parameterCollectionView 165 // 166 this.parameterCollectionView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 167 | System.Windows.Forms.AnchorStyles.Left) 168 | System.Windows.Forms.AnchorStyles.Right))); 169 this.parameterCollectionView.Caption = "ParameterCollection View"; 170 this.parameterCollectionView.Content = null; 171 this.parameterCollectionView.Location = new System.Drawing.Point(6, 6); 172 this.parameterCollectionView.Name = "parameterCollectionView"; 173 this.parameterCollectionView.ReadOnly = false; 174 this.parameterCollectionView.Size = new System.Drawing.Size(659, 362); 175 this.parameterCollectionView.TabIndex = 0; 176 // 172 177 // resultsTabPage 173 178 // … … 186 191 | System.Windows.Forms.AnchorStyles.Left) 187 192 | System.Windows.Forms.AnchorStyles.Right))); 193 this.resultsView.Caption = "ResultCollection View"; 188 194 this.resultsView.Content = null; 189 195 this.resultsView.Location = new System.Drawing.Point(6, 6); 190 196 this.resultsView.Name = "resultsView"; 197 this.resultsView.ReadOnly = true; 191 198 this.resultsView.Size = new System.Drawing.Size(659, 362); 192 199 this.resultsView.TabIndex = 0; … … 194 201 // runsTabPage 195 202 // 203 this.runsTabPage.Controls.Add(this.storeAlgorithmInEachRunCheckBox); 196 204 this.runsTabPage.Controls.Add(this.runsView); 197 205 this.runsTabPage.Location = new System.Drawing.Point(4, 22); … … 208 216 | System.Windows.Forms.AnchorStyles.Left) 209 217 | System.Windows.Forms.AnchorStyles.Right))); 218 this.runsView.Caption = "RunCollection View"; 210 219 this.runsView.Content = null; 211 220 this.runsView.Location = new System.Drawing.Point(6, 6); 212 221 this.runsView.Name = "runsView"; 222 this.runsView.ReadOnly = false; 213 223 this.runsView.Size = new System.Drawing.Size(659, 362); 214 224 this.runsView.TabIndex = 0; … … 287 297 this.stopButton.UseVisualStyleBackColor = true; 288 298 this.stopButton.Click += new System.EventHandler(this.stopButton_Click); 299 // 300 // storeAlgorithmInEachRunCheckBox 301 // 302 this.storeAlgorithmInEachRunCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); 303 this.storeAlgorithmInEachRunCheckBox.AutoSize = true; 304 this.storeAlgorithmInEachRunCheckBox.CheckAlign = System.Drawing.ContentAlignment.MiddleRight; 305 this.storeAlgorithmInEachRunCheckBox.Checked = true; 306 this.storeAlgorithmInEachRunCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; 307 this.storeAlgorithmInEachRunCheckBox.Location = new System.Drawing.Point(503, 6); 308 this.storeAlgorithmInEachRunCheckBox.Name = "storeAlgorithmInEachRunCheckBox"; 309 this.storeAlgorithmInEachRunCheckBox.Size = new System.Drawing.Size(161, 17); 310 this.storeAlgorithmInEachRunCheckBox.TabIndex = 1; 311 this.storeAlgorithmInEachRunCheckBox.Text = "&Store Algorithm in each Run:"; 312 this.toolTip.SetToolTip(this.storeAlgorithmInEachRunCheckBox, "Check to store a copy of the algorithm in each run."); 313 this.storeAlgorithmInEachRunCheckBox.UseVisualStyleBackColor = true; 314 this.storeAlgorithmInEachRunCheckBox.CheckedChanged += new System.EventHandler(this.storeAlgorithmInEachRunCheckBox_CheckedChanged); 289 315 // 290 316 // AlgorithmView … … 314 340 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 315 341 this.tabControl.ResumeLayout(false); 342 this.problemTabPage.ResumeLayout(false); 316 343 this.parametersTabPage.ResumeLayout(false); 317 this.problemTabPage.ResumeLayout(false);318 344 this.resultsTabPage.ResumeLayout(false); 319 345 this.runsTabPage.ResumeLayout(false); 346 this.runsTabPage.PerformLayout(); 320 347 this.ResumeLayout(false); 321 348 this.PerformLayout(); … … 343 370 protected System.Windows.Forms.TabPage runsTabPage; 344 371 protected RunCollectionView runsView; 372 protected System.Windows.Forms.CheckBox storeAlgorithmInEachRunCheckBox; 345 373 } 346 374 } -
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r4070 r4102 74 74 Content.Stopped -= new EventHandler(Content_Stopped); 75 75 Content.ProblemChanged -= new EventHandler(Content_ProblemChanged); 76 Content.StoreAlgorithmInEachRunChanged -= new EventHandler(Content_StoreAlgorithmInEachRunChanged); 76 77 base.DeregisterContentEvents(); 77 78 } … … 86 87 Content.Stopped += new EventHandler(Content_Stopped); 87 88 Content.ProblemChanged += new EventHandler(Content_ProblemChanged); 89 Content.StoreAlgorithmInEachRunChanged += new EventHandler(Content_StoreAlgorithmInEachRunChanged); 88 90 } 89 91 … … 95 97 resultsView.Content = null; 96 98 runsView.Content = null; 99 storeAlgorithmInEachRunCheckBox.Checked = true; 97 100 executionTimeTextBox.Text = "-"; 98 101 } else { … … 102 105 resultsView.Content = Content.Results.AsReadOnly(); 103 106 runsView.Content = Content.Runs; 107 storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun; 104 108 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 105 109 } … … 114 118 resultsView.Enabled = Content != null; 115 119 runsView.Enabled = Content != null; 120 storeAlgorithmInEachRunCheckBox.Enabled = Content != null && !ReadOnly; 116 121 executionTimeTextBox.Enabled = Content != null; 117 122 SetEnabledStateOfExecutableButtons(); … … 138 143 startButton.Enabled = pauseButton.Enabled = stopButton.Enabled = resetButton.Enabled = false; 139 144 } 145 protected virtual void Content_ExecutionTimeChanged(object sender, EventArgs e) { 146 if (InvokeRequired) 147 Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e); 148 else 149 executionTimeTextBox.Text = Content.ExecutionTime.ToString(); 150 } 151 protected virtual void Content_StoreAlgorithmInEachRunChanged(object sender, EventArgs e) { 152 if (InvokeRequired) 153 Invoke(new EventHandler(Content_StoreAlgorithmInEachRunChanged), sender, e); 154 else 155 storeAlgorithmInEachRunCheckBox.Checked = Content.StoreAlgorithmInEachRun; 156 } 140 157 protected virtual void Content_Prepared(object sender, EventArgs e) { 141 158 if (InvokeRequired) … … 170 187 SetEnabledStateOfExecutableButtons(); 171 188 } 172 }173 protected virtual void Content_ExecutionTimeChanged(object sender, EventArgs e) {174 if (InvokeRequired)175 Invoke(new EventHandler(Content_ExecutionTimeChanged), sender, e);176 else177 executionTimeTextBox.Text = Content.ExecutionTime.ToString();178 189 } 179 190 protected virtual void Content_ExceptionOccurred(object sender, EventArgs<Exception> e) { … … 233 244 } 234 245 } 246 protected virtual void storeAlgorithmInEachRunCheckBox_CheckedChanged(object sender, EventArgs e) { 247 if (Content != null) Content.StoreAlgorithmInEachRun = storeAlgorithmInEachRunCheckBox.Checked; 248 } 235 249 protected virtual void startButton_Click(object sender, EventArgs e) { 236 250 Content.Start(); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/EngineAlgorithmView.Designer.cs
r4011 r4102 117 117 // 118 118 this.executionTimeLabel.Location = new System.Drawing.Point(487, 532); 119 this.executionTimeLabel.TabIndex = 9;120 119 // 121 120 // executionTimeTextBox 122 121 // 123 122 this.executionTimeTextBox.Location = new System.Drawing.Point(576, 529); 124 this.executionTimeTextBox.TabIndex = 10;125 123 // 126 124 // resultsTabPage … … 145 143 this.runsView.Size = new System.Drawing.Size(693, 429); 146 144 // 147 // problemPanel148 // 149 this. problemViewHost.Size = new System.Drawing.Size(693, 399);145 // storeAlgorithmInEachRunCheckBox 146 // 147 this.storeAlgorithmInEachRunCheckBox.Location = new System.Drawing.Point(530, 6); 150 148 // 151 149 // nameTextBox … … 198 196 | System.Windows.Forms.AnchorStyles.Left) 199 197 | System.Windows.Forms.AnchorStyles.Right))); 198 this.engineViewHost.Caption = "View"; 200 199 this.engineViewHost.Content = null; 201 200 this.engineViewHost.Location = new System.Drawing.Point(6, 33); … … 245 244 | System.Windows.Forms.AnchorStyles.Left) 246 245 | System.Windows.Forms.AnchorStyles.Right))); 246 this.operatorGraphViewHost.Caption = "View"; 247 247 this.operatorGraphViewHost.Content = null; 248 248 this.operatorGraphViewHost.Location = new System.Drawing.Point(3, 33); … … 259 259 this.Name = "EngineAlgorithmView"; 260 260 this.Size = new System.Drawing.Size(713, 549); 261 this.Controls.SetChildIndex(this.stopButton, 0);262 this.Controls.SetChildIndex(this.resetButton, 0);263 this.Controls.SetChildIndex(this.pauseButton, 0);264 this.Controls.SetChildIndex(this.executionTimeLabel, 0);265 this.Controls.SetChildIndex(this.executionTimeTextBox, 0);266 this.Controls.SetChildIndex(this.startButton, 0);267 this.Controls.SetChildIndex(this.tabControl, 0);268 this.Controls.SetChildIndex(this.nameLabel, 0);269 this.Controls.SetChildIndex(this.descriptionLabel, 0);270 this.Controls.SetChildIndex(this.nameTextBox, 0);271 this.Controls.SetChildIndex(this.descriptionTextBox, 0);272 261 this.tabControl.ResumeLayout(false); 273 262 this.parametersTabPage.ResumeLayout(false); … … 275 264 this.resultsTabPage.ResumeLayout(false); 276 265 this.runsTabPage.ResumeLayout(false); 266 this.runsTabPage.PerformLayout(); 277 267 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 278 268 this.engineTabPage.ResumeLayout(false); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs
r4099 r4102 80 80 viewHost.Enabled = Content != null; 81 81 changeColorButton.Enabled = Content != null; 82 showAlgorithmButton.Enabled = Content != null && !Locked;82 showAlgorithmButton.Enabled = Content != null && Content.Algorithm != null && !Locked; 83 83 } 84 84 -
trunk/sources/HeuristicLab.Optimization/3.3/Algorithm.cs
r3785 r4102 92 92 93 93 [Storable] 94 private bool storeAlgorithmInEachRun; 95 public bool StoreAlgorithmInEachRun { 96 get { return storeAlgorithmInEachRun; } 97 set { 98 if (storeAlgorithmInEachRun != value) { 99 storeAlgorithmInEachRun = value; 100 OnStoreAlgorithmInEachRunChanged(); 101 } 102 } 103 } 104 105 [Storable] 94 106 protected int runsCounter; 95 107 … … 112 124 executionState = ExecutionState.Stopped; 113 125 executionTime = TimeSpan.Zero; 126 storeAlgorithmInEachRun = true; 114 127 runsCounter = 0; 115 128 Runs = new RunCollection(); … … 119 132 executionState = ExecutionState.Stopped; 120 133 executionTime = TimeSpan.Zero; 134 storeAlgorithmInEachRun = true; 121 135 runsCounter = 0; 122 136 Runs = new RunCollection(); … … 126 140 executionState = ExecutionState.Stopped; 127 141 executionTime = TimeSpan.Zero; 142 storeAlgorithmInEachRun = true; 128 143 runsCounter = 0; 129 144 Runs = new RunCollection(); … … 133 148 executionState = ExecutionState.Stopped; 134 149 executionTime = TimeSpan.Zero; 150 storeAlgorithmInEachRun = true; 135 151 runsCounter = 0; 136 152 Runs = new RunCollection(); … … 140 156 executionState = ExecutionState.Stopped; 141 157 executionTime = TimeSpan.Zero; 158 storeAlgorithmInEachRun = true; 142 159 runsCounter = 0; 143 160 Runs = new RunCollection(); 144 161 } 145 162 [StorableConstructor] 146 protected Algorithm(bool deserializing) : base(deserializing) { } 163 protected Algorithm(bool deserializing) 164 : base(deserializing) { 165 storeAlgorithmInEachRun = true; 166 } 147 167 148 168 [StorableHook(HookType.AfterDeserialization)] … … 158 178 clone.executionTime = executionTime; 159 179 clone.problem = (IProblem)cloner.Clone(problem); 180 clone.storeAlgorithmInEachRun = storeAlgorithmInEachRun; 160 181 clone.runsCounter = runsCounter; 161 182 clone.runs = (RunCollection)cloner.Clone(runs); … … 173 194 algorithm.executionTime = executionTime; 174 195 algorithm.problem = (IProblem)cloner.Clone(problem); 196 algorithm.storeAlgorithmInEachRun = storeAlgorithmInEachRun; 175 197 algorithm.runsCounter = runsCounter; 176 198 algorithm.runs = (RunCollection)cloner.Clone(runs); … … 234 256 if (handler != null) handler(this, EventArgs.Empty); 235 257 } 258 public event EventHandler StoreAlgorithmInEachRunChanged; 259 protected virtual void OnStoreAlgorithmInEachRunChanged() { 260 EventHandler handler = StoreAlgorithmInEachRunChanged; 261 if (handler != null) handler(this, EventArgs.Empty); 262 } 236 263 public event EventHandler Prepared; 237 264 protected virtual void OnPrepared() { -
trunk/sources/HeuristicLab.Optimization/3.3/Interfaces/IAlgorithm.cs
r4068 r4102 32 32 IProblem Problem { get; set; } 33 33 ResultCollection Results { get; } 34 bool StoreAlgorithmInEachRun { get; set; } 34 35 35 36 void CollectResultValues(IDictionary<string, IItem> values); 36 37 37 38 event EventHandler ProblemChanged; 39 event EventHandler StoreAlgorithmInEachRunChanged; 38 40 } 39 41 } -
trunk/sources/HeuristicLab.Optimization/3.3/Run.cs
r4068 r4102 90 90 name = algorithm.Name + " Run (" + algorithm.ExecutionTime.ToString() + ")"; 91 91 description = ItemDescription; 92 Initialize( (IAlgorithm)algorithm.Clone());92 Initialize(algorithm); 93 93 } 94 94 public Run(string name, IAlgorithm algorithm) … … 96 96 if (algorithm == null) throw new ArgumentNullException(); 97 97 description = ItemDescription; 98 Initialize( (IAlgorithm)algorithm.Clone());98 Initialize(algorithm); 99 99 } 100 100 public Run(string name, string description, IAlgorithm algorithm) 101 101 : base(name, description) { 102 102 if (algorithm == null) throw new ArgumentNullException(); 103 Initialize( (IAlgorithm)algorithm.Clone());103 Initialize(algorithm); 104 104 } 105 105 106 106 private void Initialize(IAlgorithm algorithm) { 107 this.algorithm = algorithm;107 IAlgorithm clone = (IAlgorithm)algorithm.Clone(); 108 108 parameters = new Dictionary<string, IItem>(); 109 109 results = new Dictionary<string, IItem>(); 110 this.algorithm.CollectParameterValues(parameters); 111 this.algorithm.CollectResultValues(results); 112 this.algorithm.Prepare(true); 110 clone.CollectParameterValues(parameters); 111 clone.CollectResultValues(results); 112 if (clone.StoreAlgorithmInEachRun) { 113 clone.Prepare(true); 114 this.algorithm = clone; 115 } 113 116 } 114 117
Note: See TracChangeset
for help on using the changeset viewer.