Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/11 12:03:24 (13 years ago)
Author:
abeham
Message:

#1330

  • Added a test if the reported quality of the solution instances is similar to the evaluated qualities of these solutions
  • Adapted parsing of the solution file and added another parameter whether the permutation should be treated as facility->location (HeuristicLab default) or location->facility.
  • Adapted QuadraticAssignmentProblem to use that method that corresponds with the reported quality since there is no consistent encoding over all files
  • Improved API documentation of the parsing methods
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/QAP/HeuristicLab.Problems.QuadraticAssignment/3.3/QuadraticAssignmentProblem.cs

    r5811 r5814  
    325325          .GetManifestResourceStream(InstancePrefix + instance + ".sln")) {
    326326          QAPLIBSolutionParser solParser = new QAPLIBSolutionParser();
    327           solParser.Parse(solStream);
     327          solParser.Parse(solStream, false); // most sln's seem to be of the type index = location => value = facility
    328328          if (solParser.Error != null) throw solParser.Error;
    329           BestKnownQuality = new DoubleValue(solParser.Qualiy);
    330           BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment);
     329          if (!solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, DistanceMatrix))) {
     330            solStream.Seek(0, SeekOrigin.Begin);
     331            solParser.Parse(solStream, true); // some sln's seem to be of the type index = facility => value = location
     332            if (solParser.Error != null) throw solParser.Error;
     333            if (solParser.Quality.IsAlmost(QAPEvaluator.Apply(new Permutation(PermutationTypes.Absolute, solParser.Assignment), Weights, DistanceMatrix))) {
     334              BestKnownQuality = new DoubleValue(solParser.Quality);
     335              BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment);
     336            } else {
     337              BestKnownQuality = null;
     338              BestKnownSolution = null;
     339            }
     340          } else {
     341            BestKnownQuality = new DoubleValue(solParser.Quality);
     342            BestKnownSolution = new Permutation(PermutationTypes.Absolute, solParser.Assignment);
     343          }
    331344        }
    332345      } else {
Note: See TracChangeset for help on using the changeset viewer.