Changeset 11932 for stable/HeuristicLab.Problems.Instances.VehicleRouting
- Timestamp:
- 02/06/15 10:08:54 (10 years ago)
- Location:
- stable
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
stable
- Property svn:mergeinfo changed
/trunk/sources merged: 11650-11651
- Property svn:mergeinfo changed
-
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/HeuristicLab.Problems.Instances.VehicleRouting-3.4.csproj
r11931 r11932 109 109 </PropertyGroup> 110 110 <ItemGroup> 111 <Reference Include="ICSharpCode.SharpZipLib">112 <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath>113 <Private>False</Private>114 </Reference>115 111 <Reference Include="System" /> 116 112 <Reference Include="System.Core" /> 117 113 <Reference Include="System.Data" /> 114 <Reference Include="System.IO.Compression" /> 118 115 </ItemGroup> 119 116 <ItemGroup> -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/LiLimFormat/LiLimInstanceProvider.cs
r11334 r11932 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.IO;25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/HombergerInstanceProvider.cs
r11334 r11932 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.IO;25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/SolomonFormat/SolomonInstanceProvider.cs
r11170 r11932 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.IO;25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 31 get { return "Solomon test set"; } 38 32 } 39 33 40 34 public override Uri WebLink { 41 35 get { return new Uri(@"http://web.cba.neu.edu/~msolomon/problems.htm"); } -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/AugeratInstanceProvider.cs
r11170 r11932 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.IO;25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 31 get { return "Augerat test set"; } 38 32 } 39 33 40 34 public override Uri WebLink { 41 35 get { return new Uri(@"http://www.branchandcut.org/VRP/data"); } -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TSPLibFormat/ChristofidesEilonInstanceProvider.cs
r11170 r11932 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.IO;25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 31 get { return "Christofides and Eilon test set"; } 38 32 } 39 33 40 34 public override Uri WebLink { 41 35 get { return new Uri(@"http://www.branchandcut.org/VRP/data"); } -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/TaillardFormat/TaillardInstanceProvider.cs
r11170 r11932 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.IO;25 using System.Linq;26 using System.Reflection;27 using System.Text.RegularExpressions;28 using ICSharpCode.SharpZipLib.Zip;29 23 30 24 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 31 get { return "Taillard test set"; } 38 32 } 39 33 40 34 public override Uri WebLink { 41 35 get { return new Uri(@"http://mistic.heig-vd.ch/taillard/problemes.dir/vrp.dir/vrp.html"); } -
stable/HeuristicLab.Problems.Instances.VehicleRouting/3.4/VRPInstanceProvider.cs
r11931 r11932 23 23 using System.Collections.Generic; 24 24 using System.IO; 25 using System.IO.Compression; 25 26 using System.Linq; 26 27 using System.Reflection; 27 28 using System.Text.RegularExpressions; 28 29 using HeuristicLab.Common; 29 using ICSharpCode.SharpZipLib.Zip;30 30 31 31 namespace HeuristicLab.Problems.Instances.VehicleRouting { … … 37 37 var solutionsArchiveName = GetResourceName(FileName + @"\.opt\.zip"); 38 38 if (!String.IsNullOrEmpty(solutionsArchiveName)) { 39 using (var solutionsZipFile = new Zip InputStream(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {40 foreach (var entry in GetZipContents(solutionsZipFile))41 solutions.Add(Path.GetFileNameWithoutExtension(entry ) + "." + FileName, entry);39 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName), ZipArchiveMode.Read)) { 40 foreach (var entry in solutionsZipFile.Entries) 41 solutions.Add(Path.GetFileNameWithoutExtension(entry.Name) + "." + FileName, entry.Name); 42 42 } 43 43 } … … 45 45 if (String.IsNullOrEmpty(instanceArchiveName)) yield break; 46 46 47 using (var instanceStream = new Zip InputStream(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {48 foreach (var entry in GetZipContents(instanceStream).OrderBy(x => x, new NaturalStringComparer())) {47 using (var instanceStream = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) { 48 foreach (var entry in instanceStream.Entries.Select(x => x.Name).OrderBy(x => x, new NaturalStringComparer())) { 49 49 string solutionEntry = Path.GetFileNameWithoutExtension(entry) + "." + FileName; 50 50 yield return new VRPDataDescriptor(Path.GetFileNameWithoutExtension(entry), GetInstanceDescription(), entry, solutions.ContainsKey(solutionEntry) ? solutions[solutionEntry] : String.Empty); … … 56 56 var descriptor = (VRPDataDescriptor)id; 57 57 var instanceArchiveName = GetResourceName(FileName + @"\.zip"); 58 using (var instancesZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) {58 using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName))) { 59 59 var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier); 60 var stream = instancesZipFile.GetInputStream(entry);60 var stream = entry.Open(); 61 61 var instance = LoadData(stream); 62 62 if (string.IsNullOrEmpty(instance.Name)) { … … 66 66 if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) { 67 67 var solutionsArchiveName = GetResourceName(FileName + @"\.opt\.zip"); 68 using (var solutionsZipFile = new Zip File(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) {68 using (var solutionsZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(solutionsArchiveName))) { 69 69 entry = solutionsZipFile.GetEntry(descriptor.SolutionIdentifier); 70 stream = solutionsZipFile.GetInputStream(entry);70 stream = entry.Open(); 71 71 LoadSolution(stream, instance); 72 72 } … … 130 130 LoadSolution(stream, instance); 131 131 } 132 } catch (Exception) { 132 } 133 catch (Exception) { 133 134 // new stream necessary because first try already read from stream 134 135 using (var stream = new FileStream(path, FileMode.Open)) { … … 149 150 return "Embedded instance of plugin version " + Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true).Cast<AssemblyFileVersionAttribute>().First().Version + "."; 150 151 } 151 152 protected IEnumerable<string> GetZipContents(ZipInputStream zipFile) {153 ZipEntry entry;154 while ((entry = zipFile.GetNextEntry()) != null) {155 yield return entry.Name;156 }157 }158 152 #endregion 159 153 }
Note: See TracChangeset
for help on using the changeset viewer.