Changeset 7470 for branches/GeneralizedQAP
- Timestamp:
- 02/15/12 17:28:37 (13 years ago)
- Location:
- branches/GeneralizedQAP
- Files:
-
- 3 added
- 2 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.Designer.cs
r7438 r7470 56 56 this.label3 = new System.Windows.Forms.Label(); 57 57 this.flowDistanceQualityLabel = new System.Windows.Forms.Label(); 58 this.assignmentSplitContainer = new System.Windows.Forms.SplitContainer(); 59 this.assignmentView = new HeuristicLab.Data.Views.StringConvertibleArrayView(); 58 60 this.assignmentGroupBox.SuspendLayout(); 59 61 this.characteristicsGroupBox.SuspendLayout(); 62 ((System.ComponentModel.ISupportInitialize)(this.assignmentSplitContainer)).BeginInit(); 63 this.assignmentSplitContainer.Panel1.SuspendLayout(); 64 this.assignmentSplitContainer.Panel2.SuspendLayout(); 65 this.assignmentSplitContainer.SuspendLayout(); 60 66 this.SuspendLayout(); 61 67 // 62 68 // assignmentTreeView 63 69 // 64 this.assignmentTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 65 | System.Windows.Forms.AnchorStyles.Left) 66 | System.Windows.Forms.AnchorStyles.Right))); 67 this.assignmentTreeView.Location = new System.Drawing.Point(6, 19); 70 this.assignmentTreeView.Dock = System.Windows.Forms.DockStyle.Fill; 71 this.assignmentTreeView.Location = new System.Drawing.Point(0, 0); 68 72 this.assignmentTreeView.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3); 69 73 this.assignmentTreeView.Name = "assignmentTreeView"; 70 this.assignmentTreeView.Size = new System.Drawing.Size( 228, 331);74 this.assignmentTreeView.Size = new System.Drawing.Size(78, 337); 71 75 this.assignmentTreeView.TabIndex = 3; 72 76 this.assignmentTreeView.AfterSelect += new System.Windows.Forms.TreeViewEventHandler(this.assignmentTreeView_AfterSelect); … … 95 99 // assignmentGroupBox 96 100 // 97 this.assignmentGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 98 | System.Windows.Forms.AnchorStyles.Left)99 100 this.assignmentGroupBox.Controls.Add(this.assignment TreeView);101 this.assignmentGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 102 | System.Windows.Forms.AnchorStyles.Left) 103 | System.Windows.Forms.AnchorStyles.Right))); 104 this.assignmentGroupBox.Controls.Add(this.assignmentSplitContainer); 101 105 this.assignmentGroupBox.Location = new System.Drawing.Point(217, 3); 102 106 this.assignmentGroupBox.Name = "assignmentGroupBox"; … … 108 112 // characteristicsGroupBox 109 113 // 110 this.characteristicsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 111 114 this.characteristicsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 115 | System.Windows.Forms.AnchorStyles.Left))); 112 116 this.characteristicsGroupBox.Controls.Add(this.label7); 113 117 this.characteristicsGroupBox.Controls.Add(this.overbookedCapacityLabel); … … 185 189 this.flowDistanceQualityLabel.Text = "-"; 186 190 // 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; 218 // 187 219 // GQAPAssignmentView 188 220 // … … 196 228 this.characteristicsGroupBox.ResumeLayout(false); 197 229 this.characteristicsGroupBox.PerformLayout(); 230 this.assignmentSplitContainer.Panel1.ResumeLayout(false); 231 this.assignmentSplitContainer.Panel2.ResumeLayout(false); 232 ((System.ComponentModel.ISupportInitialize)(this.assignmentSplitContainer)).EndInit(); 233 this.assignmentSplitContainer.ResumeLayout(false); 198 234 this.ResumeLayout(false); 199 235 … … 213 249 private System.Windows.Forms.Label label5; 214 250 private System.Windows.Forms.Label installationQualityLabel; 251 private System.Windows.Forms.SplitContainer assignmentSplitContainer; 252 private Data.Views.StringConvertibleArrayView assignmentView; 215 253 } 216 254 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.cs
r7448 r7470 49 49 protected override void DeregisterContentEvents() { 50 50 Content.PropertyChanged -= new PropertyChangedEventHandler(Content_PropertyChanged); 51 Content.Solution.PropertyChanged -= new PropertyChangedEventHandler(ContentSolution_PropertyChanged);52 51 base.DeregisterContentEvents(); 53 52 } … … 55 54 base.RegisterContentEvents(); 56 55 Content.PropertyChanged += new PropertyChangedEventHandler(Content_PropertyChanged); 57 Content.Solution.PropertyChanged += new PropertyChangedEventHandler(ContentSolution_PropertyChanged);58 56 } 59 57 #endregion … … 75 73 private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) { 76 74 switch (e.PropertyName) { 77 case "EquipmentNames": UpdateAssignment(); break;78 case "LocationNames": UpdateAssignment(); break;79 default: break;80 }81 }82 private void ContentSolution_PropertyChanged(object sender, PropertyChangedEventArgs e) {83 switch (e.PropertyName) {84 75 case "Quality": UpdateQuality(); break; 85 76 case "FlowDistanceQuality": UpdateFlowDistanceQuality(); break; … … 87 78 case "OverbookedCapacity": UpdateOverbookedCapacity(); break; 88 79 case "Assignment": UpdateAssignment(); break; 80 case "EquipmentNames": UpdateAssignment(); break; 81 case "LocationNames": UpdateAssignment(); break; 89 82 default: break; 90 83 } 84 } 85 86 private void Content_Assignment_ToStringChanged(object sender, EventArgs e) { 87 UpdateAssignment(); 91 88 } 92 89 #endregion … … 129 126 qualityLabel.Text = "-"; 130 127 } else { 131 qualityLabel.Text = Content. Solution.Quality.ToString();128 qualityLabel.Text = Content.Quality.ToString(); 132 129 } 133 130 } … … 137 134 if (InvokeRequired) Invoke((Action)UpdateFlowDistanceQuality); 138 135 else { 139 if (Content == null || Content. Solution.FlowDistanceQuality == null) {136 if (Content == null || Content.FlowDistanceQuality == null) { 140 137 flowDistanceQualityLabel.Text = "-"; 141 138 } else { 142 flowDistanceQualityLabel.Text = Content. Solution.FlowDistanceQuality.ToString();139 flowDistanceQualityLabel.Text = Content.FlowDistanceQuality.ToString(); 143 140 } 144 141 } … … 148 145 if (InvokeRequired) Invoke((Action)UpdateInstallationQuality); 149 146 else { 150 if (Content == null || Content. Solution.InstallationQuality == null) {147 if (Content == null || Content.InstallationQuality == null) { 151 148 installationQualityLabel.Text = "-"; 152 149 } else { 153 installationQualityLabel.Text = Content. Solution.InstallationQuality.ToString();150 installationQualityLabel.Text = Content.InstallationQuality.ToString(); 154 151 } 155 152 } … … 159 156 if (InvokeRequired) Invoke((Action)UpdateOverbookedCapacity); 160 157 else { 161 if (Content == null || Content. Solution.OverbookedCapacity == null) {158 if (Content == null || Content.OverbookedCapacity == null) { 162 159 overbookedCapacityLabel.Text = "-"; 163 160 } else { 164 overbookedCapacityLabel.Text = Content. Solution.OverbookedCapacity.ToString();161 overbookedCapacityLabel.Text = Content.OverbookedCapacity.ToString(); 165 162 } 166 163 } … … 172 169 assignmentTreeView.Nodes.Clear(); 173 170 if (Content != null) { 174 IntegerVector assignment = Content. Solution.Assignment;171 IntegerVector assignment = Content.Assignment; 175 172 Dictionary<int, TreeNode> locationNodes = new Dictionary<int, TreeNode>(); 176 173 for (int i = 0; i < assignment.Length; i++) { … … 202 199 var installationCosts = new Dictionary<EquipmentNode, double>(); 203 200 foreach (var node in GetAllSubNodes(assignmentTreeView.Nodes).OfType<EquipmentNode>()) { 204 int location = Content. Solution.Assignment[node.Equipment];201 int location = Content.Assignment[node.Equipment]; 205 202 installationCosts[node] = Content.InstallationCosts[node.Equipment, location]; 206 203 } … … 249 246 250 247 private void ColorByWeight(LocationNode selectedNode) { 251 var equipments = new HashSet<int>(Content. Solution.Assignment.Select((v, i) => new { Index = i, Value = v })248 var equipments = new HashSet<int>(Content.Assignment.Select((v, i) => new { Index = i, Value = v }) 252 249 .Where(x => x.Value == selectedNode.Location).Select(x => x.Index)); 253 250 var rowSums = new Dictionary<int, double>(equipments.Count); -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3.csproj
r7448 r7470 54 54 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath> 55 55 </Reference> 56 <Reference Include="HeuristicLab.Data.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 56 57 <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3"> 57 58 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.IntegerVectorEncoding-3.3.dll</HintPath> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/ProblemInstanceProviderView.cs
r7466 r7470 60 60 var instance = (IInstanceDescriptor)instancesComboBox.SelectedItem; 61 61 if (!Content.FeedConsumer(instance)) { 62 MessageBox.Show(" Loading the problem instance " + instance.Name + " failed.");62 MessageBox.Show("This problem does not support the instance " + instance.Name + ".", "Cannot load instance"); 63 63 } 64 64 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers/BestGQAPSolutionAnalyzer.cs
r7444 r7470 41 41 IDemandsAwareGQAPOperator, ICapacitiesAwareGQAPOperator, ITransportationCostsAwareGQAPOperator, 42 42 IOverbookedCapacityPenaltyAwareGQAPOperator, IEquipmentNamesAwareGQAPOperator, ILocationNamesAwareGQAPOperator, 43 IBestKnownQualityAwareGQAPOperator, IBestKnownSolutionAwareGQAPOperator, IBestKnownSolutionsAwareGQAPOperator, 44 IAnalyzer { 43 IBestKnownQualityAwareGQAPOperator, IBestKnownSolutionAwareGQAPOperator, IAnalyzer { 45 44 46 45 public bool EnabledByDefault { … … 97 96 get { return (ILookupParameter<DoubleValue>)Parameters["BestKnownQuality"]; } 98 97 } 99 public ILookupParameter<GQAPSolution> BestKnownSolutionParameter { 100 get { return (ILookupParameter<GQAPSolution>)Parameters["BestKnownSolution"]; } 101 } 102 public ILookupParameter<GQAPAssignmentArchive> BestKnownSolutionsParameter { 103 get { return (ILookupParameter<GQAPAssignmentArchive>)Parameters["BestKnownSolutions"]; } 98 public ILookupParameter<GQAPAssignment> BestKnownSolutionParameter { 99 get { return (ILookupParameter<GQAPAssignment>)Parameters["BestKnownSolution"]; } 104 100 } 105 101 public ILookupParameter<GQAPAssignment> BestSolutionParameter { … … 135 131 Parameters.Add(new LookupParameter<StringArray>("LocationNames", GeneralizedQuadraticAssignmentProblem.LocationNamesDescription)); 136 132 Parameters.Add(new LookupParameter<DoubleValue>("BestKnownQuality", GeneralizedQuadraticAssignmentProblem.BestKnownQualityDescription)); 137 Parameters.Add(new LookupParameter<GQAPSolution>("BestKnownSolution", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionDescription)); 138 Parameters.Add(new LookupParameter<GQAPAssignmentArchive>("BestKnownSolutions", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionsDescription)); 133 Parameters.Add(new LookupParameter<GQAPAssignment>("BestKnownSolution", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionDescription)); 139 134 Parameters.Add(new LookupParameter<GQAPAssignment>("BestSolution", "The best GQAP solution found so far.")); 140 135 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best GQAP solution should be stored.")); … … 159 154 var maximization = MaximizationParameter.ActualValue.Value; 160 155 var bestKnownQuality = BestKnownQualityParameter.ActualValue; 161 var bestKnownSolutions = BestKnownSolutionsParameter.ActualValue;162 156 163 157 int bestIndex; … … 168 162 if (bestKnownQuality == null || HasSolutionImproved(bestKnownQuality.Value, qualities[bestIndex].Value, maximization)) { 169 163 BestKnownQualityParameter.ActualValue = new DoubleValue(qualities[bestIndex].Value); 170 BestKnownSolutionParameter.ActualValue = new GQAP Solution((IntegerVector)assignments[bestIndex].Clone(), qualities[bestIndex], flowDistanceQualities[bestIndex], installationQualities[bestIndex], overbookedCapacities[bestIndex]);164 BestKnownSolutionParameter.ActualValue = new GQAPAssignment((IntegerVector)assignments[bestIndex].Clone(), (DoubleValue)qualities[bestIndex].Clone(), flowDistanceQualities[bestIndex], installationQualities[bestIndex], overbookedCapacities[bestIndex], equipmentNames, locationNames, distances, weights, installationCosts, demands, capacities, transportationCosts, overbookedCapacityPenalty); 171 165 } 172 166 173 GQAPAssignmentassignment = BestSolutionParameter.ActualValue;167 var assignment = BestSolutionParameter.ActualValue; 174 168 if (assignment == null) { 175 169 assignment = new GQAPAssignment((IntegerVector)assignments[bestIndex].Clone(), (DoubleValue)qualities[bestIndex].Clone(), flowDistanceQualities[bestIndex], installationQualities[bestIndex], overbookedCapacities[bestIndex], equipmentNames, locationNames, distances, weights, installationCosts, demands, capacities, transportationCosts, overbookedCapacityPenalty); 176 170 assignment.Distances = distances; 177 171 BestSolutionParameter.ActualValue = assignment; 178 results.Add(new Result("Best GQAP Solution", assignment));179 172 } else { 180 if (HasSolutionImproved(assignment.Solution.Quality.Value, qualities[bestIndex].Value, maximization)) { 181 assignment.Solution = new GQAPSolution((IntegerVector)assignments[bestIndex].Clone(), 182 (DoubleValue)qualities[bestIndex].Clone(), (DoubleValue)flowDistanceQualities[bestIndex].Clone(), 183 (DoubleValue)installationQualities[bestIndex].Clone(), (DoubleValue)overbookedCapacities[bestIndex].Clone()); 173 if (HasSolutionImproved(assignment.Quality.Value, qualities[bestIndex].Value, maximization)) { 174 assignment.Assignment = (IntegerVector)assignments[bestIndex].Clone(); 175 assignment.Quality = (DoubleValue)qualities[bestIndex].Clone(); 176 assignment.FlowDistanceQuality = (DoubleValue)flowDistanceQualities[bestIndex].Clone(); 177 assignment.InstallationQuality = (DoubleValue)installationQualities[bestIndex].Clone(); 178 assignment.OverbookedCapacity = (DoubleValue)overbookedCapacities[bestIndex].Clone(); 184 179 assignment.EquipmentNames = equipmentNames; 185 180 assignment.LocationNames = locationNames; … … 193 188 } 194 189 } 195 196 GQAPAssignmentArchive archive = BestKnownSolutionsParameter.ActualValue; 197 if (archive == null) { 198 archive = new GQAPAssignmentArchive(equipmentNames, locationNames, distances, weights, installationCosts, demands, capacities, transportationCosts, overbookedCapacityPenalty); 199 BestKnownSolutionsParameter.ActualValue = archive; 200 } else { 201 var solutions = Enumerable.Range(0, assignments.Length) 202 .Select(i => new GQAPSolution(assignments[i], qualities[i], flowDistanceQualities[i], installationQualities[i], overbookedCapacities[i])) 203 .Concat(archive.Solutions); 204 archive.Solutions = GQAPSolutionArchiveUpdater.GetFeasibleParetoFront(solutions); 205 } 190 if (!results.ContainsKey("Best GQAP Assignment")) 191 results.Add(new Result("Best GQAP Assignment", assignment)); 206 192 207 193 return base.Apply(); -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers/GQAPSolutionArchiveAnalyzer.cs
r7444 r7470 40 40 IDemandsAwareGQAPOperator, ICapacitiesAwareGQAPOperator, ITransportationCostsAwareGQAPOperator, 41 41 IOverbookedCapacityPenaltyAwareGQAPOperator, IEquipmentNamesAwareGQAPOperator, ILocationNamesAwareGQAPOperator, 42 I Analyzer {42 IBestKnownSolutionsAwareGQAPOperator, IAnalyzer { 43 43 44 44 public bool EnabledByDefault { 45 get { return false; }45 get { return true; } 46 46 } 47 47 … … 94 94 get { return (IValueLookupParameter<ResultCollection>)Parameters["Results"]; } 95 95 } 96 public ILookupParameter<GQAPAssignmentArchive> BestKnownSolutionsParameter { 97 get { return (ILookupParameter<GQAPAssignmentArchive>)Parameters["BestKnownSolutions"]; } 98 } 96 99 97 100 [StorableConstructor] … … 119 122 Parameters.Add(new LookupParameter<StringArray>("LocationNames", GeneralizedQuadraticAssignmentProblem.LocationNamesDescription)); 120 123 Parameters.Add(new ValueLookupParameter<ResultCollection>("Results", "The result collection where the best GQAP solution should be stored.")); 124 Parameters.Add(new LookupParameter<GQAPAssignmentArchive>("BestKnownSolutions", GeneralizedQuadraticAssignmentProblem.BestKnownSolutionsDescription)); 121 125 } 122 126 … … 160 164 archive.Solutions = GQAPSolutionArchiveUpdater.GetFeasibleParetoFront(solutions); 161 165 166 GQAPAssignmentArchive bestKnownArchive = BestKnownSolutionsParameter.ActualValue; 167 if (bestKnownArchive == null) { 168 bestKnownArchive = new GQAPAssignmentArchive(); 169 BestKnownSolutionsParameter.ActualValue = bestKnownArchive; 170 } else { 171 var archiveSolutions = Enumerable.Range(0, assignments.Length) 172 .Select(i => new GQAPSolution(assignments[i], qualities[i], flowDistanceQualities[i], installationQualities[i], overbookedCapacities[i])) 173 .Concat(archive.Solutions); 174 bestKnownArchive.Solutions = GQAPSolutionArchiveUpdater.GetFeasibleParetoFront(archiveSolutions); 175 } 176 162 177 return base.Apply(); 163 178 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GQAPAssignment.cs
r7437 r7470 33 33 34 34 [Storable] 35 private GQAPSolution solution; 36 public GQAPSolution Solution { 37 get { return solution; } 38 set { 39 bool changed = (solution != value); 40 solution = value; 41 if (changed) OnPropertyChanged("Solution"); 35 private IntegerVector assignment; 36 public IntegerVector Assignment { 37 get { return assignment; } 38 set { 39 bool changed = (assignment != value); 40 assignment = value; 41 if (changed) OnPropertyChanged("Assignment"); 42 } 43 } 44 45 [Storable] 46 private DoubleValue quality; 47 public DoubleValue Quality { 48 get { return quality; } 49 set { 50 bool changed = (quality != value); 51 quality = value; 52 if (changed) OnPropertyChanged("Quality"); 53 } 54 } 55 56 [Storable] 57 private DoubleValue flowDistanceQuality; 58 public DoubleValue FlowDistanceQuality { 59 get { return flowDistanceQuality; } 60 set { 61 bool changed = (flowDistanceQuality != value); 62 flowDistanceQuality = value; 63 if (changed) OnPropertyChanged("FlowDistanceQuality"); 64 } 65 } 66 67 [Storable] 68 private DoubleValue installationQuality; 69 public DoubleValue InstallationQuality { 70 get { return installationQuality; } 71 set { 72 bool changed = (installationQuality != value); 73 installationQuality = value; 74 if (changed) OnPropertyChanged("InstallationQuality"); 75 } 76 } 77 78 [Storable] 79 private DoubleValue overbookedCapacity; 80 public DoubleValue OverbookedCapacity { 81 get { return overbookedCapacity; } 82 set { 83 bool changed = (overbookedCapacity != value); 84 overbookedCapacity = value; 85 if (changed) OnPropertyChanged("OverbookedCapacity"); 42 86 } 43 87 } … … 146 190 private GQAPAssignment(GQAPAssignment original, Cloner cloner) 147 191 : base(original, cloner) { 192 assignment = cloner.Clone(original.assignment); 193 quality = cloner.Clone(original.quality); 194 flowDistanceQuality = cloner.Clone(original.flowDistanceQuality); 195 installationQuality = cloner.Clone(original.installationQuality); 196 overbookedCapacity = cloner.Clone(original.overbookedCapacity); 148 197 equipmentNames = cloner.Clone(original.equipmentNames); 149 198 locationNames = cloner.Clone(original.locationNames); … … 156 205 overbookedCapacityPenalty = cloner.Clone(original.overbookedCapacityPenalty); 157 206 } 158 public GQAPAssignment(IntegerVector assignment, DoubleValue quality, DoubleValue flowDistanceQuality, DoubleValue installationQuality, DoubleValue overbookedCapacity )207 public GQAPAssignment(IntegerVector assignment, DoubleValue quality, DoubleValue flowDistanceQuality, DoubleValue installationQuality, DoubleValue overbookedCapacity, StringArray equipmentNames, StringArray locationNames, DoubleMatrix distances, DoubleMatrix weights, DoubleMatrix installationCosts, DoubleArray demands, DoubleArray capacities, DoubleValue transportationCosts, DoubleValue overbookedCapacityPenalty) 159 208 : base() { 160 this.solution = new GQAPSolution(assignment, quality, flowDistanceQuality, installationQuality, overbookedCapacity); 161 } 162 public GQAPAssignment(IntegerVector assignment, DoubleValue quality, DoubleValue flowDistanceQuality, DoubleValue installationQuality, DoubleValue overbookedCapacity, StringArray equipmentNames, StringArray locationNames, DoubleMatrix distances, DoubleMatrix weights, DoubleMatrix installationCosts, DoubleArray demands, DoubleArray capacities, DoubleValue transportationCosts, DoubleValue overbookedCapacityPenalty) 163 : this(assignment, quality, flowDistanceQuality, installationQuality, overbookedCapacity) { 209 this.assignment = assignment; 210 this.quality = quality; 211 this.flowDistanceQuality = flowDistanceQuality; 212 this.installationQuality = installationQuality; 213 this.overbookedCapacity = overbookedCapacity; 164 214 this.equipmentNames = equipmentNames; 165 215 this.locationNames = locationNames; -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs
r7466 r7470 84 84 get { return (FixedValueParameter<DoubleValue>)Parameters["OverbookedCapacityPenalty"]; } 85 85 } 86 public OptionalValueParameter<GQAP Solution> BestKnownSolutionParameter {87 get { return (OptionalValueParameter<GQAP Solution>)Parameters["BestKnownSolution"]; }86 public OptionalValueParameter<GQAPAssignment> BestKnownSolutionParameter { 87 get { return (OptionalValueParameter<GQAPAssignment>)Parameters["BestKnownSolution"]; } 88 88 } 89 89 public OptionalValueParameter<GQAPAssignmentArchive> BestKnownSolutionsParameter { … … 135 135 set { LocationNamesParameter.Value = value; } 136 136 } 137 public GQAP SolutionBestKnownSolution {137 public GQAPAssignment BestKnownSolution { 138 138 get { return BestKnownSolutionParameter.Value; } 139 139 set { BestKnownSolutionParameter.Value = value; } … … 266 266 try { 267 267 if (instance.Dimension > 1000) return false; 268 268 269 269 Name = instance.Name; 270 270 Description = instance.Description; … … 335 335 out flowDistanceQuality, out installationQuality, out overbookedCapacity); 336 336 double quality = GQAPEvaluator.GetCombinedQuality(flowDistanceQuality, installationQuality, overbookedCapacity, TransportationCosts.Value, OverbookedCapacityPenalty.Value); 337 BestKnownSolution = new GQAPSolution(assignment, new DoubleValue(quality), new DoubleValue(flowDistanceQuality), new DoubleValue(installationQuality), new DoubleValue(overbookedCapacity)); 337 BestKnownSolution = new GQAPAssignment(assignment, new DoubleValue(quality), 338 new DoubleValue(flowDistanceQuality), new DoubleValue(installationQuality), 339 new DoubleValue(overbookedCapacity), EquipmentNames, LocationNames, Distances, Weights, InstallationCosts, 340 Demands, Capacities, TransportationCosts, OverbookedCapacityPenalty); 338 341 BestKnownQuality = new DoubleValue(quality); 339 342 BestKnownSolutions = new GQAPAssignmentArchive(EquipmentNames, LocationNames, Distances, Weights, InstallationCosts, Demands, Capacities, TransportationCosts, OverbookedCapacityPenalty); 340 BestKnownSolutions.Solutions.Add( (GQAPSolution)BestKnownSolution.Clone());343 BestKnownSolutions.Solutions.Add(BestKnownSolution); 341 344 } 342 345 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Interfaces/IBestKnownSolutionAwareGQAPOperator.cs
r7443 r7470 24 24 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { 25 25 public interface IBestKnownSolutionAwareGQAPOperator : IGQAPOperator { 26 ILookupParameter<GQAP Solution> BestKnownSolutionParameter { get; }26 ILookupParameter<GQAPAssignment> BestKnownSolutionParameter { get; } 27 27 } 28 28 } -
branches/GeneralizedQAP/HeuristicLab.Problems.Instances.TSPLIB/3.3/HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj
r7466 r7470 132 132 <EmbeddedResource Include="Data\TSP\lin105.tsp" /> 133 133 <EmbeddedResource Include="Data\TSP\lin318.tsp" /> 134 <EmbeddedResource Include="Data\TSP\linhp318.tsp" />135 134 <EmbeddedResource Include="Data\TSP\nrw1379.tsp" /> 136 135 <EmbeddedResource Include="Data\TSP\p654.tsp" /> … … 234 233 <Compile Include="Plugin.cs" /> 235 234 <Compile Include="Properties\AssemblyInfo.cs" /> 236 <None Include="Properties\AssemblyInfo. frame" />235 <None Include="Properties\AssemblyInfo.cs.frame" /> 237 236 </ItemGroup> 238 237 <ItemGroup> -
branches/GeneralizedQAP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBParser.cs
r7466 r7470 439 439 break; 440 440 default: 441 throw new InvalidDataException("Input files does not specify a valid node coordtype.");441 throw new InvalidDataException("Input files does not specify a valid display data type."); 442 442 } 443 443 … … 525 525 || edgeWeightFormat == TSPLIBEdgeWeightFormats.UPPER_ROW; 526 526 527 int dim1 = !triangular && !upperTriangular ? (diagonal ? 0 : 1) : 0;528 int dim2 = !triangular && upperTriangular ? (diagonal ? 0 : 1) : 0;527 int dim1 = triangular && !upperTriangular ? (diagonal ? 0 : 1) : 0; 528 int dim2 = triangular && upperTriangular ? (diagonal ? 0 : 1) : 0; 529 529 bool finished = false; 530 530 while (!finished) { -
branches/GeneralizedQAP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBTSPInstanceProvider.cs
r7466 r7470 29 29 namespace HeuristicLab.Problems.Instances.TSPLIB { 30 30 public class TSPLIBTSPInstanceProvider : ProblemInstanceProvider<ITSPInstance> { 31 31 32 32 public override string Name { 33 33 get { return "TSPLIB (symmetric TSP)"; } … … 64 64 var parser = new TSPLIBParser(stream); 65 65 parser.Parse(); 66 if (parser.FixedEdges != null) throw new InvalidDataException("TSP instance " + parser.Name + " contains fixed edges which are not supported by HeuristicLab."); 67 66 68 instance.Dimension = parser.Dimension; 67 69 instance.Coordinates = parser.Vertices != null ? parser.Vertices : parser.DisplayVertices; -
branches/GeneralizedQAP/UnitTests/TSPLIBInstanceProviderTest.cs
r7465 r7470 4 4 using Microsoft.VisualStudio.TestTools.UnitTesting; 5 5 6 namespace UnitTests 7 { 8 9 10 /// <summary> 11 ///This is a test class for TSPLIBInstanceProviderTest and is intended 12 ///to contain all TSPLIBInstanceProviderTest Unit Tests 13 ///</summary> 6 namespace UnitTests { 14 7 [TestClass()] 15 8 public class TSPLIBInstanceProviderTest { 16 /// <summary> 17 ///A test for GetInstance 18 ///</summary> 9 19 10 [TestMethod()] 20 11 public void GetTSPLIBTSPInstanceTest() { 21 TSPLIBTSPInstanceProvider target = new TSPLIBTSPInstanceProvider(); 12 var target = new TSPLIBTSPInstanceProvider(); 13 StringBuilder erroneousInstances = new StringBuilder(); 14 int count = 0; 15 foreach (var id in target.GetInstanceDescriptors()) { 16 try { 17 target.GetInstance(id); 18 } catch (Exception ex) { 19 erroneousInstances.AppendLine(id.Name + ": " + ex.Message); 20 } 21 count++; 22 } 23 Assert.IsTrue(count > 0, "No problem instances were found."); 24 Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString()); 25 } 26 27 [TestMethod()] 28 public void GetTSPLIBATSPInstanceTest() { 29 var target = new TSPLIBATSPInstanceProvider(); 30 StringBuilder erroneousInstances = new StringBuilder(); 31 int count = 0; 32 foreach (var id in target.GetInstanceDescriptors()) { 33 try { 34 target.GetInstance(id); 35 } catch (Exception ex) { 36 erroneousInstances.AppendLine(id.Name + ": " + ex.Message); 37 } 38 count++; 39 } 40 Assert.IsTrue(count > 0, "No problem instances were found."); 41 Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString()); 42 } 43 44 [TestMethod()] 45 public void GetTSPLIBCVRPInstanceTest() { 46 var target = new TSPLIBCVRPInstanceProvider(); 22 47 StringBuilder erroneousInstances = new StringBuilder(); 23 48 int count = 0; -
branches/GeneralizedQAP/UnitTests/UnitTests.csproj
r7465 r7470 97 97 </ItemGroup> 98 98 <ItemGroup> 99 <Compile Include="ElloumiCTAPInstanceProviderTest.cs" /> 100 <Compile Include="QAPLIBInstanceProviderTest.cs" /> 99 101 <Compile Include="GQAPNMoveEvaluatorTest.cs" /> 100 102 <Compile Include="Properties\AssemblyInfo.cs" /> … … 109 111 <Project>{C739E6D2-5680-4804-A810-8017DA0C238F}</Project> 110 112 <Name>HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3</Name> 113 </ProjectReference> 114 <ProjectReference Include="..\HeuristicLab.Problems.Instances.ElloumiCTAP\3.3\HeuristicLab.Problems.Instances.ElloumiCTAP-3.3.csproj"> 115 <Project>{CCF61DA0-B226-4C0F-8052-29ACC6BDE6EE}</Project> 116 <Name>HeuristicLab.Problems.Instances.ElloumiCTAP-3.3</Name> 117 </ProjectReference> 118 <ProjectReference Include="..\HeuristicLab.Problems.Instances.QAPLIB\3.3\HeuristicLab.Problems.Instances.QAPLIB-3.3.csproj"> 119 <Project>{73F29D43-5714-4069-8FAB-0D18FEB5F175}</Project> 120 <Name>HeuristicLab.Problems.Instances.QAPLIB-3.3</Name> 111 121 </ProjectReference> 112 122 <ProjectReference Include="..\HeuristicLab.Problems.Instances.TSPLIB\3.3\HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj">
Note: See TracChangeset
for help on using the changeset viewer.