- Timestamp:
- 07/16/17 10:07:19 (7 years ago)
- Location:
- stable
- Files:
-
- 10 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 14697
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj
r13486 r15259 130 130 <EmbeddedResource Include="Data\tsp.opt.tour.zip" /> 131 131 <EmbeddedResource Include="Data\vrp.zip" /> 132 <EmbeddedResource Include="Data\tsp.qual" /> 133 <EmbeddedResource Include="Data\atsp.qual" /> 132 134 <None Include="Plugin.cs.frame" /> 133 135 <Compile Include="Plugin.cs" /> -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBATSPInstanceProvider.cs
r14186 r15259 56 56 instance.BestKnownTour = parser.Tour.FirstOrDefault(); 57 57 } 58 59 protected override void LoadQuality(double? bestQuality, ATSPData instance) { 60 instance.BestKnownQuality = bestQuality; 61 } 58 62 } 59 63 } -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBCVRPInstanceProvider.cs
r14186 r15259 78 78 instance.BestKnownTour = parser.Tour; 79 79 } 80 81 protected override void LoadQuality(double? bestQuality, CVRPData instance) { 82 instance.BestKnownQuality = bestQuality; 83 } 80 84 } 81 85 } -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBDataDescriptor.cs
r14186 r15259 27 27 internal string InstanceIdentifier { get; set; } 28 28 internal string SolutionIdentifier { get; set; } 29 internal double? BestQuality { get; set; } 29 30 30 internal TSPLIBDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier ) {31 internal TSPLIBDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier, double? bestQuality) { 31 32 this.Name = name; 32 33 this.Description = description; 33 34 this.InstanceIdentifier = instanceIdentifier; 34 35 this.SolutionIdentifier = solutionIdentifier; 36 this.BestQuality = bestQuality; 35 37 } 36 38 } -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBHeterogeneousPTSPDataDescriptor.cs
r14186 r15259 26 26 27 27 internal TSPLIBHeterogeneousPTSPDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier, int seed) 28 : base(name, description, instanceIdentifier, solutionIdentifier ) {28 : base(name, description, instanceIdentifier, solutionIdentifier, null) { 29 29 this.Name = name; 30 30 this.Description = description; -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBHomogeneousPTSPDataDescriptor.cs
r14186 r15259 25 25 26 26 internal TSPLIBHomogeneousPTSPDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier, double probability) 27 : base(name, description, instanceIdentifier, solutionIdentifier ) {27 : base(name, description, instanceIdentifier, solutionIdentifier, null) { 28 28 this.Name = name; 29 29 this.Description = description; -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBInstanceProvider.cs
r14186 r15259 47 47 protected abstract T LoadInstance(TSPLIBParser parser, IDataDescriptor descriptor = null); 48 48 protected abstract void LoadSolution(TSPLIBParser parser, T instance); 49 protected abstract void LoadQuality(double? bestQuality, T instance); 49 50 50 51 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { … … 57 58 } 58 59 } 60 61 Dictionary<string, double> qualities = new Dictionary<string, double>(); 62 var qualitiesArchiveName = GetResourceName(FileExtension + @"\.qual"); 63 if (!String.IsNullOrEmpty(qualitiesArchiveName)) { 64 using (var qualitiesReader = new StreamReader(GetType().Assembly.GetManifestResourceStream(qualitiesArchiveName))) { 65 while (!qualitiesReader.EndOfStream) { 66 var line = qualitiesReader.ReadLine().Split(';'); 67 qualities.Add(line[0] + "." + FileExtension, double.Parse(line[1])); 68 } 69 } 70 } 71 59 72 var instanceArchiveName = GetResourceName(FileExtension + @"\.zip"); 60 73 if (String.IsNullOrEmpty(instanceArchiveName)) yield break; … … 62 75 using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 63 76 foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x)) { 64 yield return new TSPLIBDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetInstanceDescription(), entry, solutions.ContainsKey(entry) ? solutions[entry] : String.Empty); 77 yield return new TSPLIBDataDescriptor(Path.GetFileNameWithoutExtension(entry), 78 GetInstanceDescription(), 79 entry, 80 solutions.ContainsKey(entry) ? solutions[entry] : String.Empty, 81 qualities.ContainsKey(entry) ? (double?)qualities[entry] : null); 65 82 } 66 83 } … … 75 92 var parser = new TSPLIBParser(stream); 76 93 var instance = LoadInstance(parser, id); 94 LoadQuality(descriptor.BestQuality, instance); 77 95 78 96 if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) { -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBPTSPInstanceProvider.cs
r14186 r15259 81 81 } 82 82 83 protected override void LoadQuality(double? bestQuality, PTSPData instance) { 84 instance.BestKnownQuality = bestQuality; 85 } 86 83 87 public PTSPData LoadData(string tspFile, string tourFile, double? bestQuality) { 84 88 var data = LoadInstance(new TSPLIBParser(tspFile)); -
stable/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBTSPInstanceProvider.cs
r14186 r15259 81 81 } 82 82 83 protected override void LoadQuality(double? bestQuality, TSPData instance) { 84 instance.BestKnownQuality = bestQuality; 85 } 86 83 87 public TSPData LoadData(string tspFile, string tourFile, double? bestQuality) { 84 88 var data = LoadInstance(new TSPLIBParser(tspFile));
Note: See TracChangeset
for help on using the changeset viewer.