Changeset 7471
- Timestamp:
- 02/15/12 19:24:54 (13 years ago)
- Location:
- branches/GeneralizedQAP
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.Designer.cs
r7470 r7471 49 49 this.qualityLabel = new System.Windows.Forms.Label(); 50 50 this.assignmentGroupBox = new System.Windows.Forms.GroupBox(); 51 this.assignmentSplitContainer = new System.Windows.Forms.SplitContainer(); 52 this.assignmentView = new HeuristicLab.Data.Views.StringConvertibleArrayView(); 51 53 this.characteristicsGroupBox = new System.Windows.Forms.GroupBox(); 52 54 this.label7 = new System.Windows.Forms.Label(); … … 56 58 this.label3 = new System.Windows.Forms.Label(); 57 59 this.flowDistanceQualityLabel = new System.Windows.Forms.Label(); 58 this.assignmentSplitContainer = new System.Windows.Forms.SplitContainer(); 59 this.assignmentView = new HeuristicLab.Data.Views.StringConvertibleArrayView(); 60 this.recalculateButton = new System.Windows.Forms.Button(); 60 61 this.assignmentGroupBox.SuspendLayout(); 61 this.characteristicsGroupBox.SuspendLayout();62 62 ((System.ComponentModel.ISupportInitialize)(this.assignmentSplitContainer)).BeginInit(); 63 63 this.assignmentSplitContainer.Panel1.SuspendLayout(); 64 64 this.assignmentSplitContainer.Panel2.SuspendLayout(); 65 65 this.assignmentSplitContainer.SuspendLayout(); 66 this.characteristicsGroupBox.SuspendLayout(); 66 67 this.SuspendLayout(); 67 68 // … … 110 111 this.assignmentGroupBox.Text = "Assignment"; 111 112 // 113 // assignmentSplitContainer 114 // 115 this.assignmentSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill; 116 this.assignmentSplitContainer.Location = new System.Drawing.Point(3, 16); 117 this.assignmentSplitContainer.Name = "assignmentSplitContainer"; 118 // 119 // assignmentSplitContainer.Panel1 120 // 121 this.assignmentSplitContainer.Panel1.Controls.Add(this.assignmentTreeView); 122 // 123 // assignmentSplitContainer.Panel2 124 // 125 this.assignmentSplitContainer.Panel2.Controls.Add(this.assignmentView); 126 this.assignmentSplitContainer.Size = new System.Drawing.Size(234, 337); 127 this.assignmentSplitContainer.SplitterDistance = 78; 128 this.assignmentSplitContainer.TabIndex = 4; 129 // 130 // assignmentView 131 // 132 this.assignmentView.Caption = "StringConvertibleArray View"; 133 this.assignmentView.Content = null; 134 this.assignmentView.Dock = System.Windows.Forms.DockStyle.Fill; 135 this.assignmentView.Location = new System.Drawing.Point(0, 0); 136 this.assignmentView.Name = "assignmentView"; 137 this.assignmentView.ReadOnly = false; 138 this.assignmentView.Size = new System.Drawing.Size(152, 337); 139 this.assignmentView.TabIndex = 0; 140 // 112 141 // characteristicsGroupBox 113 142 // 114 143 this.characteristicsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 115 144 | System.Windows.Forms.AnchorStyles.Left))); 145 this.characteristicsGroupBox.Controls.Add(this.recalculateButton); 116 146 this.characteristicsGroupBox.Controls.Add(this.label7); 117 147 this.characteristicsGroupBox.Controls.Add(this.overbookedCapacityLabel); … … 189 219 this.flowDistanceQualityLabel.Text = "-"; 190 220 // 191 // assignmentSplitContainer 192 // 193 this.assignmentSplitContainer.Dock = System.Windows.Forms.DockStyle.Fill; 194 this.assignmentSplitContainer.Location = new System.Drawing.Point(3, 16); 195 this.assignmentSplitContainer.Name = "assignmentSplitContainer"; 196 // 197 // assignmentSplitContainer.Panel1 198 // 199 this.assignmentSplitContainer.Panel1.Controls.Add(this.assignmentTreeView); 200 // 201 // assignmentSplitContainer.Panel2 202 // 203 this.assignmentSplitContainer.Panel2.Controls.Add(this.assignmentView); 204 this.assignmentSplitContainer.Size = new System.Drawing.Size(234, 337); 205 this.assignmentSplitContainer.SplitterDistance = 78; 206 this.assignmentSplitContainer.TabIndex = 4; 207 // 208 // assignmentView 209 // 210 this.assignmentView.Caption = "StringConvertibleArray View"; 211 this.assignmentView.Content = null; 212 this.assignmentView.Dock = System.Windows.Forms.DockStyle.Fill; 213 this.assignmentView.Location = new System.Drawing.Point(0, 0); 214 this.assignmentView.Name = "assignmentView"; 215 this.assignmentView.ReadOnly = false; 216 this.assignmentView.Size = new System.Drawing.Size(152, 337); 217 this.assignmentView.TabIndex = 0; 221 // recalculateButton 222 // 223 this.recalculateButton.Location = new System.Drawing.Point(9, 95); 224 this.recalculateButton.Name = "recalculateButton"; 225 this.recalculateButton.Size = new System.Drawing.Size(193, 23); 226 this.recalculateButton.TabIndex = 5; 227 this.recalculateButton.Text = "Recalculate"; 228 this.recalculateButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; 229 this.recalculateButton.UseVisualStyleBackColor = true; 230 this.recalculateButton.Click += new System.EventHandler(this.recalculateButton_Click); 218 231 // 219 232 // GQAPAssignmentView … … 226 239 this.Size = new System.Drawing.Size(460, 362); 227 240 this.assignmentGroupBox.ResumeLayout(false); 228 this.characteristicsGroupBox.ResumeLayout(false);229 this.characteristicsGroupBox.PerformLayout();230 241 this.assignmentSplitContainer.Panel1.ResumeLayout(false); 231 242 this.assignmentSplitContainer.Panel2.ResumeLayout(false); 232 243 ((System.ComponentModel.ISupportInitialize)(this.assignmentSplitContainer)).EndInit(); 233 244 this.assignmentSplitContainer.ResumeLayout(false); 245 this.characteristicsGroupBox.ResumeLayout(false); 246 this.characteristicsGroupBox.PerformLayout(); 234 247 this.ResumeLayout(false); 235 248 … … 251 264 private System.Windows.Forms.SplitContainer assignmentSplitContainer; 252 265 private Data.Views.StringConvertibleArrayView assignmentView; 266 private System.Windows.Forms.Button recalculateButton; 253 267 } 254 268 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.cs
r7470 r7471 26 26 using System.Linq; 27 27 using System.Windows.Forms; 28 using HeuristicLab.Common.Resources; 28 29 using HeuristicLab.Core.Views; 30 using HeuristicLab.Data; 29 31 using HeuristicLab.Encodings.IntegerVectorEncoding; 30 32 using HeuristicLab.MainForm; … … 44 46 public GQAPAssignmentView() { 45 47 InitializeComponent(); 48 recalculateButton.Image = VSImageLibrary.Refresh; 46 49 } 47 50 … … 307 310 } 308 311 #endregion 312 313 private void recalculateButton_Click(object sender, EventArgs e) { 314 double fdq, iq, oc; 315 GQAPEvaluator.Evaluate(Content.Assignment, Content.Weights, 316 Content.Distances, Content.InstallationCosts, Content.Demands, 317 Content.Capacities, out fdq, out iq, out oc); 318 Content.FlowDistanceQuality = new DoubleValue(fdq); 319 Content.InstallationQuality = new DoubleValue(iq); 320 Content.OverbookedCapacity = new DoubleValue(oc); 321 Content.Quality = new DoubleValue( 322 GQAPEvaluator.GetCombinedQuality(fdq, iq, oc, 323 Content.TransportationCosts.Value, Content.OverbookedCapacityPenalty.Value)); 324 } 309 325 } 310 326 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs
r7470 r7471 175 175 DistancesParameter.ReactOnValueToStringChangedAndValueItemImageChanged = false; 176 176 InstallationCostsParameter.ReactOnValueToStringChangedAndValueItemImageChanged = false; 177 DemandsParameter.ReactOnValueToStringChangedAndValueItemImageChanged = false; 178 CapacitiesParameter.ReactOnValueToStringChangedAndValueItemImageChanged = false; 177 179 178 180 Weights = new DoubleMatrix(5, 5); … … 330 332 331 333 private void EvaluateAndLoadAssignment(int[] vector) { 332 var assignment = new IntegerVector(vector); 334 EvaluateAndLoadAssignment(new IntegerVector(vector)); 335 } 336 private void EvaluateAndLoadAssignment(IntegerVector assignment) { 337 if (!IsConfigurationValid()) return; 333 338 double flowDistanceQuality, installationQuality, overbookedCapacity; 334 339 GQAPEvaluator.Evaluate(assignment, Weights, Distances, InstallationCosts, Demands, Capacities, 335 340 out flowDistanceQuality, out installationQuality, out overbookedCapacity); 336 341 double quality = GQAPEvaluator.GetCombinedQuality(flowDistanceQuality, installationQuality, overbookedCapacity, TransportationCosts.Value, OverbookedCapacityPenalty.Value); 337 BestKnownSolution = new GQAPAssignment( assignment, new DoubleValue(quality),342 BestKnownSolution = new GQAPAssignment((IntegerVector)assignment.Clone(), new DoubleValue(quality), 338 343 new DoubleValue(flowDistanceQuality), new DoubleValue(installationQuality), 339 344 new DoubleValue(overbookedCapacity), EquipmentNames, LocationNames, Distances, Weights, InstallationCosts, … … 341 346 BestKnownQuality = new DoubleValue(quality); 342 347 BestKnownSolutions = new GQAPAssignmentArchive(EquipmentNames, LocationNames, Distances, Weights, InstallationCosts, Demands, Capacities, TransportationCosts, OverbookedCapacityPenalty); 343 BestKnownSolutions.Solutions.Add( BestKnownSolution);348 BestKnownSolutions.Solutions.Add(new GQAPSolution((IntegerVector)assignment.Clone(), new DoubleValue(quality), new DoubleValue(flowDistanceQuality), new DoubleValue(installationQuality), new DoubleValue(overbookedCapacity))); 344 349 } 345 350 … … 480 485 } 481 486 #endregion 487 488 private bool IsConfigurationValid() { 489 return Weights != null && Distances != null && Demands != null && Capacities != null && InstallationCosts != null 490 && Weights.Rows == Weights.Columns && Weights.Rows == InstallationCosts.Rows 491 && Distances.Rows == Distances.Columns && Distances.Rows == InstallationCosts.Columns 492 && Demands.Length == Weights.Rows && Capacities.Length == Distances.Rows; 493 } 482 494 } 483 495 }
Note: See TracChangeset
for help on using the changeset viewer.