- Timestamp:
- 10/07/11 23:45:06 (13 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/GP.Grammar.Editor/HeuristicLab.Problems.QuadraticAssignment.Views merged eligible /branches/GeneralizedQAP/HeuristicLab.Problems.QuadraticAssignment.Views merged eligible /branches/CloningRefactoring/HeuristicLab.Problems.QuadraticAssignment.Views 4656-4721 /branches/DataAnalysis Refactoring/HeuristicLab.Problems.QuadraticAssignment.Views 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.QuadraticAssignment.Views 5815-6180 /branches/DataAnalysis/HeuristicLab.Problems.QuadraticAssignment.Views 4458-4459,4462,4464 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.QuadraticAssignment.Views 5060 /branches/NET40/sources/HeuristicLab.Problems.QuadraticAssignment.Views 5138-5162 /branches/ParallelEngine/HeuristicLab.Problems.QuadraticAssignment.Views 5175-5192 /branches/QAPAlgorithms/HeuristicLab.Problems.QuadraticAssignment.Views 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Problems.QuadraticAssignment.Views 6828 /branches/SuccessProgressAnalysis/HeuristicLab.Problems.QuadraticAssignment.Views 5370-5682 /branches/Trunk/HeuristicLab.Problems.QuadraticAssignment.Views 6829-6865 /branches/VNS/HeuristicLab.Problems.QuadraticAssignment.Views 5594-5752 /branches/histogram/HeuristicLab.Problems.QuadraticAssignment.Views 5959-6341
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/HeuristicLab.Problems.QuadraticAssignment.Views-3.3.csproj
r6866 r6891 104 104 <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" /> 105 105 <Reference Include="HeuristicLab.Data.Views-3.3"> 106 <HintPath>..\..\HeuristicLab.Data.Views\3.3\bin\ x86\Debug\HeuristicLab.Data.Views-3.3.dll</HintPath>106 <HintPath>..\..\HeuristicLab.Data.Views\3.3\bin\Debug\HeuristicLab.Data.Views-3.3.dll</HintPath> 107 107 </Reference> 108 108 <Reference Include="HeuristicLab.Visualization.ChartControlsExtensions-3.3"> 109 <HintPath>..\..\HeuristicLab.Visualization.ChartControlsExtensions\3.3\bin\ x86\Debug\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath>109 <HintPath>..\..\HeuristicLab.Visualization.ChartControlsExtensions\3.3\bin\Debug\HeuristicLab.Visualization.ChartControlsExtensions-3.3.dll</HintPath> 110 110 </Reference> 111 111 <Reference Include="System" /> … … 113 113 <Reference Include="System.Data" /> 114 114 <Reference Include="System.Drawing" /> 115 <Reference Include="System.Runtime.Serialization" /> 116 <Reference Include="System.ServiceModel" /> 115 117 <Reference Include="System.Windows.Forms" /> 116 118 <Reference Include="System.Windows.Forms.DataVisualization" /> 117 <Reference Include="System.Xml" />118 119 </ItemGroup> 119 120 <ItemGroup> … … 210 211 <Private>False</Private> 211 212 </ProjectReference> 213 </ItemGroup> 214 <ItemGroup> 215 <WCFMetadata Include="Service References\" /> 212 216 </ItemGroup> 213 217 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> -
trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/Plugin.cs.frame
r6548 r6891 26 26 [PluginFile("HeuristicLab.Problems.QuadraticAssignment.Views-3.3.dll", PluginFileType.Assembly)] 27 27 [PluginDependency("HeuristicLab.Analysis", "3.3")] 28 [PluginDependency("HeuristicLab.Collections", "3.3")] 28 29 [PluginDependency("HeuristicLab.Common", "3.3")] 29 30 [PluginDependency("HeuristicLab.Common.Resources", "3.3")] … … 34 35 [PluginDependency("HeuristicLab.MainForm", "3.3")] 35 36 [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")] 37 [PluginDependency("HeuristicLab.Optimization", "3.3")] 36 38 [PluginDependency("HeuristicLab.Problems.QuadraticAssignment", "3.3")] 37 39 public class HeuristicLabProblemsQuadraticAssignmentViewsPlugin : PluginBase { -
trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.Designer.cs
r6342 r6891 54 54 this.visualizationTabPage = new System.Windows.Forms.TabPage(); 55 55 this.qapView = new HeuristicLab.Problems.QuadraticAssignment.Views.QAPVisualizationControl(); 56 this.reloadInstancesButton = new System.Windows.Forms.Button(); 57 this.loadInstanceWorker = new System.ComponentModel.BackgroundWorker(); 58 this.progressBar = new System.Windows.Forms.ProgressBar(); 59 this.getInstancesWorker = new System.ComponentModel.BackgroundWorker(); 56 60 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 57 61 this.tabControl.SuspendLayout(); … … 90 94 this.toolTip.SetToolTip(this.importInstanceButton, "Import files in QAPLIB format."); 91 95 this.importInstanceButton.UseVisualStyleBackColor = true; 92 this.importInstanceButton.Click += new System.EventHandler(this.import InstanceButton_Click);96 this.importInstanceButton.Click += new System.EventHandler(this.importFileInstanceButton_Click); 93 97 // 94 98 // openFileDialog … … 120 124 this.instancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; 121 125 this.instancesComboBox.FormattingEnabled = true; 122 this.instancesComboBox.Location = new System.Drawing.Point(1 05, 2);126 this.instancesComboBox.Location = new System.Drawing.Point(137, 1); 123 127 this.instancesComboBox.Name = "instancesComboBox"; 124 this.instancesComboBox.Size = new System.Drawing.Size(3 58, 21);128 this.instancesComboBox.Size = new System.Drawing.Size(326, 21); 125 129 this.instancesComboBox.TabIndex = 7; 126 130 this.instancesComboBox.SelectedValueChanged += new System.EventHandler(this.instancesComboBox_SelectedValueChanged); … … 184 188 this.qapView.Weights = null; 185 189 // 190 // reloadInstancesButton 191 // 192 this.reloadInstancesButton.Location = new System.Drawing.Point(105, 0); 193 this.reloadInstancesButton.Name = "reloadInstancesButton"; 194 this.reloadInstancesButton.Size = new System.Drawing.Size(26, 23); 195 this.reloadInstancesButton.TabIndex = 9; 196 this.reloadInstancesButton.Text = "Reload"; 197 this.reloadInstancesButton.UseVisualStyleBackColor = true; 198 this.reloadInstancesButton.Click += new System.EventHandler(this.reloadInstancesButton_Click); 199 // 200 // loadInstanceWorker 201 // 202 this.loadInstanceWorker.WorkerReportsProgress = true; 203 this.loadInstanceWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.loadInstanceWorker_DoWork); 204 this.loadInstanceWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.worker_ProgressChanged); 205 this.loadInstanceWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.worker_RunWorkerCompleted); 206 // 207 // progressBar 208 // 209 this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 210 | System.Windows.Forms.AnchorStyles.Right))); 211 this.progressBar.Location = new System.Drawing.Point(137, 0); 212 this.progressBar.Name = "progressBar"; 213 this.progressBar.Size = new System.Drawing.Size(326, 23); 214 this.progressBar.Style = System.Windows.Forms.ProgressBarStyle.Continuous; 215 this.progressBar.TabIndex = 10; 216 this.progressBar.Visible = false; 217 // 218 // getInstancesWorker 219 // 220 this.getInstancesWorker.WorkerReportsProgress = true; 221 this.getInstancesWorker.DoWork += new System.ComponentModel.DoWorkEventHandler(this.getInstancesWorker_DoWork); 222 this.getInstancesWorker.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.worker_ProgressChanged); 223 this.getInstancesWorker.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.worker_RunWorkerCompleted); 224 // 186 225 // QuadraticAssignmentProblemView 187 226 // 188 227 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 189 228 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 229 this.Controls.Add(this.progressBar); 190 230 this.Controls.Add(this.instancesComboBox); 191 231 this.Controls.Add(this.tabControl); 192 232 this.Controls.Add(this.importInstanceButton); 193 233 this.Controls.Add(this.loadInstanceButton); 234 this.Controls.Add(this.reloadInstancesButton); 194 235 this.Controls.Add(this.QAPLIBInstancesLabel); 195 236 this.Name = "QuadraticAssignmentProblemView"; 196 237 this.Size = new System.Drawing.Size(647, 492); 197 238 this.Controls.SetChildIndex(this.QAPLIBInstancesLabel, 0); 239 this.Controls.SetChildIndex(this.reloadInstancesButton, 0); 198 240 this.Controls.SetChildIndex(this.loadInstanceButton, 0); 199 241 this.Controls.SetChildIndex(this.importInstanceButton, 0); … … 204 246 this.Controls.SetChildIndex(this.nameLabel, 0); 205 247 this.Controls.SetChildIndex(this.nameTextBox, 0); 248 this.Controls.SetChildIndex(this.progressBar, 0); 206 249 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 207 250 this.tabControl.ResumeLayout(false); … … 223 266 private System.Windows.Forms.TabPage visualizationTabPage; 224 267 private QAPVisualizationControl qapView; 268 private System.Windows.Forms.Button reloadInstancesButton; 269 private System.ComponentModel.BackgroundWorker loadInstanceWorker; 270 private System.Windows.Forms.ProgressBar progressBar; 271 private System.ComponentModel.BackgroundWorker getInstancesWorker; 225 272 } 226 273 } -
trunk/sources/HeuristicLab.Problems.QuadraticAssignment.Views/3.3/QuadraticAssignmentProblemView.cs
r6342 r6891 21 21 22 22 using System; 23 using System.ComponentModel; 23 24 using System.Drawing; 25 using System.Linq; 24 26 using System.Windows.Forms; 25 27 using HeuristicLab.Common.Resources; 28 using HeuristicLab.Core; 26 29 using HeuristicLab.Core.Views; 30 using HeuristicLab.Data; 31 using HeuristicLab.Encodings.PermutationEncoding; 27 32 using HeuristicLab.MainForm; 28 33 using HeuristicLab.MainForm.WindowsForms; 34 using HeuristicLab.Problems.QuadraticAssignment.QAPInstanceService; 29 35 30 36 namespace HeuristicLab.Problems.QuadraticAssignment.Views { … … 40 46 InitializeComponent(); 41 47 importInstanceButton.Image = VSImageLibrary.Open; 48 reloadInstancesButton.Text = String.Empty; 49 reloadInstancesButton.Image = VSImageLibrary.Refresh; 50 loadInstanceButton.Image = VSImageLibrary.Internet; 42 51 Controls.Remove(parameterCollectionView); 43 52 parameterCollectionView.Dock = DockStyle.Fill; … … 50 59 Content.WeightsParameter.ValueChanged += new EventHandler(WeightsParameter_ValueChanged); 51 60 Content.BestKnownSolutionParameter.ValueChanged += new EventHandler(BestKnownSolutionParameter_ValueChanged); 61 Content.Instances.ItemsAdded += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 62 Content.Instances.ItemsMoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 63 Content.Instances.ItemsRemoved += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 64 Content.Instances.ItemsReplaced += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 65 Content.Instances.CollectionReset += new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 52 66 } 53 67 … … 56 70 Content.WeightsParameter.ValueChanged -= new EventHandler(WeightsParameter_ValueChanged); 57 71 Content.BestKnownSolutionParameter.ValueChanged -= new EventHandler(BestKnownSolutionParameter_ValueChanged); 72 Content.Instances.ItemsAdded -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 73 Content.Instances.ItemsMoved -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 74 Content.Instances.ItemsRemoved -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 75 Content.Instances.ItemsReplaced -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 76 Content.Instances.CollectionReset -= new Collections.CollectionItemsChangedEventHandler<Collections.IndexedItem<string>>(Content_Instances_Changed); 58 77 base.DeregisterContentEvents(); 78 } 79 80 private void Content_Instances_Changed(object sender, EventArgs e) { 81 instancesComboBox.Items.Clear(); 82 foreach (string name in Content.Instances) 83 instancesComboBox.Items.Add(name); 84 if (instancesComboBox.Items.Count > 0) 85 instancesComboBox.SelectedIndex = 0; 59 86 } 60 87 … … 73 100 protected override void OnContentChanged() { 74 101 base.OnContentChanged(); 75 instancesComboBox.Items.Clear();76 102 if (Content != null) { 77 foreach (string instance in Content.EmbeddedInstances) {78 instancesComboBox.Items.Add(instance);79 }80 103 qapView.Distances = Content.Distances; 81 104 qapView.Weights = Content.Weights; … … 90 113 protected override void SetEnabledStateOfControls() { 91 114 base.SetEnabledStateOfControls(); 115 reloadInstancesButton.Enabled = !ReadOnly && !Locked && Content != null; 92 116 instancesComboBox.Enabled = !ReadOnly && !Locked && Content != null; 93 loadInstanceButton.Enabled = !ReadOnly && !Locked && Content != null && instancesComboBox.SelectedItem != null;117 loadInstanceButton.Enabled = !ReadOnly && !Locked && Content != null && !String.IsNullOrEmpty((string)instancesComboBox.SelectedItem); 94 118 importInstanceButton.Enabled = !ReadOnly && !Locked && Content != null; 95 119 } 96 120 97 121 private void instancesComboBox_SelectedValueChanged(object sender, System.EventArgs e) { 98 loadInstanceButton.Enabled = instancesComboBox.SelectedItem != null;122 SetEnabledStateOfControls(); 99 123 } 100 124 101 125 private void loadInstanceButton_Click(object sender, System.EventArgs e) { 102 string instance = instancesComboBox.SelectedItem as string; 103 try { 104 Content.LoadEmbeddedInstance(instance); 105 } catch (Exception ex) { 106 PluginInfrastructure.ErrorHandling.ShowErrorDialog(ex); 107 } 108 } 109 110 private void importInstanceButton_Click(object sender, System.EventArgs e) { 126 ReadOnly = true; 127 string instanceStr = instancesComboBox.SelectedItem as string; 128 progressBar.Visible = true; 129 loadInstanceWorker.RunWorkerAsync(instanceStr); 130 } 131 132 private void importFileInstanceButton_Click(object sender, System.EventArgs e) { 111 133 if (openFileDialog.ShowDialog() == DialogResult.OK) { 112 134 try { 113 Content. ImportFileInstance(openFileDialog.FileName);135 Content.LoadInstanceFromFile(openFileDialog.FileName); 114 136 } catch (Exception ex) { 115 137 PluginInfrastructure.ErrorHandling.ShowErrorDialog(ex); 116 138 } 117 139 } 140 } 141 142 private void reloadInstancesButton_Click(object sender, EventArgs e) { 143 ReadOnly = true; 144 progressBar.Visible = true; 145 getInstancesWorker.RunWorkerAsync(); 146 } 147 148 private void loadInstanceWorker_DoWork(object sender, DoWorkEventArgs e) { 149 string instance = (string)e.Argument; 150 if (String.IsNullOrEmpty(instance)) return; 151 using (var client = new QAPClient()) { 152 loadInstanceWorker.ReportProgress(10); 153 var data = client.GetProblemInstanceData(instance); 154 loadInstanceWorker.ReportProgress(60); 155 DoubleMatrix weights = new DoubleMatrix(data.Weights.Length, data.Weights.Length); 156 DoubleMatrix distances = new DoubleMatrix(data.Weights.Length, data.Weights.Length); 157 try { 158 for (int i = 0; i < data.Weights.Length; i++) 159 for (int j = 0; j < data.Weights.Length; j++) { 160 weights[i, j] = data.Weights[i][j]; 161 distances[i, j] = data.Distances[i][j]; 162 } 163 } catch (IndexOutOfRangeException) { 164 MessageBox.Show("The problem data is malformed, the problem could not be loaded.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 165 } 166 loadInstanceWorker.ReportProgress(65); 167 Content.Name = data.Name; 168 Content.Description = data.Description; 169 Content.Maximization.Value = data.Maximization; 170 Content.Weights = weights; 171 Content.Distances = distances; 172 173 Content.BestKnownQualityParameter.Value = null; 174 Content.BestKnownSolution = null; 175 Content.BestKnownSolutions = new ItemSet<Permutation>(); 176 var solutions = client.GetBestSolutionsData(instance); 177 loadInstanceWorker.ReportProgress(90); 178 if (solutions.Any()) { 179 Content.BestKnownQualityParameter.Value = new DoubleValue(solutions.First().Quality); 180 Content.BestKnownSolution = new Permutation(PermutationTypes.Absolute, solutions.First().Assignment); 181 foreach (var solution in solutions) { 182 Content.BestKnownSolutions.Add(new Permutation(PermutationTypes.Absolute, solution.Assignment)); 183 } 184 } 185 loadInstanceWorker.ReportProgress(100); 186 } 187 } 188 189 private void getInstancesWorker_DoWork(object sender, DoWorkEventArgs e) { 190 using (var client = new QAPClient()) { 191 getInstancesWorker.ReportProgress(10); 192 var instances = client.GetProblemInstances(); 193 getInstancesWorker.ReportProgress(85); 194 Content.Instances.Replace(instances); 195 getInstancesWorker.ReportProgress(100); 196 } 197 } 198 199 private void worker_ProgressChanged(object sender, ProgressChangedEventArgs e) { 200 progressBar.Value = e.ProgressPercentage; 201 } 202 203 private void worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { 204 progressBar.Visible = false; 205 ReadOnly = false; 206 if (e.Error != null) 207 PluginInfrastructure.ErrorHandling.ShowErrorDialog(e.Error); 118 208 } 119 209
Note: See TracChangeset
for help on using the changeset viewer.