- Timestamp:
- 10/04/19 17:31:54 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs
r17270 r17320 24 24 using System.Drawing; 25 25 using System.Linq; 26 using System.Threading; 26 27 using HEAL.Attic; 27 28 using HeuristicLab.Common; … … 135 136 } 136 137 137 public override double Evaluate(Permutation assignment, IRandom random ) {138 return Evaluate(assignment );139 } 140 141 public double Evaluate(Permutation assignment ) {138 public override double Evaluate(Permutation assignment, IRandom random, CancellationToken cancellationToken) { 139 return Evaluate(assignment, cancellationToken); 140 } 141 142 public double Evaluate(Permutation assignment, CancellationToken cancellationToken) { 142 143 double quality = 0; 143 144 for (int i = 0; i < assignment.Length; i++) { … … 283 284 // calculate the optimum of a LAP relaxation and use it as lower bound of our QAP 284 285 LowerBound = new DoubleValue(GilmoreLawlerBoundCalculator.CalculateLowerBound(Weights, Distances, out lbSolution)); 285 // evalu te the LAP optimal solution as if it was a QAP solution286 var lbSolutionQuality = Evaluate(lbSolution );286 // evaluate the LAP optimal solution as if it was a QAP solution 287 var lbSolutionQuality = Evaluate(lbSolution, CancellationToken.None); 287 288 // in case both qualities are the same it means that the LAP optimum is also a QAP optimum 288 289 if (LowerBound.Value.IsAlmost(lbSolutionQuality)) { … … 312 313 313 314 public void Load(QAPData data) { 314 if (data.Dimension > ProblemSizeLimit) throw new System.IO.InvalidDataException("The problem is limited to instance of size " + ProblemSizeLimit + ". You can change this limit by modifying " + nameof(QuadraticAssignmentProblem) + "." + nameof(ProblemSizeLimit) + "!");315 if (data.Dimension > ProblemSizeLimit) throw new System.IO.InvalidDataException("The problem is limited to instance of size " + ProblemSizeLimit + ". You can change this limit by modifying " + nameof(QuadraticAssignmentProblem) + "." + nameof(ProblemSizeLimit) + "!"); 315 316 var weights = new DoubleMatrix(data.Weights, @readonly: true); 316 317 var distances = new DoubleMatrix(data.Distances, @readonly: true); … … 363 364 if (assignment == null || assignment.Length == 0) return; 364 365 var vector = new Permutation(PermutationTypes.Absolute, assignment); 365 var result = Evaluate(vector );366 var result = Evaluate(vector, CancellationToken.None); 366 367 BestKnownQuality = result; 367 368 BestKnownSolution = vector;
Note: See TracChangeset
for help on using the changeset viewer.