- Timestamp:
- 09/19/19 20:46:19 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2521_ProblemRefactoring/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBPTSPInstanceProvider.cs
r17226 r17265 22 22 using System; 23 23 using System.IO; 24 using System.Linq;25 24 26 25 namespace HeuristicLab.Problems.Instances.TSPLIB { … … 76 75 protected abstract double[] GetProbabilities(IDataDescriptor descriptor, PTSPData instance); 77 76 77 public override PTSPData LoadData(IDataDescriptor id) { 78 var tsplibId = (id as TSPLIBDataDescriptor); 79 if (tsplibId != null) tsplibId.SolutionIdentifier = null; 80 return base.LoadData(tsplibId ?? id); 81 } 82 78 83 protected override void LoadSolution(TSPLIBParser parser, PTSPData instance) { 79 parser.Parse(); 80 instance.BestKnownTour = parser.Tour.FirstOrDefault(); 84 // solutions are not defined for pTSP 81 85 } 82 86 83 87 protected override void LoadQuality(double? bestQuality, PTSPData instance) { 84 instance.BestKnownQuality = bestQuality;88 // best known qualities are not defined for pTSP 85 89 } 86 87 public PTSPData LoadData(string tspFile, string tourFile, double? bestQuality) {88 var data = LoadInstance(new TSPLIBParser(tspFile));89 if (!String.IsNullOrEmpty(tourFile)) {90 var tourParser = new TSPLIBParser(tourFile);91 LoadSolution(tourParser, data);92 }93 if (bestQuality.HasValue)94 data.BestKnownQuality = bestQuality.Value;95 return data;96 }97 98 90 } 99 91 }
Note: See TracChangeset
for help on using the changeset viewer.