Changeset 5949 for trunk/sources/HeuristicLab.Problems.QuadraticAssignment
- Timestamp:
- 04/04/11 22:30:39 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/Data/kra32.sln
r5562 r5949 1 32 88 9002 31 23 18 21 22 19 10 11 15 9 30 29 14 12 17 26 273 2 8 1 7 6 25 5 3 8 24 32 13 2 20 4161 32 88700 2 31,23,18,21,22,19,10,11,15,9,30,29,14,12,17,26, 3 27,28,1,7,6,25,5,3,8,24,32,13,2,20,4,16 4 4 5 5 6 6 7 -
trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/Data/ste36a.sln
r5562 r5949 1 1 36 9526 2 12 19 30 11 2 3 22 20 10 21 5 4 13 15 31 32 28 29 24 14 17 18 16 93 8 7 6 23 33 34 25 35 27 26 1362 35,5,6,12,11,27,26,25,24,9,4,1,13,20,14,23,21,22,2,8,10,7,28,19, 3 32,34,33,17,18,3,15,16,29,30,31,36 4 4 -
trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs
r5948 r5949 337 337 if (!solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, Distances))) { 338 338 solStream.Seek(0, SeekOrigin.Begin); 339 solParser.Reset(); 339 340 solParser.Parse(solStream, false); // some sln's seem to be of the type index = "location" => value = "facility" 340 341 if (solParser.Error != null) throw solParser.Error; … … 343 344 BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment); 344 345 } else { 345 BestKnownQuality = n ull;346 BestKnownQuality = new DoubleValue(solParser.Quality); 346 347 BestKnownSolution = null; 347 348 } -
trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/QAPLIBInstancesTest.cs
r5933 r5949 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.IO; 25 using System.Linq; 26 using System.Reflection; 23 27 using System.Text; 24 28 using HeuristicLab.Common; … … 38 42 } catch (Exception ex) { 39 43 failedInstances.AppendLine(instance + ": " + ex.Message); 44 } 45 } 46 Assert.IsTrue(failedInstances.Length == 0, "Following instances failed to load: " + Environment.NewLine + failedInstances.ToString()); 47 } 48 49 [TestMethod] 50 public void LoadAllEmbeddedSolutions() { 51 IEnumerable<string> solutionFiles = Assembly.GetAssembly(typeof(QuadraticAssignmentProblem)) 52 .GetManifestResourceNames() 53 .Where(x => x.EndsWith(".sln")); 54 QAPLIBSolutionParser parser = new QAPLIBSolutionParser(); 55 StringBuilder failedInstances = new StringBuilder(); 56 foreach (string solution in solutionFiles) { 57 using (Stream stream = Assembly.GetAssembly(typeof(QuadraticAssignmentProblem)).GetManifestResourceStream(solution)) { 58 parser.Reset(); 59 parser.Parse(stream, true); 60 if (parser.Error != null) 61 failedInstances.AppendLine(solution + ": " + parser.Error.Message); 40 62 } 41 63 } … … 63 85 failedInstances.AppendLine(instance + ": Reported quality: " + qap.BestKnownQuality.Value.ToString() + ", evaluated fitness: " + quality.ToString() + "."); 64 86 } 87 } else if (qap.BestKnownQuality != null) { 88 failedInstances.AppendLine(instance + ": The solution failed to load, only the quality value is available!"); 65 89 } 66 90
Note: See TracChangeset
for help on using the changeset viewer.