- Timestamp:
- 02/15/12 19:24:54 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.