Changeset 12957 for branches/PerformanceComparison
- Timestamp:
- 09/19/15 21:21:13 (9 years ago)
- Location:
- branches/PerformanceComparison
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Views/3.3/ExpertSystemView.Designer.cs
r12860 r12957 48 48 this.runsView = new HeuristicLab.Optimization.Views.RunCollectionView(); 49 49 this.okbTabPage = new System.Windows.Forms.TabPage(); 50 this.algorithmInstancesViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost(); 51 this.problemInstancesTabPage = new System.Windows.Forms.TabPage(); 52 this.problemInstancesView = new HeuristicLab.Optimization.Views.RunCollectionBubbleChartView(); 50 53 this.openFileDialog = new System.Windows.Forms.OpenFileDialog(); 51 this.algorithmInstancesViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();52 54 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 53 55 this.tabControl.SuspendLayout(); … … 56 58 this.runsTabPage.SuspendLayout(); 57 59 this.okbTabPage.SuspendLayout(); 60 this.problemInstancesTabPage.SuspendLayout(); 58 61 this.SuspendLayout(); 59 62 // … … 98 101 this.tabControl.Controls.Add(this.runsTabPage); 99 102 this.tabControl.Controls.Add(this.okbTabPage); 103 this.tabControl.Controls.Add(this.problemInstancesTabPage); 100 104 this.tabControl.Location = new System.Drawing.Point(0, 52); 101 105 this.tabControl.Name = "tabControl"; … … 242 246 this.okbTabPage.UseVisualStyleBackColor = true; 243 247 // 244 // openFileDialog245 //246 this.openFileDialog.DefaultExt = "hl";247 this.openFileDialog.FileName = "Optimizer";248 this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*";249 this.openFileDialog.Title = "Open Optimizer";250 //251 248 // algorithmInstancesViewHost 252 249 // … … 263 260 this.algorithmInstancesViewHost.ViewType = null; 264 261 // 265 // ExpertSystemOptimizerView 262 // problemInstancesTabPage 263 // 264 this.problemInstancesTabPage.Controls.Add(this.problemInstancesView); 265 this.problemInstancesTabPage.Location = new System.Drawing.Point(4, 22); 266 this.problemInstancesTabPage.Name = "problemInstancesTabPage"; 267 this.problemInstancesTabPage.Padding = new System.Windows.Forms.Padding(3); 268 this.problemInstancesTabPage.Size = new System.Drawing.Size(538, 335); 269 this.problemInstancesTabPage.TabIndex = 6; 270 this.problemInstancesTabPage.Text = "Problem Instances"; 271 this.problemInstancesTabPage.UseVisualStyleBackColor = true; 272 // 273 // problemInstancesView 274 // 275 this.problemInstancesView.BackColor = System.Drawing.SystemColors.Window; 276 this.problemInstancesView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 277 this.problemInstancesView.Caption = "Bubble Chart"; 278 this.problemInstancesView.Content = null; 279 this.problemInstancesView.Dock = System.Windows.Forms.DockStyle.Fill; 280 this.problemInstancesView.Location = new System.Drawing.Point(3, 3); 281 this.problemInstancesView.Name = "problemInstancesView"; 282 this.problemInstancesView.ReadOnly = false; 283 this.problemInstancesView.Size = new System.Drawing.Size(532, 329); 284 this.problemInstancesView.TabIndex = 0; 285 // 286 // openFileDialog 287 // 288 this.openFileDialog.DefaultExt = "hl"; 289 this.openFileDialog.FileName = "Optimizer"; 290 this.openFileDialog.Filter = "HeuristicLab Files|*.hl|All Files|*.*"; 291 this.openFileDialog.Title = "Open Optimizer"; 292 // 293 // ExpertSystemView 266 294 // 267 295 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit; … … 269 297 this.Controls.Add(this.evaluationsLimitabel); 270 298 this.Controls.Add(this.maxEvaluationsTextBox); 271 this.Name = "ExpertSystem OptimizerView";299 this.Name = "ExpertSystemView"; 272 300 this.Size = new System.Drawing.Size(549, 413); 273 301 this.Controls.SetChildIndex(this.maxEvaluationsTextBox, 0); … … 284 312 this.runsTabPage.ResumeLayout(false); 285 313 this.okbTabPage.ResumeLayout(false); 314 this.problemInstancesTabPage.ResumeLayout(false); 286 315 this.ResumeLayout(false); 287 316 this.PerformLayout(); … … 307 336 private System.Windows.Forms.TabPage okbTabPage; 308 337 private MainForm.WindowsForms.ViewHost algorithmInstancesViewHost; 338 private System.Windows.Forms.TabPage problemInstancesTabPage; 339 private Optimization.Views.RunCollectionBubbleChartView problemInstancesView; 309 340 } 310 341 } -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem.Views/3.3/HeuristicLab.OptimizationExpertSystem.Views-3.3.csproj
r12860 r12957 73 73 </PropertyGroup> 74 74 <ItemGroup> 75 <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 76 <SpecificVersion>False</SpecificVersion> 77 <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath> 78 <Private>False</Private> 79 </Reference> 75 80 <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 76 81 <SpecificVersion>False</SpecificVersion> … … 121 126 <SpecificVersion>False</SpecificVersion> 122 127 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 128 <Private>False</Private> 129 </Reference> 130 <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 131 <SpecificVersion>False</SpecificVersion> 132 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath> 123 133 <Private>False</Private> 124 134 </Reference> -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/ExpertSystem.cs
r12860 r12957 67 67 public ItemList<IAlgorithm> AlgorithmInstances { 68 68 get { return algorithmInstances; } 69 set { 70 if (algorithmInstances == value) return; 71 algorithmInstances = value; 72 OnPropertyChanged("AlgorithmInstances"); 73 } 69 74 } 70 75 … … 86 91 public ReadOnlyItemList<IAlgorithm> SuggestedInstances { 87 92 get { return readOnlySuggestedInstances; } 93 } 94 95 [Storable] 96 private RunCollection problemInstances; 97 public RunCollection ProblemInstances { 98 get { return problemInstances; } 99 set { 100 if (problemInstances == value) return; 101 problemInstances = value; 102 OnPropertyChanged("ProblemInstances"); 103 } 88 104 } 89 105 … … 101 117 suggestedInstances = cloner.Clone(original.suggestedInstances); 102 118 readOnlySuggestedInstances = suggestedInstances.AsReadOnly(); 119 problemInstances = cloner.Clone(original.problemInstances); 103 120 RegisterEventHandlers(); 104 121 } … … 110 127 suggestedInstances = new ItemList<IAlgorithm>(); 111 128 readOnlySuggestedInstances = suggestedInstances.AsReadOnly(); 129 problemInstances = new RunCollection(); 112 130 RegisterEventHandlers(); 113 131 } … … 137 155 var runCollection = sender as RunCollection; 138 156 if (runCollection != null && runCollection.UpdateOfRunsInProgress) return; 157 UpdateInstanceMap(); 139 158 UpdateSuggestions(); 159 } 160 161 private void UpdateInstanceMap() { 162 var flaValues = ProblemInstances.ResultNames 163 .Where(x => x.StartsWith("Characteristic.") 164 && ProblemInstances.All(y => y.Results.ContainsKey(x) && y.Results[x] is DoubleValue)) 165 .Select(x => x).ToList(); 166 var ds = new double[ProblemInstances.Count, flaValues.Count]; 167 var instanceCounter = 0; 168 foreach (var instance in ProblemInstances) { 169 for (var feature = 0; feature < flaValues.Count; feature++) 170 ds[instanceCounter, feature] = ((DoubleValue)instance.Results[flaValues[feature]]).Value; 171 instanceCounter++; 172 } 173 174 int info; 175 double[] s2; 176 double[,] v; 177 alglib.pcabuildbasis(ds, instanceCounter, flaValues.Count, out info, out s2, out v); 178 179 var algInstRunDict = AlgorithmInstances.SelectMany(x => x.Runs) 180 .Where(x => x.Parameters.ContainsKey("Problem Name") && x.Parameters["Problem Name"] is StringValue) 181 .GroupBy(x => ((StringValue)x.Parameters["Problem Name"]).Value) 182 .ToDictionary(x => x.Key, x => x.GroupBy(y => ((StringValue)y.Parameters["Algorithm Name"]).Value) 183 .ToDictionary(y => y.Key, y => y.ToList())); 184 ProblemInstances.UpdateOfRunsInProgress = true; 185 try { 186 instanceCounter = 0; 187 foreach (var instance in ProblemInstances) { 188 IItem probNameParam; 189 if (!instance.Parameters.TryGetValue("Problem Name", out probNameParam)) continue; 190 var probInstanceName = ((StringValue)probNameParam).Value; 191 192 double x = 0, y = 0; 193 for (var feature = 0; feature < flaValues.Count; feature++) { 194 x += ds[instanceCounter, feature] * v[feature, 0]; 195 y += ds[instanceCounter, feature] * v[feature, 1]; 196 } 197 IItem item; 198 if (instance.Results.TryGetValue("Projection.PCA1", out item)) { 199 ((DoubleValue)item).Value = x; 200 } else instance.Results.Add("Projection.PCA1", new DoubleValue(x)); 201 if (instance.Results.TryGetValue("Projection.PCA2", out item)) { 202 ((DoubleValue)item).Value = y; 203 } else instance.Results.Add("Projection.PCA2", new DoubleValue(y)); 204 205 var bkQuality = ((DoubleValue)instance.Parameters["BestKnownQuality"]).Value; 206 var maximization = ((BoolValue)instance.Parameters["Maximization"]).Value; 207 foreach (var kvp in algInstRunDict[probInstanceName]) { 208 var algInstanceName = kvp.Key; 209 foreach (var run in kvp.Value) { 210 // TODO: Things needs to be configurable here (table name, targets) 211 foreach (var target in new[] { 1, 1.01, 1.05, 1.1, 1.2, 1.5 }) { 212 var result = ExpectedRuntimeHelper.CalculateErt(kvp.Value, "QualityPerEvaluations", bkQuality * target, maximization); 213 var resultName = algInstanceName + "@" + ((target - 1) * 100) + "%"; 214 if (run.Results.TryGetValue(resultName, out item)) 215 ((DoubleValue)item).Value = result.ExpectedRuntime; 216 else run.Results.Add(resultName, new DoubleValue(result.ExpectedRuntime)); 217 } 218 } 219 } 220 } 221 } finally { ProblemInstances.UpdateOfRunsInProgress = false; } 140 222 } 141 223 -
branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/HeuristicLab.OptimizationExpertSystem-3.3.csproj
r12860 r12957 73 73 </PropertyGroup> 74 74 <ItemGroup> 75 <Reference Include="ALGLIB-3.7.0, Version=3.7.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL"> 76 <SpecificVersion>False</SpecificVersion> 77 <HintPath>..\..\..\..\trunk\sources\bin\ALGLIB-3.7.0.dll</HintPath> 78 <Private>False</Private> 79 </Reference> 75 80 <Reference Include="HeuristicLab.Collections-3.3"> 76 81 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath>
Note: See TracChangeset
for help on using the changeset viewer.