Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5949


Ignore:
Timestamp:
04/04/11 22:30:39 (13 years ago)
Author:
abeham
Message:

#1330

  • some remaining problems with benchmark data, two instances had quality values and solutions that did not go together
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 88900
    2 31 23 18 21 22 19 10 11 15 9 30 29 14 12 17 26 27
    3 28 1 7 6 25 5 3 8 24 32 13 2 20 4 16
     132 88700
     231,23,18,21,22,19,10,11,15,9,30,29,14,12,17,26,
     327,28,1,7,6,25,5,3,8,24,32,13,2,20,4,16
    44
    55
    66
    7 
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/Data/ste36a.sln

    r5562 r5949  
    11  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 9
    3   8 7 6 23 33 34 25 35 27 26 1 36
     2  35,5,6,12,11,27,26,25,24,9,4,1,13,20,14,23,21,22,2,8,10,7,28,19,
     332,34,33,17,18,3,15,16,29,30,31,36
    44
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs

    r5948 r5949  
    337337          if (!solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, Distances))) {
    338338            solStream.Seek(0, SeekOrigin.Begin);
     339            solParser.Reset();
    339340            solParser.Parse(solStream, false); // some sln's seem to be of the type index = "location" => value = "facility"
    340341            if (solParser.Error != null) throw solParser.Error;
     
    343344              BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment);
    344345            } else {
    345               BestKnownQuality = null;
     346              BestKnownQuality = new DoubleValue(solParser.Quality);
    346347              BestKnownSolution = null;
    347348            }
  • trunk/sources/HeuristicLab.Problems.QuadraticAssignment/3.3/Tests/QAPLIBInstancesTest.cs

    r5933 r5949  
    2121
    2222using System;
     23using System.Collections.Generic;
     24using System.IO;
     25using System.Linq;
     26using System.Reflection;
    2327using System.Text;
    2428using HeuristicLab.Common;
     
    3842        } catch (Exception ex) {
    3943          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);
    4062        }
    4163      }
     
    6385            failedInstances.AppendLine(instance + ": Reported quality: " + qap.BestKnownQuality.Value.ToString() + ", evaluated fitness: " + quality.ToString() + ".");
    6486          }
     87        } else if (qap.BestKnownQuality != null) {
     88          failedInstances.AppendLine(instance + ": The solution failed to load, only the quality value is available!");
    6589        }
    6690
Note: See TracChangeset for help on using the changeset viewer.