- Timestamp:
- 03/22/10 01:41:59 (15 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.TSP/3.3
- Files:
-
- 4 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.TSP/3.3/Evaluators/TSPEvaluator.cs
r3048 r3155 33 33 [StorableClass] 34 34 public abstract class TSPEvaluator : SingleSuccessorOperator, ITSPEvaluator { 35 public override bool CanChangeName { 36 get { return false; } 37 } 38 35 39 public ILookupParameter<DoubleValue> QualityParameter { 36 40 get { return (ILookupParameter<DoubleValue>)Parameters["Quality"]; } -
trunk/sources/HeuristicLab.Problems.TSP/3.3/HeuristicLab.Problems.TSP-3.3.csproj
r3153 r3155 84 84 </ItemGroup> 85 85 <ItemGroup> 86 <Compile Include="Evaluators\TSPEuclideanPathEvaluator.cs" /> 87 <Compile Include="Evaluators\TSPGeoPathEvaluator.cs" /> 86 88 <Compile Include="TSPLIBTourParser.cs" /> 87 89 <Compile Include="Interfaces\ICoordinatesTSPSolutionsVisualizer.cs" /> … … 159 161 <None Include="ch130.tsp" /> 160 162 <None Include="fl1400.tsp" /> 163 <None Include="gr666.opt.tour" /> 164 <None Include="gr666.tsp" /> 161 165 <None Include="HeuristicLab.snk" /> 162 166 <None Include="HeuristicLabProblemsTSPPlugin.cs.frame" /> -
trunk/sources/HeuristicLab.Problems.TSP/3.3/TSP.cs
r3153 r3155 178 178 if (!string.IsNullOrEmpty(tspParser.Comment)) Description = tspParser.Comment; 179 179 Coordinates = new DoubleMatrix(tspParser.Vertices); 180 if (tspParser.WeightType == TSPLIBParser.TSPLIBEdgeWeightType.EUC_2D) { 181 TSPRoundedEuclideanPathEvaluator evaluator = new TSPRoundedEuclideanPathEvaluator(); 182 evaluator.QualityParameter.ActualName = "TSPTourLength"; 183 Evaluator = evaluator; 184 } else if (tspParser.WeightType == TSPLIBParser.TSPLIBEdgeWeightType.GEO) { 185 TSPGeoPathEvaluator evaluator = new TSPGeoPathEvaluator(); 186 evaluator.QualityParameter.ActualName = "TSPTourLength"; 187 Evaluator = evaluator; 188 } 180 189 BestKnownQuality = null; 181 190 BestKnownSolution = null; 191 182 192 if (!string.IsNullOrEmpty(optimalTourFileName)) { 183 193 TSPLIBTourParser tourParser = new TSPLIBTourParser(optimalTourFileName); -
trunk/sources/HeuristicLab.Problems.TSP/3.3/TSPLIBParser.cs
r3151 r3155 29 29 /// </summary> 30 30 public class TSPLIBParser { 31 #region Inner Enum TSPLIBEdgeWeightType 32 public enum TSPLIBEdgeWeightType { 33 UNDEFINED, 34 EUC_2D, 35 GEO 36 } 37 #endregion 38 31 39 private const int EOF = 0; 32 40 private const int NAME = 1; … … 61 69 get { return vertices; } 62 70 } 63 private intweightType;71 private TSPLIBEdgeWeightType weightType; 64 72 /// <summary> 65 73 /// Gets the weight type of the parsed TSP. 66 74 /// </summary> 67 public intWeightType {75 public TSPLIBEdgeWeightType WeightType { 68 76 get { return weightType; } 69 77 } … … 83 91 comment = string.Empty; 84 92 vertices = null; 85 weightType = -1;93 weightType = TSPLIBEdgeWeightType.UNDEFINED; 86 94 } 87 95 … … 193 201 194 202 if (type.Equals("euc_2d", StringComparison.OrdinalIgnoreCase)) 195 weightType = 0;203 weightType = TSPLIBEdgeWeightType.EUC_2D; 196 204 else if (type.Equals("geo", StringComparison.OrdinalIgnoreCase)) 197 weightType = 1;205 weightType = TSPLIBEdgeWeightType.GEO; 198 206 else 199 207 throw new InvalidDataException("Input file contains an unsupported edge weight type (only \"EUC_2D\" and \"GEO\" are supported).");
Note: See TracChangeset
for help on using the changeset viewer.