Changeset 13551
- Timestamp:
- 01/19/16 08:49:23 (9 years ago)
- Location:
- branches/PerformanceComparison
- Files:
-
- 5 added
- 6 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r13475 r13551 198 198 <Compile Include="BasicProblems\Operators\SingleObjectiveMoveMaker.cs" /> 199 199 <Compile Include="BasicProblems\SingleObjectiveBasicProblem.cs" /> 200 <Compile Include="Interfaces\ICharacteristicCalculator.cs" /> 200 201 <Compile Include="Interfaces\ILocalImprovementAlgorithmOperator.cs" /> 201 202 <Compile Include="Interfaces\IMultiObjectiveOperator.cs" /> -
branches/PerformanceComparison/HeuristicLab.Optimization/3.3/Interfaces/ICharacteristicCalculator.cs
r13540 r13551 27 27 IEnumerable<string> Characteristics { get; } 28 28 bool CanCalculate(IProblem problem); 29 IEnumerable<KeyValuePair<string, double>> Calculate(IProblem problem, IEnumerable<string> characteristics = null);29 IEnumerable<KeyValuePair<string, IItem>> Calculate(IProblem problem, IEnumerable<string> characteristics = null); 30 30 } 31 31 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Views/3.3/ExpertSystemView.Designer.cs
r13485 r13551 34 34 /// </summary> 35 35 private void InitializeComponent() { 36 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ExpertSystemView));37 36 this.evaluationsLimitabel = new System.Windows.Forms.Label(); 38 37 this.maxEvaluationsTextBox = new System.Windows.Forms.TextBox(); … … 40 39 this.problemTabPage = new System.Windows.Forms.TabPage(); 41 40 this.problemViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 42 this.openProblemButton = new System.Windows.Forms.Button();43 this.newProblemButton = new System.Windows.Forms.Button();44 41 this.algorithmTabPage = new System.Windows.Forms.TabPage(); 45 42 this.algorithmViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); … … 47 44 this.suggestedInstancesComboBox = new System.Windows.Forms.ComboBox(); 48 45 this.runsTabPage = new System.Windows.Forms.TabPage(); 46 this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView(); 49 47 this.okbTabPage = new System.Windows.Forms.TabPage(); 50 this. algorithmInstancesViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();48 this.kbViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 51 49 this.problemInstancesTabPage = new System.Windows.Forms.TabPage(); 52 50 this.problemInstancesView = new HeuristicLab.MainForm.WindowsForms.ViewHost(); … … 54 52 this.dragFLAHereLabel = new System.Windows.Forms.Label(); 55 53 this.refreshMapButton = new System.Windows.Forms.Button(); 54 this.progressPanel = new System.Windows.Forms.Panel(); 55 this.okbDownloadButton = new System.Windows.Forms.Button(); 56 56 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 57 this.okbDownloadButton = new System.Windows.Forms.Button(); 58 this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView(); 59 this.progressPanel = new System.Windows.Forms.Panel(); 57 this.algorithmStartButton = new System.Windows.Forms.Button(); 60 58 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 61 59 this.tabControl.SuspendLayout(); … … 90 88 // maxEvaluationsTextBox 91 89 // 92 this.maxEvaluationsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 90 this.maxEvaluationsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 93 91 | System.Windows.Forms.AnchorStyles.Right))); 94 92 this.maxEvaluationsTextBox.Location = new System.Drawing.Point(75, 26); … … 101 99 // 102 100 this.tabControl.AllowDrop = true; 103 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 104 | System.Windows.Forms.AnchorStyles.Left) 101 this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 102 | System.Windows.Forms.AnchorStyles.Left) 105 103 | System.Windows.Forms.AnchorStyles.Right))); 106 104 this.tabControl.Controls.Add(this.problemTabPage); … … 109 107 this.tabControl.Controls.Add(this.okbTabPage); 110 108 this.tabControl.Controls.Add(this.problemInstancesTabPage); 111 this.tabControl.Location = new System.Drawing.Point(0, 52);109 this.tabControl.Location = new System.Drawing.Point(0, 81); 112 110 this.tabControl.Name = "tabControl"; 113 111 this.tabControl.SelectedIndex = 0; 114 this.tabControl.Size = new System.Drawing.Size(546, 3 61);112 this.tabControl.Size = new System.Drawing.Size(546, 332); 115 113 this.tabControl.TabIndex = 17; 116 114 // … … 119 117 this.problemTabPage.AllowDrop = true; 120 118 this.problemTabPage.Controls.Add(this.problemViewHost); 121 this.problemTabPage.Controls.Add(this.openProblemButton);122 this.problemTabPage.Controls.Add(this.newProblemButton);123 119 this.problemTabPage.Location = new System.Drawing.Point(4, 22); 124 120 this.problemTabPage.Name = "problemTabPage"; 125 121 this.problemTabPage.Padding = new System.Windows.Forms.Padding(3); 126 this.problemTabPage.Size = new System.Drawing.Size(538, 3 35);122 this.problemTabPage.Size = new System.Drawing.Size(538, 306); 127 123 this.problemTabPage.TabIndex = 1; 128 124 this.problemTabPage.Text = "Problem"; 129 125 this.problemTabPage.UseVisualStyleBackColor = true; 130 this.problemTabPage.DragDrop += new System.Windows.Forms.DragEventHandler(this.problemTabPage_DragDrop);131 this.problemTabPage.DragEnter += new System.Windows.Forms.DragEventHandler(this.problemTabPage_DragEnterOver);132 this.problemTabPage.DragOver += new System.Windows.Forms.DragEventHandler(this.problemTabPage_DragEnterOver);133 126 // 134 127 // problemViewHost 135 128 // 136 this.problemViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)137 | System.Windows.Forms.AnchorStyles.Left)138 | System.Windows.Forms.AnchorStyles.Right)));139 129 this.problemViewHost.Caption = "View"; 140 130 this.problemViewHost.Content = null; 131 this.problemViewHost.Dock = System.Windows.Forms.DockStyle.Fill; 141 132 this.problemViewHost.Enabled = false; 142 this.problemViewHost.Location = new System.Drawing.Point( 6, 36);133 this.problemViewHost.Location = new System.Drawing.Point(3, 3); 143 134 this.problemViewHost.Name = "problemViewHost"; 144 135 this.problemViewHost.ReadOnly = false; 145 this.problemViewHost.Size = new System.Drawing.Size(5 26, 293);136 this.problemViewHost.Size = new System.Drawing.Size(532, 300); 146 137 this.problemViewHost.TabIndex = 2; 147 this.problemViewHost.ViewsLabelVisible = true;138 this.problemViewHost.ViewsLabelVisible = false; 148 139 this.problemViewHost.ViewType = null; 149 140 // 150 // openProblemButton151 //152 this.openProblemButton.Image = ((System.Drawing.Image)(resources.GetObject("openProblemButton.Image")));153 this.openProblemButton.Location = new System.Drawing.Point(36, 6);154 this.openProblemButton.Name = "openProblemButton";155 this.openProblemButton.Size = new System.Drawing.Size(24, 24);156 this.openProblemButton.TabIndex = 1;157 this.toolTip.SetToolTip(this.openProblemButton, "Open Problem");158 this.openProblemButton.UseVisualStyleBackColor = true;159 this.openProblemButton.Click += new System.EventHandler(this.openProblemButton_Click);160 //161 // newProblemButton162 //163 this.newProblemButton.Image = ((System.Drawing.Image)(resources.GetObject("newProblemButton.Image")));164 this.newProblemButton.Location = new System.Drawing.Point(6, 6);165 this.newProblemButton.Name = "newProblemButton";166 this.newProblemButton.Size = new System.Drawing.Size(24, 24);167 this.newProblemButton.TabIndex = 0;168 this.toolTip.SetToolTip(this.newProblemButton, "New Problem");169 this.newProblemButton.UseVisualStyleBackColor = true;170 this.newProblemButton.Click += new System.EventHandler(this.newProblemButton_Click);171 //172 141 // algorithmTabPage 173 142 // 143 this.algorithmTabPage.Controls.Add(this.algorithmStartButton); 174 144 this.algorithmTabPage.Controls.Add(this.algorithmViewHost); 175 145 this.algorithmTabPage.Controls.Add(this.algorithmSuggestionLabel); … … 178 148 this.algorithmTabPage.Name = "algorithmTabPage"; 179 149 this.algorithmTabPage.Padding = new System.Windows.Forms.Padding(3); 180 this.algorithmTabPage.Size = new System.Drawing.Size(538, 3 35);150 this.algorithmTabPage.Size = new System.Drawing.Size(538, 306); 181 151 this.algorithmTabPage.TabIndex = 4; 182 152 this.algorithmTabPage.Text = "Algorithm"; … … 185 155 // algorithmViewHost 186 156 // 187 this.algorithmViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 188 | System.Windows.Forms.AnchorStyles.Left) 157 this.algorithmViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 158 | System.Windows.Forms.AnchorStyles.Left) 189 159 | System.Windows.Forms.AnchorStyles.Right))); 190 160 this.algorithmViewHost.Caption = "View"; … … 194 164 this.algorithmViewHost.Name = "algorithmViewHost"; 195 165 this.algorithmViewHost.ReadOnly = false; 196 this.algorithmViewHost.Size = new System.Drawing.Size(526, 2 93);166 this.algorithmViewHost.Size = new System.Drawing.Size(526, 264); 197 167 this.algorithmViewHost.TabIndex = 2; 198 168 this.algorithmViewHost.ViewsLabelVisible = true; … … 210 180 // suggestedInstancesComboBox 211 181 // 212 this.suggestedInstancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 182 this.suggestedInstancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 213 183 | System.Windows.Forms.AnchorStyles.Right))); 214 184 this.suggestedInstancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 216 186 this.suggestedInstancesComboBox.Location = new System.Drawing.Point(178, 6); 217 187 this.suggestedInstancesComboBox.Name = "suggestedInstancesComboBox"; 218 this.suggestedInstancesComboBox.Size = new System.Drawing.Size(3 54, 21);188 this.suggestedInstancesComboBox.Size = new System.Drawing.Size(322, 21); 219 189 this.suggestedInstancesComboBox.TabIndex = 0; 220 this.suggestedInstancesComboBox.SelectedIndexChanged += new System.EventHandler(this.suggestedInstancesComboBox_SelectedIndexChanged);221 190 // 222 191 // runsTabPage … … 226 195 this.runsTabPage.Name = "runsTabPage"; 227 196 this.runsTabPage.Padding = new System.Windows.Forms.Padding(3); 228 this.runsTabPage.Size = new System.Drawing.Size(538, 3 35);197 this.runsTabPage.Size = new System.Drawing.Size(538, 306); 229 198 this.runsTabPage.TabIndex = 3; 230 199 this.runsTabPage.Text = "Runs"; 231 200 this.runsTabPage.UseVisualStyleBackColor = true; 232 201 // 202 // runsView 203 // 204 this.runsView.Caption = "RunCollection View"; 205 this.runsView.Content = null; 206 this.runsView.Dock = System.Windows.Forms.DockStyle.Fill; 207 this.runsView.Location = new System.Drawing.Point(3, 3); 208 this.runsView.Name = "runsView"; 209 this.runsView.ReadOnly = false; 210 this.runsView.Size = new System.Drawing.Size(532, 300); 211 this.runsView.TabIndex = 1; 212 // 233 213 // okbTabPage 234 214 // 235 this.okbTabPage.Controls.Add(this.progressPanel); 236 this.okbTabPage.Controls.Add(this.okbDownloadButton); 237 this.okbTabPage.Controls.Add(this.algorithmInstancesViewHost); 215 this.okbTabPage.Controls.Add(this.kbViewHost); 238 216 this.okbTabPage.Location = new System.Drawing.Point(4, 22); 239 217 this.okbTabPage.Name = "okbTabPage"; 240 218 this.okbTabPage.Padding = new System.Windows.Forms.Padding(3); 241 this.okbTabPage.Size = new System.Drawing.Size(538, 3 35);219 this.okbTabPage.Size = new System.Drawing.Size(538, 306); 242 220 this.okbTabPage.TabIndex = 5; 243 221 this.okbTabPage.Text = "Knowledge Base"; 244 222 this.okbTabPage.UseVisualStyleBackColor = true; 245 223 // 246 // algorithmInstancesViewHost 247 // 248 this.algorithmInstancesViewHost.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 249 | System.Windows.Forms.AnchorStyles.Left) 250 | System.Windows.Forms.AnchorStyles.Right))); 251 this.algorithmInstancesViewHost.Caption = "View"; 252 this.algorithmInstancesViewHost.Content = null; 253 this.algorithmInstancesViewHost.Enabled = false; 254 this.algorithmInstancesViewHost.Location = new System.Drawing.Point(3, 35); 255 this.algorithmInstancesViewHost.Name = "algorithmInstancesViewHost"; 256 this.algorithmInstancesViewHost.ReadOnly = false; 257 this.algorithmInstancesViewHost.Size = new System.Drawing.Size(532, 297); 258 this.algorithmInstancesViewHost.TabIndex = 0; 259 this.algorithmInstancesViewHost.ViewsLabelVisible = true; 260 this.algorithmInstancesViewHost.ViewType = null; 224 // kbViewHost 225 // 226 this.kbViewHost.Caption = "View"; 227 this.kbViewHost.Content = null; 228 this.kbViewHost.Dock = System.Windows.Forms.DockStyle.Fill; 229 this.kbViewHost.Enabled = false; 230 this.kbViewHost.Location = new System.Drawing.Point(3, 3); 231 this.kbViewHost.Name = "kbViewHost"; 232 this.kbViewHost.ReadOnly = true; 233 this.kbViewHost.Size = new System.Drawing.Size(532, 300); 234 this.kbViewHost.TabIndex = 3; 235 this.kbViewHost.ViewsLabelVisible = true; 236 this.kbViewHost.ViewType = null; 261 237 // 262 238 // problemInstancesTabPage … … 268 244 this.problemInstancesTabPage.Name = "problemInstancesTabPage"; 269 245 this.problemInstancesTabPage.Padding = new System.Windows.Forms.Padding(3); 270 this.problemInstancesTabPage.Size = new System.Drawing.Size(538, 3 35);246 this.problemInstancesTabPage.Size = new System.Drawing.Size(538, 306); 271 247 this.problemInstancesTabPage.TabIndex = 6; 272 248 this.problemInstancesTabPage.Text = "Problem Instances"; … … 275 251 // problemInstancesView 276 252 // 277 this.problemInstancesView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 278 | System.Windows.Forms.AnchorStyles.Left) 253 this.problemInstancesView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 254 | System.Windows.Forms.AnchorStyles.Left) 279 255 | System.Windows.Forms.AnchorStyles.Right))); 280 256 this.problemInstancesView.Caption = "View"; … … 284 260 this.problemInstancesView.Name = "problemInstancesView"; 285 261 this.problemInstancesView.ReadOnly = false; 286 this.problemInstancesView.Size = new System.Drawing.Size(532, 2 98);262 this.problemInstancesView.Size = new System.Drawing.Size(532, 269); 287 263 this.problemInstancesView.TabIndex = 3; 288 264 this.problemInstancesView.ViewsLabelVisible = true; … … 292 268 // 293 269 this.instancesDropPanel.AllowDrop = true; 294 this.instancesDropPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 270 this.instancesDropPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 295 271 | System.Windows.Forms.AnchorStyles.Right))); 296 272 this.instancesDropPanel.BackColor = System.Drawing.Color.LightYellow; … … 326 302 this.refreshMapButton.Click += new System.EventHandler(this.refreshMapButton_Click); 327 303 // 304 // progressPanel 305 // 306 this.progressPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 307 | System.Windows.Forms.AnchorStyles.Left) 308 | System.Windows.Forms.AnchorStyles.Right))); 309 this.progressPanel.Location = new System.Drawing.Point(0, 81); 310 this.progressPanel.Name = "progressPanel"; 311 this.progressPanel.Size = new System.Drawing.Size(549, 332); 312 this.progressPanel.TabIndex = 2; 313 this.progressPanel.Visible = false; 314 // 315 // okbDownloadButton 316 // 317 this.okbDownloadButton.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 318 | System.Windows.Forms.AnchorStyles.Right))); 319 this.okbDownloadButton.Location = new System.Drawing.Point(6, 52); 320 this.okbDownloadButton.Name = "okbDownloadButton"; 321 this.okbDownloadButton.Size = new System.Drawing.Size(518, 23); 322 this.okbDownloadButton.TabIndex = 1; 323 this.okbDownloadButton.Text = "Download from OKB"; 324 this.okbDownloadButton.UseVisualStyleBackColor = true; 325 this.okbDownloadButton.Click += new System.EventHandler(this.okbDownloadButton_Click); 326 // 328 327 // openFileDialog 329 328 // … … 333 332 this.openFileDialog.Title = "Open Optimizer"; 334 333 // 335 // okbDownloadButton 336 // 337 this.okbDownloadButton.Location = new System.Drawing.Point(6, 6); 338 this.okbDownloadButton.Name = "okbDownloadButton"; 339 this.okbDownloadButton.Size = new System.Drawing.Size(146, 23); 340 this.okbDownloadButton.TabIndex = 1; 341 this.okbDownloadButton.Text = "Download from OKB"; 342 this.okbDownloadButton.UseVisualStyleBackColor = true; 343 this.okbDownloadButton.Click += new System.EventHandler(this.okbDownloadButton_Click); 344 // 345 // runsView 346 // 347 this.runsView.Caption = "RunCollection View"; 348 this.runsView.Content = null; 349 this.runsView.Dock = System.Windows.Forms.DockStyle.Fill; 350 this.runsView.Location = new System.Drawing.Point(3, 3); 351 this.runsView.Name = "runsView"; 352 this.runsView.ReadOnly = false; 353 this.runsView.Size = new System.Drawing.Size(532, 329); 354 this.runsView.TabIndex = 1; 355 // 356 // progressPanel 357 // 358 this.progressPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 359 | System.Windows.Forms.AnchorStyles.Left) 360 | System.Windows.Forms.AnchorStyles.Right))); 361 this.progressPanel.Location = new System.Drawing.Point(6, 35); 362 this.progressPanel.Name = "progressPanel"; 363 this.progressPanel.Size = new System.Drawing.Size(526, 294); 364 this.progressPanel.TabIndex = 2; 365 this.progressPanel.Visible = false; 334 // algorithmStartButton 335 // 336 this.algorithmStartButton.Location = new System.Drawing.Point(506, 5); 337 this.algorithmStartButton.Name = "algorithmStartButton"; 338 this.algorithmStartButton.Size = new System.Drawing.Size(26, 23); 339 this.algorithmStartButton.TabIndex = 3; 340 this.algorithmStartButton.Text = "Start"; 341 this.algorithmStartButton.UseVisualStyleBackColor = true; 342 this.algorithmStartButton.Click += new System.EventHandler(this.algorithmStartButton_Click); 366 343 // 367 344 // ExpertSystemView 368 345 // 369 346 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; 347 this.Controls.Add(this.okbDownloadButton); 370 348 this.Controls.Add(this.tabControl); 371 349 this.Controls.Add(this.evaluationsLimitabel); 372 350 this.Controls.Add(this.maxEvaluationsTextBox); 351 this.Controls.Add(this.progressPanel); 373 352 this.Name = "ExpertSystemView"; 374 353 this.Size = new System.Drawing.Size(549, 413); 354 this.Controls.SetChildIndex(this.progressPanel, 0); 375 355 this.Controls.SetChildIndex(this.maxEvaluationsTextBox, 0); 376 356 this.Controls.SetChildIndex(this.evaluationsLimitabel, 0); 377 357 this.Controls.SetChildIndex(this.tabControl, 0); 378 358 this.Controls.SetChildIndex(this.nameLabel, 0); 359 this.Controls.SetChildIndex(this.okbDownloadButton, 0); 379 360 this.Controls.SetChildIndex(this.nameTextBox, 0); 380 361 this.Controls.SetChildIndex(this.infoLabel, 0); … … 404 385 private System.Windows.Forms.TabPage problemTabPage; 405 386 private MainForm.WindowsForms.ViewHost problemViewHost; 406 private System.Windows.Forms.Button openProblemButton;407 private System.Windows.Forms.Button newProblemButton;408 387 private System.Windows.Forms.TabPage algorithmTabPage; 409 388 private MainForm.WindowsForms.ViewHost algorithmViewHost; … … 411 390 private System.Windows.Forms.ComboBox suggestedInstancesComboBox; 412 391 private System.Windows.Forms.TabPage okbTabPage; 413 private MainForm.WindowsForms.ViewHost algorithmInstancesViewHost;414 392 private System.Windows.Forms.TabPage problemInstancesTabPage; 415 393 private System.Windows.Forms.Panel instancesDropPanel; … … 419 397 private System.Windows.Forms.Button okbDownloadButton; 420 398 private System.Windows.Forms.Panel progressPanel; 399 private MainForm.WindowsForms.ViewHost kbViewHost; 400 private System.Windows.Forms.Button algorithmStartButton; 421 401 } 422 402 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Views/3.3/ExpertSystemView.cs
r13485 r13551 30 30 using HeuristicLab.MainForm; 31 31 using HeuristicLab.Optimization; 32 using HeuristicLab. PluginInfrastructure;32 using HeuristicLab.Optimization.Views; 33 33 34 34 namespace HeuristicLab.OptimizationExpertSystem.Views { … … 47 47 public ExpertSystemView() { 48 48 InitializeComponent(); 49 // brings progress panel to front (it is not visible by default, but obstructs other elements in designer) 50 this.Controls.SetChildIndex(this.progressPanel, 0); 51 algorithmStartButton.Text = string.Empty; 52 algorithmStartButton.Image = VSImageLibrary.Play; 49 53 refreshMapButton.Text = string.Empty; 50 54 refreshMapButton.Image = VSImageLibrary.Refresh; … … 60 64 61 65 protected override void DeregisterContentEvents() { 62 Content.PropertyChanged -= Content _PropertyChanged;66 Content.PropertyChanged -= ContentOnPropertyChanged; 63 67 Content.SuggestedInstances.CollectionReset -= SuggestedInstancesOnChanged; 64 68 Content.SuggestedInstances.ItemsAdded -= SuggestedInstancesOnChanged; … … 66 70 Content.SuggestedInstances.ItemsRemoved -= SuggestedInstancesOnChanged; 67 71 Content.SuggestedInstances.ItemsReplaced -= SuggestedInstancesOnChanged; 72 if (Content.Problem != null) Content.Problem.ProblemChanged -= ContentOnProblemChanged; 68 73 base.DeregisterContentEvents(); 69 74 } 70 75 protected override void RegisterContentEvents() { 71 76 base.RegisterContentEvents(); 72 Content.PropertyChanged += Content _PropertyChanged;77 Content.PropertyChanged += ContentOnPropertyChanged; 73 78 Content.SuggestedInstances.CollectionReset += SuggestedInstancesOnChanged; 74 79 Content.SuggestedInstances.ItemsAdded += SuggestedInstancesOnChanged; … … 76 81 Content.SuggestedInstances.ItemsRemoved += SuggestedInstancesOnChanged; 77 82 Content.SuggestedInstances.ItemsReplaced += SuggestedInstancesOnChanged; 83 if (Content.Problem != null) Content.Problem.ProblemChanged += ContentOnProblemChanged; 78 84 } 79 85 … … 89 95 algorithmViewHost.Content = null; 90 96 runsView.Content = null; 91 algorithmInstancesViewHost.Content = null;97 kbViewHost.Content = null; 92 98 problemInstancesView.Content = null; 93 99 } else { … … 95 101 problemViewHost.Content = Content.Problem; 96 102 runsView.Content = Content.Runs; 97 algorithmInstancesViewHost.Content = Content.AlgorithmInstances; 103 kbViewHost.ViewType = typeof(RunCollectionRLDView); 104 kbViewHost.Content = Content.KnowledgeBase; 98 105 problemInstancesView.Content = Content.ProblemInstances; 99 106 } … … 105 112 base.SetEnabledStateOfControls(); 106 113 maxEvaluationsTextBox.Enabled = Content != null && !ReadOnly && !Locked; 107 newProblemButton.Enabled = Content != null && !ReadOnly && !Locked; 108 openProblemButton.Enabled = Content != null && !ReadOnly && !Locked; 109 problemViewHost.Enabled = Content != null && !ReadOnly && !Locked; 110 suggestedInstancesComboBox.Enabled = Content != null && !ReadOnly && !Locked; 114 problemViewHost.Enabled = Content != null && !ReadOnly && !Locked && !okbDownloadInProgress; 115 suggestedInstancesComboBox.Enabled = Content != null && !ReadOnly && !Locked && !okbDownloadInProgress; 116 algorithmStartButton.Enabled = Content != null && !ReadOnly && !Locked && suggestedInstancesComboBox.SelectedIndex >= 0; 111 117 algorithmViewHost.Enabled = Content != null && !ReadOnly && !Locked; 112 118 runsView.Enabled = Content != null; 113 algorithmInstancesViewHost.Enabled = Content != null && !okbDownloadInProgress; 119 kbViewHost.Enabled = Content != null && !okbDownloadInProgress; 120 problemInstancesView.Enabled = Content != null && !okbDownloadInProgress; 114 121 refreshMapButton.Enabled = Content != null; 115 okbDownloadButton.Enabled = Content != null && Content.Problem != null && !ReadOnly && !Locked && !okbDownloadInProgress;122 okbDownloadButton.Enabled = Content != null && Content.Problem != null && Content.Problem.ProblemId >= 0 && !ReadOnly && !Locked && !okbDownloadInProgress; 116 123 } 117 124 … … 134 141 #region Event Handlers 135 142 #region Content events 136 private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) { 143 private void ContentOnProblemChanged(object sender, EventArgs eventArgs) { 144 UpdateSuggestedInstancesCombobox(); 145 SetEnabledStateOfControls(); 146 } 147 148 private void ContentOnPropertyChanged(object sender, PropertyChangedEventArgs e) { 137 149 if (InvokeRequired) { 138 Invoke((Action<object, PropertyChangedEventArgs>)Content _PropertyChanged, sender, e);150 Invoke((Action<object, PropertyChangedEventArgs>)ContentOnPropertyChanged, sender, e); 139 151 return; 140 152 } … … 142 154 try { 143 155 switch (e.PropertyName) { 144 case " AlgorithmInstances": algorithmInstancesViewHost.Content = Content.AlgorithmInstances; break;156 case "KnowledgeBase": kbViewHost.Content = Content.KnowledgeBase; break; 145 157 case "MaximumEvaluations": maxEvaluationsTextBox.Text = Content.MaximumEvaluations.ToString(); break; 146 case "Problem": problemViewHost.Content = Content.Problem; break; 158 case "Problem": 159 problemViewHost.Content = Content.Problem; 160 Content.Problem.ProblemChanged += ContentOnProblemChanged; 161 break; 147 162 case "ProblemInstances": problemInstancesView.Content = Content.ProblemInstances; break; 148 163 } … … 172 187 errorProvider.SetError(maxEvaluationsTextBox, null); 173 188 } 174 }175 176 private void newProblemButton_Click(object sender, EventArgs e) {177 if (problemTypeSelectorDialog == null) {178 problemTypeSelectorDialog = new TypeSelectorDialog { Caption = "Select Problem" };179 problemTypeSelectorDialog.TypeSelector.Caption = "Available Problems";180 problemTypeSelectorDialog.TypeSelector.Configure(typeof(ISingleObjectiveHeuristicOptimizationProblem)181 , showNotInstantiableTypes: false, showGenericTypes: false);182 }183 if (problemTypeSelectorDialog.ShowDialog(this) == DialogResult.OK) {184 try {185 Content.Problem = (ISingleObjectiveHeuristicOptimizationProblem)problemTypeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();186 } catch (Exception ex) {187 ErrorHandling.ShowErrorDialog(this, ex);188 }189 }190 }191 192 private void openProblemButton_Click(object sender, EventArgs e) {193 openFileDialog.Title = "Open Problem";194 if (openFileDialog.ShowDialog(this) == DialogResult.OK) {195 newProblemButton.Enabled = openProblemButton.Enabled = false;196 problemViewHost.Enabled = false;197 198 ContentManager.LoadAsync(openFileDialog.FileName, delegate(IStorableContent content, Exception error) {199 try {200 if (error != null) throw error;201 var problem = content as ISingleObjectiveHeuristicOptimizationProblem;202 if (problem == null) {203 var algorithm = content as IAlgorithm;204 if (algorithm == null || !(algorithm.Problem is ISingleObjectiveHeuristicOptimizationProblem))205 MessageBox.Show(this, "The selected file is not a problem, nor an algorithm with a problem.", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error);206 else Content.Problem = (ISingleObjectiveHeuristicOptimizationProblem)algorithm.Problem;207 } else208 Content.Problem = problem;209 } catch (Exception ex) {210 ErrorHandling.ShowErrorDialog(this, ex);211 } finally {212 Invoke(new Action(delegate() {213 problemViewHost.Enabled = true;214 newProblemButton.Enabled = openProblemButton.Enabled = true;215 }));216 }217 });218 }219 }220 221 private void problemTabPage_DragEnterOver(object sender, DragEventArgs e) {222 e.Effect = DragDropEffects.None;223 var prob = e.Data.GetData(Constants.DragDropDataFormat) as ISingleObjectiveHeuristicOptimizationProblem;224 if (!ReadOnly && prob != null) {225 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key226 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key227 else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;228 else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;229 else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;230 }231 }232 233 private void problemTabPage_DragDrop(object sender, DragEventArgs e) {234 if (e.Effect != DragDropEffects.None) {235 var prob = e.Data.GetData(Constants.DragDropDataFormat) as ISingleObjectiveHeuristicOptimizationProblem;236 if (e.Effect.HasFlag(DragDropEffects.Copy)) prob = (ISingleObjectiveHeuristicOptimizationProblem)prob.Clone();237 Content.Problem = prob;238 }239 }240 241 private void suggestedInstancesComboBox_SelectedIndexChanged(object sender, EventArgs e) {242 if (SuppressEvents) return;243 if (InvokeRequired) { Invoke((Action<object, EventArgs>)suggestedInstancesComboBox_SelectedIndexChanged, sender, e); return; }244 if (suggestedInstancesComboBox.SelectedIndex >= 0)245 algorithmViewHost.Content = (IAlgorithm)suggestedInstancesComboBox.SelectedItem;246 else algorithmViewHost.Content = null;247 189 } 248 190 #endregion … … 290 232 291 233 private void okbDownloadButton_Click(object sender, EventArgs e) { 234 if (Content.Problem.ProblemId < 0) { 235 MessageBox.Show("Please select a problem instance first."); 236 return; 237 } 292 238 var progress = new Progress(); 293 239 progress.ProgressStateChanged += OkbDownloadProgressOnStateChanged; … … 307 253 } 308 254 } 255 256 private void algorithmStartButton_Click(object sender, EventArgs e) { 257 var selectedInstance = (IAlgorithm)suggestedInstancesComboBox.SelectedItem; 258 var clone = (IAlgorithm)selectedInstance.Clone(); 259 clone.Prepare(true); 260 clone.Start(); 261 algorithmViewHost.Content = clone.Results; 262 } 309 263 } 310 264 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Views/3.3/ExpertSystemView.resx
r13485 r13551 127 127 <value>140, 17</value> 128 128 </metadata> 129 <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />130 <data name="openProblemButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">131 <value>132 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6133 JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsMAAALDAE/QCLIAAACeUlE134 QVQ4T6WSWUiUURiG/4suurJIjUIwskQsEAMjqosQpUVNKbdCSRPKrQVDMddmXEedGdcpFXNGnUYdrSzF135 sEIoFInQcqHE1CwoKsXUUMnt6XfEye0munjgnO+c9+HjO0cA/osNi2tJLdA6SXN13MwoI12lJ06uiV8+136 W3d5IwIjVXiGKvwX11djSs2TRFlUito7ILIAoVab7SvCWhqrZYq1omXC4gpPe4Ur8AjNMQjo69IwPVZj137 4PeojtlhNfoyBXXalKSNBJ5hSjxCcnELzkeoKVcyNVq5Kjz/rZDZnggqSzOoKEpDXZBEcU4id+Sx5Mui138 RcdfmVClyWLqh8YYXhDD9MVCT/CGrBPcK5Hx62uxMdxUm2XgiT6Tep2MhxVp6NXJ6IqllKlucTc3niJl139 LKqsGINMqChOY+JTnqHtwRYJdZVK5gelMJSymo9ibSAOeiPhXTid1T5cD3IvF9SqZMb7M+CznEdVCtqe140 ypcurWz9bQC0ezHX6sr0M0c+lNtx5cKJcVGwXyjJlfDzvZSh1gTqdHIWBiTQHbIU7AwSg+eYa3Nnuvk4141 E41HGak9gDTUmvPOZjmGGRQqExjpiuG+NouOl2InvRGi4BJ0+LPw6gwzL04x2XSM0ToHvlfZ0p66FT9X142 KxxsTGwMAlVmLN3NiTzQZkJ/IrwR233tzUyLG5PPHRmrP8Sw3o4vmr30yE2RBO/Bfp9Fg/EV8tKjqSnL143 oOdxGO3ZgpE2+SaaZZtpSNpCdbw56mgLbt/YhZ/L7oVD9pYuRkF2ShTZksukxwQSd813cbJc9HHm7MnD144 OB2x46CdNbZWFljuNGP7NhN2mJqIuRX/YOXm30H4A70P0TsBWkcYAAAAAElFTkSuQmCC145 </value>146 </data>147 <data name="newProblemButton.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">148 <value>149 iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6150 JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAACXBIWXMAAAsMAAALDAE/QCLIAAABmElE151 QVQ4T42QTUsCURSGJWgVtWkb9AfatKhN1L4I2rRoX9BvEIJ+QG4qFNKKCAMtEPqAUMiKamESEmpoWiKa152 YuZnmuOo83bufKUYgy+8c849957n3jk6ALJXOWAxBAulfrKwEAOW+L/9/y0locEzXs9SI3BB8UXKxVp1153 +lg5/J+lJDLwpDYckE91Uk61YngKDncAdqcP1nMP80YXgDdQMJI32ZLJJr3ETLYpNWD35AaTcysdEPFD154 T24gPSxgi5bs/9/7gWuK3DiQGGG9ooxWJ1wPAQVioJIMaM571V9gN9Lt6kywTpa0fXgpNismyYDKzK3a155 sEcx2ifmUm2HLKnRbIkQBUSSAcy5sTVEhkxw0DI5CuT0QMXCDokSBAHVGo9MrioCJmaXWbkNIHvfcUeh156 W3W+iXyphni6pA0w290UOtVsCShX60hlK3iN57UBpiMXhU7VuAayhR/EPorwR7LaALbZLja44jeHRKaM157 UCwHbzDdO6B9cNFEAc/hT9z7kr0D2gcXfPuCx5/C1WO8NwCLWtYEsM1eDED3C6WCFYVQ3tbcAAAAAElF158 TkSuQmCC159 </value>160 </data>161 129 <metadata name="openFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 162 130 <value>230, 17</value> -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/ExpertSystem.cs
r13485 r13551 28 28 using System.Threading.Tasks; 29 29 using HeuristicLab.Analysis; 30 using HeuristicLab.Collections; 30 31 using HeuristicLab.Common; 31 32 using HeuristicLab.Common.Resources; … … 36 37 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 37 38 using HeuristicLab.Persistence.Default.Xml; 39 using RunCreationClient = HeuristicLab.Clients.OKB.RunCreation.RunCreationClient; 40 using SingleObjectiveOKBProblem = HeuristicLab.Clients.OKB.RunCreation.SingleObjectiveOKBProblem; 38 41 39 42 namespace HeuristicLab.OptimizationExpertSystem { … … 68 71 69 72 [Storable] 70 private ItemList<IAlgorithm> algorithmInstances;71 public ItemList<IAlgorithm> AlgorithmInstances{72 get { return algorithmInstances; }73 private RunCollection knowledgeBase; 74 public RunCollection KnowledgeBase { 75 get { return knowledgeBase; } 73 76 set { 74 if (algorithmInstances == value) return; 75 algorithmInstances = value; 76 OnPropertyChanged("AlgorithmInstances"); 77 // TODO: Attach event handlers 78 } 79 } 80 81 [Storable] 82 private ISingleObjectiveHeuristicOptimizationProblem problem; 83 public ISingleObjectiveHeuristicOptimizationProblem Problem { 77 if (knowledgeBase == value) return; 78 knowledgeBase = value; 79 OnPropertyChanged("KnowledgeBase"); 80 } 81 } 82 83 [Storable] 84 private SingleObjectiveOKBProblem problem; 85 public SingleObjectiveOKBProblem Problem { 84 86 get { return problem; } 85 87 set { … … 109 111 } 110 112 113 [Storable] 114 private BidirectionalLookup<long, IRun> algorithmId2RunMapping; 115 [Storable] 116 private BidirectionalDictionary<long, IAlgorithm> algorithmId2AlgorithmInstanceMapping; 117 111 118 private bool Maximization { 112 get { return Problem != null && ((IValueParameter<BoolValue>)Problem.MaximizationParameter).Value.Value; } 119 get { 120 return Problem != null && Problem.ProblemId >= 0 && ((IValueParameter<BoolValue>)Problem.MaximizationParameter).Value.Value; 121 } 113 122 } 114 123 … … 118 127 : base(original, cloner) { 119 128 runs = cloner.Clone(original.runs); 120 algorithmInstances = cloner.Clone(original.algorithmInstances); 121 problem = cloner.Clone(original.problem); 129 knowledgeBase = cloner.Clone(original.knowledgeBase); 122 130 suggestedInstances = cloner.Clone(original.suggestedInstances); 123 131 readOnlySuggestedInstances = suggestedInstances.AsReadOnly(); 124 132 problemInstances = cloner.Clone(original.problemInstances); 133 problem = cloner.Clone(original.problem); 134 algorithmId2RunMapping = new BidirectionalLookup<long, IRun>(); 135 foreach (var kvp in original.algorithmId2RunMapping.FirstEnumerable) { 136 algorithmId2RunMapping.AddRangeFirst(kvp.Key, kvp.Select(cloner.Clone)); 137 } 138 algorithmId2AlgorithmInstanceMapping = new BidirectionalDictionary<long, IAlgorithm>(); 139 foreach (var kvp in original.algorithmId2AlgorithmInstanceMapping) { 140 algorithmId2AlgorithmInstanceMapping.Add(kvp.Key, cloner.Clone(kvp.Value)); 141 } 125 142 RegisterEventHandlers(); 126 143 } … … 129 146 Description = ItemDescription; 130 147 runs = new RunCollection(); 131 algorithmInstances = new ItemList<IAlgorithm>();148 knowledgeBase = new RunCollection(); 132 149 suggestedInstances = new ItemList<IAlgorithm>(); 133 150 readOnlySuggestedInstances = suggestedInstances.AsReadOnly(); 134 151 problemInstances = new RunCollection(); 152 problem = new SingleObjectiveOKBProblem(); 153 algorithmId2RunMapping = new BidirectionalLookup<long, IRun>(); 154 algorithmId2AlgorithmInstanceMapping = new BidirectionalDictionary<long, IAlgorithm>(); 135 155 RegisterEventHandlers(); 156 } 157 158 private void ProblemOnProblemChanged(object sender, EventArgs eventArgs) { 159 if (Problem == null) return; 136 160 } 137 161 … … 147 171 148 172 private void RegisterEventHandlers() { 173 problem.ProblemChanged += ProblemOnProblemChanged; 149 174 runs.CollectionReset += InformationChanged; 150 175 runs.ItemsAdded += InformationChanged; … … 152 177 runs.Reset += InformationChanged; 153 178 runs.UpdateOfRunsInProgressChanged += InformationChanged; 154 algorithmInstances.CollectionReset += InformationChanged;155 algorithmInstances.ItemsAdded += InformationChanged;156 algorithmInstances.ItemsRemoved += InformationChanged;179 knowledgeBase.CollectionReset += InformationChanged; 180 knowledgeBase.ItemsAdded += InformationChanged; 181 knowledgeBase.ItemsRemoved += InformationChanged; 157 182 } 158 183 … … 181 206 alglib.pcabuildbasis(ds, instanceCounter, flaValues.Count, out info, out s2, out v); 182 207 183 var algInstRunDict = AlgorithmInstances.SelectMany(x => x.Runs)184 .Where(x => x.Parameters.ContainsKey("Problem Name") && x.Parameters["Problem Name"] is StringValue)185 .GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value)186 .ToDictionary(x => x.Key, x => x.GroupBy(y => ((StringValue)y.Parameters["Algorithm Name"]).Value)187 .ToDictionary(y => y.Key, y => y.ToList()));188 208 ProblemInstances.UpdateOfRunsInProgress = true; 189 209 try { 190 210 instanceCounter = 0; 191 211 foreach (var instance in ProblemInstances) { 192 IItem probNameParam;193 if (!instance.Parameters.TryGetValue("Problem Name", out probNameParam)) continue;194 var probInstanceName = ((StringValue)probNameParam).Value;195 196 212 double x = 0, y = 0; 197 213 for (var feature = 0; feature < flaValues.Count; feature++) { … … 208 224 209 225 instanceCounter++; 210 226 } 227 } finally { ProblemInstances.UpdateOfRunsInProgress = false; } 228 } 229 230 private static readonly HashSet<string> InterestingValueNames = new HashSet<string>() { 231 "QualityPerEvaluations", "Problem Name", "Problem Type", "Algorithm Name", "Algorithm Type", "Maximization", "BestKnownQuality" 232 }; 233 234 public async void UpdateKnowledgeBaseAsync(IProgress progress) { 235 progress.Start("Updating Knowledge Base from OKB"); 236 await Task.Factory.StartNew(() => { DoUpdateKnowledgeBase(progress); }, TaskCreationOptions.LongRunning); 237 } 238 239 public void UpdateKnowledgeBase() { 240 DoUpdateKnowledgeBase(new Progress(string.Empty, ProgressState.Started)); 241 } 242 243 private void DoUpdateKnowledgeBase(IProgress progress) { 244 var queryClient = Clients.OKB.Query.QueryClient.Instance; 245 var adminClient = Clients.OKB.Administration.AdministrationClient.Instance; 246 try { 247 progress.Status = "Downloading run information..."; 248 progress.ProgressValue = 0; 249 // FIXME: How to tell if refresh is necessary? 250 queryClient.Refresh(); 251 progress.ProgressValue = 0.5; 252 progress.Status = "Downloading algorithm and problem instance information..."; 253 // FIXME: How to tell if refresh is necessary? 254 adminClient.Refresh(); 255 256 var probInstance = adminClient.Problems.SingleOrDefault(x => x.Id == Problem.ProblemId); 257 if (probInstance == null) throw new InvalidOperationException("The chosen problem instance cannot be found in the OKB."); 258 var probClassId = probInstance.ProblemClassId; 259 260 var problemClassFilter = (Clients.OKB.Query.StringComparisonAvailableValuesFilter)queryClient.Filters.Single(x => x.Label == "Problem Class Name"); 261 problemClassFilter.Value = adminClient.ProblemClasses.Single(x => x.Id == probClassId).Name; 262 263 progress.Status = "Downloading problem instances..."; 264 progress.ProgressValue = 0; 265 var p = 0; 266 ProblemInstances.UpdateOfRunsInProgress = true; 267 ProblemInstances.Clear(); 268 var totalProblems = adminClient.Problems.Count(x => x.ProblemClassId == probClassId); 269 foreach (var problInst in adminClient.Problems.Where(x => x.ProblemClassId == probClassId)) { 270 progress.Status = string.Format("Downloading problem {0} (okb-id: {1})....", problInst.Name, problInst.Id); 271 var data = Clients.OKB.Administration.AdministrationClient.GetProblemData(problInst.Id); 272 if (data != null) { 273 using (var stream = new MemoryStream(data)) { 274 try { 275 var prob = (IProblem)XmlParser.Deserialize<IContent>(stream); 276 var probRun = new Run() { Name = prob.Name }; 277 prob.CollectParameterValues(probRun.Parameters); 278 progress.Status += Environment.NewLine + "Downloading characteristics..."; 279 foreach (var v in RunCreationClient.GetCharacteristicValues(problInst.Id)) { 280 probRun.Results.Add("Characteristic." + v.Name, RunCreationClient.Instance.ConvertToItem(v)); 281 } 282 ProblemInstances.Add(probRun); 283 } catch { } 284 stream.Close(); 285 } 286 } 287 p++; 288 progress.ProgressValue = p / (double)totalProblems; 289 } 290 291 algorithmId2AlgorithmInstanceMapping.Clear(); 292 progress.Status = "Downloading algorithm instances..."; 293 progress.ProgressValue = 0; 294 p = 0; 295 foreach (var algInst in adminClient.Algorithms) { 296 progress.Status = string.Format("Downloading algorithm {0} (okb-id: {1})...", algInst.Name, algInst.Id); 297 var data = Clients.OKB.Administration.AdministrationClient.GetAlgorithmData(algInst.Id); 298 if (data != null) { 299 using (var stream = new MemoryStream(data)) { 300 try { 301 var alg = (IAlgorithm)XmlParser.Deserialize<IContent>(stream); 302 algorithmId2AlgorithmInstanceMapping.Add(algInst.Id, alg); 303 } catch { } 304 stream.Close(); 305 } 306 } 307 p++; 308 progress.ProgressValue = p / (double)adminClient.Algorithms.Count; 309 } 310 311 var interestingValues = queryClient.ValueNames.Where(x => InterestingValueNames.Contains(x.Name)).ToList(); 312 313 progress.Status = "Obtaining number of runs..."; 314 progress.ProgressValue = 0; 315 p = 0; 316 var count = queryClient.GetNumberOfRuns(problemClassFilter); 317 if (count == 0) return; 318 319 var runIds = queryClient.GetRunIds(problemClassFilter).ToList(); 320 var conversions = new List<Task>(); 321 var runList = new List<IRun>(); 322 while (p < count) { 323 var nextIds = runIds.Skip(p).Take(500).ToList(); 324 progress.Status = string.Format("Downloading runs {0} to {1} of {2}...", p, p + nextIds.Count, count); 325 var okbRuns = queryClient.GetRunsWithValues(nextIds, true, interestingValues); 326 conversions.Add(Task.Factory.StartNew(() => { 327 var hlRuns = okbRuns.AsParallel().Select(x => new { AlgorithmId = x.Algorithm.Id, Run = queryClient.ConvertToOptimizationRun(x) }).ToList(); 328 lock (runList) { 329 foreach (var r in hlRuns) { 330 algorithmId2RunMapping.Add(r.AlgorithmId, r.Run); 331 runList.Add(r.Run); 332 } 333 } 334 })); 335 p += nextIds.Count; 336 progress.ProgressValue = p / (double)count; 337 } 338 Task.WaitAll(conversions.ToArray()); 339 340 progress.Status = "Finishing..."; 341 var algInstRunDict = runList.Where(x => x.Parameters.ContainsKey("Problem Name") && x.Parameters["Problem Name"] is StringValue) 342 .GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value) 343 .ToDictionary(x => x.Key, x => x.GroupBy(y => ((StringValue)y.Parameters["Algorithm Name"]).Value) 344 .ToDictionary(y => y.Key, y => y.ToList())); 345 346 foreach (var instance in ProblemInstances) { 347 IItem probNameParam; 348 if (!instance.Parameters.TryGetValue("Problem Name", out probNameParam)) continue; 349 350 var probInstanceName = ((StringValue)probNameParam).Value; 211 351 var bkQuality = ((DoubleValue)instance.Parameters["BestKnownQuality"]).Value; 212 352 var maximization = ((BoolValue)instance.Parameters["Maximization"]).Value; … … 219 359 var result = ExpectedRuntimeHelper.CalculateErt(kvp.Value, "QualityPerEvaluations", bkQuality * target, maximization); 220 360 var resultName = algInstanceName + "@" + ((target - 1) * 100) + "%"; 361 IItem item; 221 362 if (instance.Results.TryGetValue(resultName, out item)) { 222 363 ((DoubleValue)item).Value = Math.Log10(result.ExpectedRuntime); … … 225 366 } 226 367 } 227 } finally { ProblemInstances.UpdateOfRunsInProgress = false; } 228 } 229 230 private static readonly HashSet<string> InterestingValueNames = new HashSet<string>() { 231 "QualityPerEvaluations", "Problem Name", "Problem Type", "Algorithm Name", "Algorithm Type", "Maximization" 232 }; 233 234 public async void UpdateKnowledgeBaseAsync(IProgress progress) { 235 progress.Start("Updating Knowledge Base from OKB"); 236 await Task.Factory.StartNew(() => { DoUpdateKnowledgeBase(progress); }, TaskCreationOptions.LongRunning); 237 } 238 239 public void UpdateKnowledgeBase() { 240 DoUpdateKnowledgeBase(new Progress(string.Empty, ProgressState.Started)); 241 } 242 243 private void DoUpdateKnowledgeBase(IProgress progress) { 244 var queryClient = Clients.OKB.Query.QueryClient.Instance; 245 var adminClient = Clients.OKB.Administration.AdministrationClient.Instance; 246 try { 247 progress.Status = "Refreshing query client..."; 248 queryClient.Refresh(); 249 var interestingValues = queryClient.ValueNames.Where(x => InterestingValueNames.Contains(x.Name)).ToList(); 250 251 var problemTypeFilter = (Clients.OKB.Query.StringComparisonAvailableValuesFilter)queryClient.Filters.Single(x => x.Label == "Problem Data Type Name"); 252 problemTypeFilter.Value = Problem.GetType().Name; 253 254 progress.Status = "Obtaining number of runs..."; 255 var count = queryClient.GetNumberOfRuns(problemTypeFilter); 256 if (count == 0) return; 257 258 var runIds = queryClient.GetRunIds(problemTypeFilter).ToList(); 259 adminClient.Refresh(); 260 var i = 0; 261 var conversions = new List<Task>(); 262 var runGroup = new Dictionary<Tuple<long, string>, List<IRun>>(); 263 while (i < count) { 264 var nextIds = runIds.Skip(i).Take(500).ToList(); 265 progress.Status = string.Format("Downloading runs {0} to {1} of {2}...", i, i + nextIds.Count, count); 266 var okbRuns = queryClient.GetRunsWithValues(nextIds, true, interestingValues); 267 conversions.Add(Task.Factory.StartNew(() => { 268 var hlRuns = okbRuns.AsParallel().Select(x => new { Id = x.Algorithm.Id, Name = x.Algorithm.Name, Run = queryClient.ConvertToOptimizationRun(x) }) 269 .GroupBy(x => Tuple.Create(x.Id, x.Name)).ToList(); 270 lock (runGroup) { 271 foreach (var hr in hlRuns) { 272 List<IRun> runList; 273 if (!runGroup.TryGetValue(hr.Key, out runList)) { 274 runList = new List<IRun>(); 275 runGroup[hr.Key] = runList; 276 } 277 runList.AddRange(hr.Select(x => x.Run)); 278 } 279 } 280 })); 281 i += nextIds.Count; 282 progress.ProgressValue = 0.8 * (i / (double)count); 283 } 284 Task.WaitAll(conversions.ToArray()); 285 var list = new ItemList<IAlgorithm>(); 286 i = 0; 287 foreach (var rGroup in runGroup) { 288 progress.Status = string.Format("Downloading algorithm {0}...", rGroup.Key.Item2); 289 var data = Clients.OKB.Administration.AdministrationClient.GetAlgorithmData(rGroup.Key.Item1); 290 if (data != null) { 291 using (var stream = new MemoryStream(data)) { 292 try { 293 var alg = (IAlgorithm)XmlParser.Deserialize<IContent>(stream); 294 alg.Runs.AddRange(rGroup.Value); 295 list.Add(alg); 296 } catch (Exception) { } 297 stream.Close(); 298 } 299 } 300 i++; 301 progress.ProgressValue = 0.8 + 0.2 * (i / (double)runGroup.Count); 302 } 303 AlgorithmInstances = list; 304 } finally { progress.Finish(); } 368 KnowledgeBase = new RunCollection(runList); 369 } finally { progress.Finish(); ProblemInstances.UpdateOfRunsInProgress = false; } 305 370 } 306 371 … … 308 373 if (Problem == null) return; 309 374 var instances = new SortedList<double, IAlgorithm>(); 310 foreach (var instance in algorithmInstances) { 311 var relevantRuns = instance.Runs.Where(x => ((StringValue)x.Parameters["Problem Type"]).Value == Problem.GetType().Name); 375 foreach (var relevantRuns in knowledgeBase.GroupBy(x => x.Algorithm)) { 312 376 var avgQuality = 0.0; 313 377 var counter = 0; … … 320 384 } 321 385 avgQuality /= counter; 322 instances.Add(avgQuality, instance);386 instances.Add(avgQuality, relevantRuns.Key); 323 387 } 324 388 325 389 suggestedInstances.Clear(); 326 var instanceLadder = instances.Select(x => x.Value);390 var instanceLadder = instances.Select(x => (IAlgorithm)x.Value.Clone()); 327 391 suggestedInstances.AddRange(Maximization ? instanceLadder.Reverse() : instanceLadder); 328 392 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/HeuristicLab.OptimizationExpertSystem-3.3.csproj
r13485 r13551 117 117 <Private>False</Private> 118 118 </Reference> 119 <Reference Include="HeuristicLab.Problems.Instances-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 120 <SpecificVersion>False</SpecificVersion> 121 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances-3.3.dll</HintPath> 122 <Private>False</Private> 123 </Reference> 124 <Reference Include="HeuristicLab.Problems.QuadraticAssignment-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 125 <SpecificVersion>False</SpecificVersion> 126 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.QuadraticAssignment-3.3.dll</HintPath> 127 <Private>False</Private> 128 </Reference> 119 129 <Reference Include="System" /> 120 130 <Reference Include="System.Core" /> … … 131 141 <Compile Include="Plugin.cs" /> 132 142 <None Include="Properties\AssemblyInfo.cs.frame" /> 143 <Compile Include="ProblemCharacteristicAnalysis\CharacteristicCalculator.cs" /> 144 <Compile Include="ProblemCharacteristicAnalysis\DoubleMatrixCharacteristicCalculator.cs" /> 145 <Compile Include="ProblemCharacteristicAnalysis\QAP\QAPCharacteristicCalculator.cs" /> 133 146 <Compile Include="Properties\AssemblyInfo.cs" /> 134 147 </ItemGroup>
Note: See TracChangeset
for help on using the changeset viewer.