- Timestamp:
- 11/28/15 23:38:51 (9 years ago)
- Location:
- branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB
- Files:
-
- 1 added
- 5 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB/3.3/HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj
r11650 r13412 19 19 <DebugType>full</DebugType> 20 20 <Optimize>false</Optimize> 21 <OutputPath>..\..\ bin\</OutputPath>21 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 22 22 <DefineConstants>DEBUG;TRACE</DefineConstants> 23 23 <ErrorReport>prompt</ErrorReport> … … 28 28 <DebugType>pdbonly</DebugType> 29 29 <Optimize>true</Optimize> 30 <OutputPath>..\..\ bin\</OutputPath>30 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 31 31 <DefineConstants>TRACE</DefineConstants> 32 32 <ErrorReport>prompt</ErrorReport> … … 42 42 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'"> 43 43 <DebugSymbols>true</DebugSymbols> 44 <OutputPath>..\..\ bin\</OutputPath>44 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 45 45 <DefineConstants>DEBUG;TRACE</DefineConstants> 46 46 <DebugType>full</DebugType> … … 58 58 </PropertyGroup> 59 59 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'"> 60 <OutputPath>..\..\ bin\</OutputPath>60 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 61 61 <DefineConstants>TRACE</DefineConstants> 62 62 <Optimize>true</Optimize> … … 76 76 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'"> 77 77 <DebugSymbols>true</DebugSymbols> 78 <OutputPath>..\..\ bin\</OutputPath>78 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 79 79 <DefineConstants>DEBUG;TRACE</DefineConstants> 80 80 <DebugType>full</DebugType> … … 92 92 </PropertyGroup> 93 93 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'"> 94 <OutputPath>..\..\ bin\</OutputPath>94 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 95 95 <DefineConstants>TRACE</DefineConstants> 96 96 <Optimize>true</Optimize> … … 109 109 </PropertyGroup> 110 110 <ItemGroup> 111 <Reference Include="HeuristicLab.Common-3.3"> 112 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 113 <Private>False</Private> 114 </Reference> 115 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 116 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 117 <Private>False</Private> 118 </Reference> 111 119 <Reference Include="System" /> 112 120 <Reference Include="System.Core" /> … … 115 123 </ItemGroup> 116 124 <ItemGroup> 125 <Compile Include="MarsagliaRandom.cs" /> 126 <Compile Include="TSPLIBHeterogeneousPTSPDataDescriptor.cs" /> 127 <Compile Include="TSPLIBHomogeneousPTSPDataDescriptor.cs" /> 128 <Compile Include="TSPLIBHeterogeneousPTSPInstanceProvider.cs" /> 117 129 <Compile Include="TSPLIBInstanceProvider.cs" /> 118 130 <Compile Include="TSPLIBATSPInstanceProvider.cs" /> 119 131 <Compile Include="TSPLIBCVRPInstanceProvider.cs" /> 120 132 <Compile Include="TSPLIBDataDescriptor.cs" /> 133 <Compile Include="TSPLIBHomogeneousPTSPInstanceProvider.cs" /> 121 134 <Compile Include="TSPLIBTSPInstanceProvider.cs" /> 122 135 <Compile Include="TSPLIBParser.cs" /> … … 134 147 </ItemGroup> 135 148 <ItemGroup> 136 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj">137 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project>138 <Name>HeuristicLab.Common-3.3</Name>139 <Private>False</Private>140 </ProjectReference>141 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj">142 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project>143 <Name>HeuristicLab.PluginInfrastructure-3.3</Name>144 <Private>False</Private>145 </ProjectReference>146 149 <ProjectReference Include="..\..\HeuristicLab.Problems.Instances\3.3\HeuristicLab.Problems.Instances-3.3.csproj"> 147 <Project>{3540 E29E-4793-49E7-8EE2-FEA7F61C3994}</Project>150 <Project>{3540e29e-4793-49e7-8ee2-fea7f61c3994}</Project> 148 151 <Name>HeuristicLab.Problems.Instances-3.3</Name> 149 152 <Private>False</Private> 150 153 </ProjectReference> 151 154 </ItemGroup> 152 <ItemGroup />153 155 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 154 156 <PropertyGroup> -
branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBATSPInstanceProvider.cs
r12012 r13412 36 36 protected override string FileExtension { get { return "atsp"; } } 37 37 38 protected override ATSPData LoadInstance(TSPLIBParser parser ) {38 protected override ATSPData LoadInstance(TSPLIBParser parser, IDataDescriptor descriptor = null) { 39 39 var instance = new ATSPData(); 40 40 -
branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBCVRPInstanceProvider.cs
r12012 r13412 36 36 protected override string FileExtension { get { return "vrp"; } } 37 37 38 protected override CVRPData LoadInstance(TSPLIBParser parser ) {38 protected override CVRPData LoadInstance(TSPLIBParser parser, IDataDescriptor descriptor = null) { 39 39 parser.Parse(); 40 40 var instance = new CVRPData(); -
branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBHeterogeneousPTSPDataDescriptor.cs
r13408 r13412 20 20 #endregion 21 21 22 22 23 namespace HeuristicLab.Problems.Instances.TSPLIB { 23 internal class TSPLIBDataDescriptor : IDataDescriptor { 24 public string Name { get; internal set; } 25 public string Description { get; internal set; } 24 internal class TSPLIBHeterogeneousPTSPDataDescriptor : TSPLIBDataDescriptor { 25 public int Seed { get; internal set; } 26 26 27 internal string InstanceIdentifier { get; set; } 28 internal string SolutionIdentifier { get; set; } 29 30 internal TSPLIBDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier) { 27 internal TSPLIBHeterogeneousPTSPDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier, int seed) 28 : base(name, description, instanceIdentifier, solutionIdentifier) { 31 29 this.Name = name; 32 30 this.Description = description; 33 31 this.InstanceIdentifier = instanceIdentifier; 34 32 this.SolutionIdentifier = solutionIdentifier; 33 this.Seed = seed; 35 34 } 36 35 } -
branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBHeterogeneousPTSPInstanceProvider.cs
r13408 r13412 21 21 22 22 using System; 23 using System.Collections.Generic; 23 24 using System.IO; 24 25 using System.Linq; 25 26 26 27 namespace HeuristicLab.Problems.Instances.TSPLIB { 27 public class TSPLIB TSPInstanceProvider : TSPLIBInstanceProvider<TSPData> {28 public class TSPLIBHeterogeneousPTSPInstanceProvider : TSPLIBInstanceProvider<PTSPData> { 28 29 29 30 public override string Name { 30 get { return "TSPLIB ( symmetricTSP)"; }31 get { return "TSPLIB (heterogeneous symmetric PTSP)"; } 31 32 } 32 33 … … 37 38 protected override string FileExtension { get { return "tsp"; } } 38 39 39 protected override TSPData LoadInstance(TSPLIBParser parser) { 40 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { 41 foreach (var desc in base.GetDataDescriptors().OfType<TSPLIBDataDescriptor>()) { 42 desc.Name += " [0.1;0.9]"; 43 desc.SolutionIdentifier = null; 44 yield return desc; 45 } 46 } 47 48 protected override PTSPData LoadInstance(TSPLIBParser parser, IDataDescriptor descriptor = null) { 40 49 parser.Parse(); 41 50 if (parser.FixedEdges != null) throw new InvalidDataException("TSP instance " + parser.Name + " contains fixed edges which are not supported by HeuristicLab."); 42 var instance = new TSPData();51 var instance = new PTSPData(); 43 52 instance.Dimension = parser.Dimension; 44 53 instance.Coordinates = parser.Vertices != null ? parser.Vertices : parser.DisplayVertices; … … 73 82 + Environment.NewLine + Environment.NewLine 74 83 + GetInstanceDescription(); 84 85 var random = new MarsagliaRandom((uint)(descriptor != null ? descriptor.Name : instance.Name).GetHashCode()); 86 instance.Probabilities = Enumerable.Range(0, instance.Dimension).Select(_ => 0.1 + 0.9 * random.NextDouble()).ToArray(); 87 75 88 return instance; 76 89 } 77 90 78 protected override void LoadSolution(TSPLIBParser parser, TSPData instance) {91 protected override void LoadSolution(TSPLIBParser parser, PTSPData instance) { 79 92 parser.Parse(); 80 93 instance.BestKnownTour = parser.Tour.FirstOrDefault(); 81 94 } 82 95 83 public TSPData LoadData(string tspFile, string tourFile, double? bestQuality) {96 public PTSPData LoadData(string tspFile, string tourFile, double? bestQuality) { 84 97 var data = LoadInstance(new TSPLIBParser(tspFile)); 85 98 if (!String.IsNullOrEmpty(tourFile)) { -
branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBHomogeneousPTSPDataDescriptor.cs
r13408 r13412 21 21 22 22 namespace HeuristicLab.Problems.Instances.TSPLIB { 23 internal class TSPLIBDataDescriptor : IDataDescriptor { 24 public string Name { get; internal set; } 25 public string Description { get; internal set; } 23 internal class TSPLIBHomogeneousPTSPDataDescriptor : TSPLIBDataDescriptor { 24 public double Probability { get; internal set; } 26 25 27 internal string InstanceIdentifier { get; set; } 28 internal string SolutionIdentifier { get; set; } 29 30 internal TSPLIBDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier) { 26 internal TSPLIBHomogeneousPTSPDataDescriptor(string name, string description, string instanceIdentifier, string solutionIdentifier, double probability) 27 : base(name, description, instanceIdentifier, solutionIdentifier) { 31 28 this.Name = name; 32 29 this.Description = description; 33 30 this.InstanceIdentifier = instanceIdentifier; 34 31 this.SolutionIdentifier = solutionIdentifier; 32 this.Probability = probability; 35 33 } 36 34 } -
branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBHomogeneousPTSPInstanceProvider.cs
r13408 r13412 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Globalization; 23 25 using System.IO; 24 26 using System.Linq; 25 27 26 28 namespace HeuristicLab.Problems.Instances.TSPLIB { 27 public class TSPLIBTSPInstanceProvider : TSPLIBInstanceProvider<TSPData> { 29 public class TSPLIBHomogeneousPTSPInstanceProvider : TSPLIBInstanceProvider<PTSPData> { 30 private static readonly double[] probabilities = new[] { 0.1, 0.2, 0.4, 0.5, 0.6, 0.8, 0.9, 1.0 }; 28 31 29 32 public override string Name { 30 get { return "TSPLIB ( symmetricTSP)"; }33 get { return "TSPLIB (homogeneous symmetric PTSP)"; } 31 34 } 32 35 … … 37 40 protected override string FileExtension { get { return "tsp"; } } 38 41 39 protected override TSPData LoadInstance(TSPLIBParser parser) { 42 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { 43 var tspDescriptors = base.GetDataDescriptors().OfType<TSPLIBDataDescriptor>(); 44 foreach (var desc in tspDescriptors) { 45 foreach (var p in probabilities) { 46 yield return new TSPLIBHomogeneousPTSPDataDescriptor( 47 desc.Name + "-" + p.ToString(CultureInfo.InvariantCulture.NumberFormat), 48 desc.Description, 49 desc.InstanceIdentifier, 50 p == 1.0 ? desc.SolutionIdentifier : null, 51 p); 52 } 53 } 54 } 55 56 protected override PTSPData LoadInstance(TSPLIBParser parser, IDataDescriptor descriptor = null) { 40 57 parser.Parse(); 41 58 if (parser.FixedEdges != null) throw new InvalidDataException("TSP instance " + parser.Name + " contains fixed edges which are not supported by HeuristicLab."); 42 var instance = new TSPData();59 var instance = new PTSPData(); 43 60 instance.Dimension = parser.Dimension; 44 61 instance.Coordinates = parser.Vertices != null ? parser.Vertices : parser.DisplayVertices; … … 73 90 + Environment.NewLine + Environment.NewLine 74 91 + GetInstanceDescription(); 92 var ptspDesc = descriptor as TSPLIBHomogeneousPTSPDataDescriptor; 93 instance.Probabilities = ptspDesc != null ? Enumerable.Range(0, instance.Dimension).Select(_ => ptspDesc.Probability).ToArray() 94 : Enumerable.Range(0, instance.Dimension).Select(_ => 0.5).ToArray(); 95 75 96 return instance; 76 97 } 77 98 78 protected override void LoadSolution(TSPLIBParser parser, TSPData instance) {99 protected override void LoadSolution(TSPLIBParser parser, PTSPData instance) { 79 100 parser.Parse(); 80 101 instance.BestKnownTour = parser.Tour.FirstOrDefault(); 81 102 } 82 103 83 public TSPData LoadData(string tspFile, string tourFile, double? bestQuality) {104 public PTSPData LoadData(string tspFile, string tourFile, double? bestQuality) { 84 105 var data = LoadInstance(new TSPLIBParser(tspFile)); 85 106 if (!String.IsNullOrEmpty(tourFile)) { -
branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBInstanceProvider.cs
r12012 r13412 45 45 protected abstract string FileExtension { get; } 46 46 47 protected abstract T LoadInstance(TSPLIBParser parser );47 protected abstract T LoadInstance(TSPLIBParser parser, IDataDescriptor descriptor = null); 48 48 protected abstract void LoadSolution(TSPLIBParser parser, T instance); 49 49 … … 74 74 var stream = entry.Open(); 75 75 var parser = new TSPLIBParser(stream); 76 var instance = LoadInstance(parser );76 var instance = LoadInstance(parser, id); 77 77 78 78 if (!String.IsNullOrEmpty(descriptor.SolutionIdentifier)) { -
branches/PTSP/HeuristicLab.Problems.Instances.TSPLIB/3.3/TSPLIBTSPInstanceProvider.cs
r12012 r13412 37 37 protected override string FileExtension { get { return "tsp"; } } 38 38 39 protected override TSPData LoadInstance(TSPLIBParser parser ) {39 protected override TSPData LoadInstance(TSPLIBParser parser, IDataDescriptor descriptor = null) { 40 40 parser.Parse(); 41 41 if (parser.FixedEdges != null) throw new InvalidDataException("TSP instance " + parser.Name + " contains fixed edges which are not supported by HeuristicLab.");
Note: See TracChangeset
for help on using the changeset viewer.