Changeset 8909
- Timestamp:
- 11/13/12 16:00:58 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 9 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.QAPLIB/3.3/HeuristicLab.Problems.Instances.QAPLIB-3.3.csproj
r8624 r8909 103 103 <ItemGroup> 104 104 <Reference Include="ICSharpCode.SharpZipLib"> 105 106 107 105 <HintPath>..\..\HeuristicLab.PluginInfrastructure\3.3\ICSharpCode.SharpZipLib.dll</HintPath> 106 <Private>False</Private> 107 </Reference> 108 108 <Reference Include="System" /> 109 109 <Reference Include="System.Core" /> … … 111 111 </ItemGroup> 112 112 <ItemGroup> 113 <Compile Include="TaillardQAPInstanceProvider.cs" /> 114 <Compile Include="DreznerQAPInstanceProvider.cs" /> 115 <Compile Include="MicroarrayQAPInstanceProvider.cs" /> 113 116 <Compile Include="QAPLIBParser.cs" /> 114 117 <Compile Include="QAPLIBDataDescriptor.cs" /> … … 117 120 <EmbeddedResource Include="Data\qap.dat.zip" /> 118 121 <EmbeddedResource Include="Data\qap.sln.zip" /> 122 <EmbeddedResource Include="Data\microarray.dat.zip" /> 123 <EmbeddedResource Include="Data\microarray.sln.zip" /> 124 <EmbeddedResource Include="Data\drezner.dat.zip" /> 125 <EmbeddedResource Include="Data\drezner.sln.zip" /> 126 <EmbeddedResource Include="Data\taillard.dat.zip" /> 127 <EmbeddedResource Include="Data\taillard.sln.zip" /> 119 128 <None Include="Plugin.cs.frame" /> 120 129 <Compile Include="Plugin.cs" /> … … 144 153 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 145 154 <PropertyGroup> 146 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)155 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 147 156 set ProjectDir=$(ProjectDir) 148 157 set SolutionDir=$(SolutionDir) … … 150 159 151 160 call PreBuildEvent.cmd</PreBuildEvent> 152 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">161 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 153 162 export ProjectDir=$(ProjectDir) 154 163 export SolutionDir=$(SolutionDir) -
trunk/sources/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBInstanceProvider.cs
r8553 r8909 167 167 } 168 168 169 pr ivate const string FileName = "qap";169 protected virtual string FileName { get { return "qap"; } } 170 170 171 171 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { -
trunk/sources/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBParser.cs
r7558 r8909 58 58 Distances = new double[Size, Size]; 59 59 Weights = new double[Size, Size]; 60 char[] delim = new char[] { ' ' };60 char[] delim = new char[] { ' ', '\t' }; 61 61 62 62 Weights = ParseMatrix(reader, delim); -
trunk/sources/HeuristicLab.Problems.Instances.QAPLIB/3.3/QAPLIBSolutionParser.cs
r8553 r8909 23 23 using System.Globalization; 24 24 using System.IO; 25 using System.Linq; 25 26 26 27 namespace HeuristicLab.Problems.Instances.QAPLIB { … … 81 82 try { 82 83 StreamReader reader = new StreamReader(stream); 83 char[] delim = new char[] { ' ', ' ,' }; // comma is added for nug30.sln which is the only file that separates the permutation with commas84 char[] delim = new char[] { ' ', '\t', ',' }; // comma is added for nug30.sln which is the only file that separates the permutation with commas 84 85 string[] firstline = reader.ReadLine().Split(delim, StringSplitOptions.RemoveEmptyEntries); 85 86 Size = int.Parse(firstline[0]); … … 90 91 string valLine = reader.ReadLine(); 91 92 string[] vals = valLine.Split(delim, StringSplitOptions.RemoveEmptyEntries); 93 int start = 1; 94 if (vals.Any(x => x == "0")) start = 0; 92 95 if (vals.Length == 0) continue; 93 96 for (int j = 0; j < vals.Length; j++) { 94 97 if (valueAsLocation) 95 Assignment[int.Parse(vals[j]) - 1] = read++;96 else Assignment[read++] = int.Parse(vals[j]) - 1;98 Assignment[int.Parse(vals[j]) - start] = read++; 99 else Assignment[read++] = int.Parse(vals[j]) - start; 97 100 } 98 101 } -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.Instances-3.3/QAPLIBInstanceProviderTest.cs
r7915 r8909 46 46 Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString()); 47 47 } 48 49 [TestMethod()] 50 public void GetMicroarrayQAPInstanceTest() { 51 var target = new MicroarrayQAPInstanceProvider(); 52 StringBuilder erroneousInstances = new StringBuilder(); 53 int count = 0; 54 foreach (var id in target.GetDataDescriptors()) { 55 try { 56 target.LoadData(id); 57 } catch (Exception ex) { 58 erroneousInstances.AppendLine(id.Name + ": " + ex.Message); 59 } 60 count++; 61 } 62 Assert.IsTrue(count > 0, "No problem instances were found."); 63 Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString()); 64 } 65 66 [TestMethod()] 67 public void GetDreznerQAPInstanceTest() { 68 var target = new DreznerQAPInstanceProvider(); 69 StringBuilder erroneousInstances = new StringBuilder(); 70 int count = 0; 71 foreach (var id in target.GetDataDescriptors()) { 72 try { 73 target.LoadData(id); 74 } catch (Exception ex) { 75 erroneousInstances.AppendLine(id.Name + ": " + ex.Message); 76 } 77 count++; 78 } 79 Assert.IsTrue(count > 0, "No problem instances were found."); 80 Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString()); 81 } 82 83 [TestMethod()] 84 public void GetTaillardQAPInstanceTest() { 85 var target = new TaillardQAPInstanceProvider(); 86 StringBuilder erroneousInstances = new StringBuilder(); 87 int count = 0; 88 foreach (var id in target.GetDataDescriptors()) { 89 try { 90 target.LoadData(id); 91 } catch (Exception ex) { 92 erroneousInstances.AppendLine(id.Name + ": " + ex.Message); 93 } 94 count++; 95 } 96 Assert.IsTrue(count > 0, "No problem instances were found."); 97 Assert.IsTrue(erroneousInstances.Length == 0, "Some instances could not be parsed: " + Environment.NewLine + erroneousInstances.ToString()); 98 } 48 99 } 49 100 }
Note: See TracChangeset
for help on using the changeset viewer.