- Timestamp:
- 09/14/12 18:58:15 (12 years ago)
- Location:
- branches/GP-MoveOperators
- Files:
-
- 6 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/GP-MoveOperators
- Property svn:ignore
-
old new 21 21 protoc.exe 22 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/GP-MoveOperators/HeuristicLab.Problems.TravelingSalesman/3.3/Evaluators/TSPDistanceMatrixEvaluator.cs
r7558 r8660 59 59 if (distances == null || distances.Rows == 0 || distances.Columns == 0 60 60 || distances.Rows != distances.Columns) 61 throw new InvalidOperationException("T he distance matrix is empty or not square");62 if (tour == null) throw new ArgumentNullException("tour", " No tour is given.");61 throw new InvalidOperationException("TSPDistanceMatrixEvaluator: The distance matrix is empty or not square"); 62 if (tour == null) throw new ArgumentNullException("tour", "TSPDistanceMatrixEvaluator: No tour is given."); 63 63 Permutation p = tour; 64 64 double length = 0; -
branches/GP-MoveOperators/HeuristicLab.Problems.TravelingSalesman/3.3/HeuristicLab.Problems.TravelingSalesman-3.3.csproj
r7646 r8660 108 108 <Reference Include="System.Data" /> 109 109 <Reference Include="System.Drawing" /> 110 <Reference Include="System.Windows.Forms" /> 110 111 <Reference Include="System.Xml" /> 111 112 </ItemGroup> … … 118 119 <Compile Include="Evaluators\TSPEuclideanPathEvaluator.cs" /> 119 120 <Compile Include="Evaluators\TSPGeoPathEvaluator.cs" /> 121 <Compile Include="Improvers\TSPImprovementOperator.cs" /> 120 122 <Compile Include="Interfaces\ITSPDistanceMatrixEvaluator.cs" /> 121 123 <Compile Include="MoveEvaluators\ThreeOpt\TSPTranslocationMoveEuclideanPathEvaluator.cs" /> … … 127 129 <Compile Include="MoveEvaluators\TwoOpt\TSPInversionMovePathEvaluator.cs" /> 128 130 <Compile Include="MoveEvaluators\TwoOpt\TSPInversionMoveRoundedEuclideanPathEvaluator.cs" /> 131 <Compile Include="PathRelinkers\TSPMultipleGuidesPathRelinker.cs" /> 132 <Compile Include="PathRelinkers\TSPPathRelinker.cs" /> 133 <Compile Include="PathRelinkers\TSPSimultaneousPathRelinker.cs" /> 129 134 <Compile Include="Plugin.cs" /> 135 <Compile Include="SimilarityCalculators\TSPSimilarityCalculator.cs" /> 130 136 <Compile Include="TravelingSalesmanProblem.cs" /> 131 137 <Compile Include="PathTSPTour.cs" /> … … 182 188 <Name>HeuristicLab.Operators-3.3</Name> 183 189 <Private>False</Private> 190 </ProjectReference> 191 <ProjectReference Include="..\..\HeuristicLab.Optimization.Operators\3.3\HeuristicLab.Optimization.Operators-3.3.csproj"> 192 <Project>{25087811-F74C-4128-BC86-8324271DA13E}</Project> 193 <Name>HeuristicLab.Optimization.Operators-3.3</Name> 184 194 </ProjectReference> 185 195 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> … … 240 250 --> 241 251 <PropertyGroup> 242 <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)252 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 243 253 set ProjectDir=$(ProjectDir) 244 254 set SolutionDir=$(SolutionDir) … … 247 257 call PreBuildEvent.cmd 248 258 </PreBuildEvent> 259 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 260 export ProjectDir=$(ProjectDir) 261 export SolutionDir=$(SolutionDir) 262 263 $SolutionDir/PreBuildEvent.sh 264 </PreBuildEvent> 249 265 </PropertyGroup> 250 266 </Project> -
branches/GP-MoveOperators/HeuristicLab.Problems.TravelingSalesman/3.3/Plugin.cs.frame
r7558 r8660 26 26 /// Plugin class for HeuristicLab.Problems.TravelingSalesman plugin 27 27 /// </summary> 28 [Plugin("HeuristicLab.Problems.TravelingSalesman", "3.3. 6.$WCREV$")]28 [Plugin("HeuristicLab.Problems.TravelingSalesman", "3.3.7.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.TravelingSalesman-3.3.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.Analysis", "3.3")] … … 37 37 [PluginDependency("HeuristicLab.Operators", "3.3")] 38 38 [PluginDependency("HeuristicLab.Optimization", "3.3")] 39 [PluginDependency("HeuristicLab.Optimization.Operators", "3.3")] 39 40 [PluginDependency("HeuristicLab.Parameters", "3.3")] 40 41 [PluginDependency("HeuristicLab.Persistence", "3.3")] -
branches/GP-MoveOperators/HeuristicLab.Problems.TravelingSalesman/3.3/Properties/AssemblyInfo.cs.frame
r7259 r8660 53 53 // by using the '*' as shown below: 54 54 [assembly: AssemblyVersion("3.3.0.0")] 55 [assembly: AssemblyFileVersion("3.3. 6.$WCREV$")]55 [assembly: AssemblyFileVersion("3.3.7.$WCREV$")] -
branches/GP-MoveOperators/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
r8085 r8660 24 24 using System.IO; 25 25 using System.Linq; 26 using HeuristicLab.Analysis; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; … … 84 85 get { return Operators.OfType<TSPPopulationDiversityAnalyzer>().FirstOrDefault(); } 85 86 } 87 private SingleObjectivePopulationDiversityAnalyzer SingleObjectivePopulationDiversityAnalyzer { 88 get { return Operators.OfType<SingleObjectivePopulationDiversityAnalyzer>().FirstOrDefault(); } 89 } 86 90 #endregion 87 91 … … 112 116 Parameters.Add(new OptionalValueParameter<DoubleMatrix>("Coordinates", "The x- and y-Coordinates of the cities.")); 113 117 Parameters.Add(new OptionalValueParameter<DistanceMatrix>("DistanceMatrix", "The matrix which contains the distances between the cities.")); 114 Parameters.Add(new ValueParameter<BoolValue>("UseDistanceMatrix", "True if a distance matrix should be calculated and used for evaluation, otherwise false.", new BoolValue(true)));118 Parameters.Add(new ValueParameter<BoolValue>("UseDistanceMatrix", "True if the coordinates based evaluators should calculate the distance matrix from the coordinates and use it for evaluation similar to the distance matrix evaluator, otherwise false.", new BoolValue(true))); 115 119 Parameters.Add(new OptionalValueParameter<Permutation>("BestKnownSolution", "The best known solution of this TSP instance.")); 116 120 117 121 Maximization.Value = false; 118 122 MaximizationParameter.Hidden = true; 123 UseDistanceMatrixParameter.Hidden = true; 119 124 DistanceMatrixParameter.ReactOnValueToStringChangedAndValueItemImageChanged = false; 120 125 … … 151 156 UpdateMoveEvaluators(); 152 157 ParameterizeAnalyzers(); 153 ClearDistanceMatrix(); 158 if (Evaluator is ITSPCoordinatesPathEvaluator && Coordinates != null) 159 ClearDistanceMatrix(); 154 160 } 155 161 private void CoordinatesParameter_ValueChanged(object sender, EventArgs e) { … … 158 164 Coordinates.Reset += new EventHandler(Coordinates_Reset); 159 165 } 160 ParameterizeSolutionCreator(); 161 ClearDistanceMatrix(); 166 if (Evaluator is ITSPCoordinatesPathEvaluator) { 167 ParameterizeSolutionCreator(); 168 ClearDistanceMatrix(); 169 } 162 170 } 163 171 private void Coordinates_ItemChanged(object sender, EventArgs<int, int> e) { 164 ClearDistanceMatrix(); 172 if (Evaluator is ITSPCoordinatesPathEvaluator) { 173 ClearDistanceMatrix(); 174 } 165 175 } 166 176 private void Coordinates_Reset(object sender, EventArgs e) { 167 ParameterizeSolutionCreator(); 168 ClearDistanceMatrix(); 177 if (Evaluator is ITSPCoordinatesPathEvaluator) { 178 ParameterizeSolutionCreator(); 179 ClearDistanceMatrix(); 180 } 169 181 } 170 182 private void SolutionCreator_PermutationParameter_ActualNameChanged(object sender, EventArgs e) { … … 222 234 223 235 private void InitializeOperators() { 236 Operators.Add(new TSPImprovementOperator()); 237 Operators.Add(new TSPMultipleGuidesPathRelinker()); 238 Operators.Add(new TSPPathRelinker()); 239 Operators.Add(new TSPSimultaneousPathRelinker()); 240 Operators.Add(new TSPSimilarityCalculator()); 241 224 242 Operators.Add(new BestTSPSolutionAnalyzer()); 225 243 Operators.Add(new TSPAlleleFrequencyAnalyzer()); 226 Operators.Add(new TSPPopulationDiversityAnalyzer());244 Operators.Add(new SingleObjectivePopulationDiversityAnalyzer()); 227 245 ParameterizeAnalyzers(); 228 246 var operators = new HashSet<IPermutationOperator>(new IPermutationOperator[] { … … 251 269 else if (Evaluator is ITSPCoordinatesPathEvaluator && Coordinates != null) 252 270 SolutionCreator.LengthParameter.Value = new IntValue(Coordinates.Rows); 253 else SolutionCreator.LengthParameter.Value = null; 271 else { 272 SolutionCreator.LengthParameter.Value = null; 273 string error = "The given problem does not support the selected evaluator."; 274 if (Evaluator is ITSPDistanceMatrixEvaluator) 275 error += Environment.NewLine + "Please review that the " + DistanceMatrixParameter.Name + " parameter is defined or choose another evaluator."; 276 else error += Environment.NewLine + "Please review that the " + CoordinatesParameter.Name + " parameter is defined or choose another evaluator."; 277 PluginInfrastructure.ErrorHandling.ShowErrorDialog(error, null); 278 } 254 279 SolutionCreator.LengthParameter.Hidden = SolutionCreator.LengthParameter.Value != null; 255 280 SolutionCreator.PermutationTypeParameter.Value = new PermutationType(PermutationTypes.RelativeUndirected); … … 303 328 TSPPopulationDiversityAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 304 329 TSPPopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results"; 330 } 331 332 if (SingleObjectivePopulationDiversityAnalyzer != null) { 333 SingleObjectivePopulationDiversityAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 334 SingleObjectivePopulationDiversityAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 335 SingleObjectivePopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results"; 336 SingleObjectivePopulationDiversityAnalyzer.SimilarityCalculator = Operators.OfType<TSPSimilarityCalculator>().SingleOrDefault(); 305 337 } 306 338 } … … 336 368 op.PermutationParameter.Hidden = true; 337 369 } 370 foreach (ISingleObjectiveImprovementOperator op in Operators.OfType<ISingleObjectiveImprovementOperator>()) { 371 op.SolutionParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 372 op.SolutionParameter.Hidden = true; 373 } 374 foreach (ISingleObjectivePathRelinker op in Operators.OfType<ISingleObjectivePathRelinker>()) { 375 op.ParentsParameter.ActualName = SolutionCreator.PermutationParameter.ActualName; 376 op.ParentsParameter.Hidden = true; 377 } 378 foreach (TSPSimilarityCalculator op in Operators.OfType<TSPSimilarityCalculator>()) { 379 op.SolutionVariableName = SolutionCreator.PermutationParameter.ActualName; 380 op.QualityVariableName = Evaluator.QualityParameter.ActualName; 381 } 338 382 } 339 383 340 384 private void ClearDistanceMatrix() { 341 if (!(Evaluator is ITSPDistanceMatrixEvaluator)) 342 DistanceMatrixParameter.Value = null; 385 DistanceMatrixParameter.Value = null; 343 386 } 344 387 #endregion … … 358 401 Description = data.Description; 359 402 403 bool clearCoordinates = false, clearDistanceMatrix = false; 360 404 if (data.Coordinates != null && data.Coordinates.GetLength(0) > 0) 361 405 Coordinates = new DoubleMatrix(data.Coordinates); 362 else Coordinates = null;406 else clearCoordinates = true; 363 407 364 408 TSPEvaluator evaluator; … … 375 419 DistanceMatrix = new DistanceMatrix(data.Distances); 376 420 } else { 377 DistanceMatrix = null;421 clearDistanceMatrix = true; 378 422 UseDistanceMatrix = new BoolValue(data.Dimension <= DistanceMatrixSizeLimit); 379 423 switch (data.DistanceMeasure) { … … 394 438 Evaluator = evaluator; 395 439 440 // reset them after assigning the evaluator 441 if (clearCoordinates) Coordinates = null; 442 if (clearDistanceMatrix) DistanceMatrix = null; 443 396 444 BestKnownSolution = null; 397 445 BestKnownQuality = null; … … 400 448 try { 401 449 EvaluateAndLoadTour(data.BestKnownTour); 402 } 403 catch (InvalidOperationException) { 450 } catch (InvalidOperationException) { 404 451 if (data.BestKnownQuality.HasValue) 405 452 BestKnownQuality = new DoubleValue(data.BestKnownQuality.Value);
Note: See TracChangeset
for help on using the changeset viewer.