Changeset 8720
- Timestamp:
- 10/02/12 18:59:15 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Analysis/3.3/PopulationDiversityAnalysis/PopulationDiversityAnalyzer.cs
r7259 r8720 31 31 32 32 namespace HeuristicLab.Analysis { 33 // use HeuristicLab.Analysis.SingleObjectivePopulationDiversityAnalyzer instead 34 // BackwardsCompatibility3.3 35 #region Backwards compatible code, remove with 3.4 33 36 /// <summary> 34 37 /// An operator for analyzing the solution diversity in a population. 35 38 /// </summary> 39 [Obsolete] 36 40 [Item("PopulationDiversityAnalyzer", "An operator for analyzing the solution diversity in a population.")] 37 41 [StorableClass] … … 245 249 protected abstract double[,] CalculateSimilarities(T[] solutions); 246 250 } 251 #endregion 247 252 } -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/HeuristicLab.Problems.Knapsack-3.3.csproj
r8600 r8720 129 129 </ItemGroup> 130 130 <ItemGroup> 131 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj"> 132 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 133 <Name>HeuristicLab.Analysis-3.3</Name> 134 </ProjectReference> 131 135 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 132 136 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> … … 216 220 --> 217 221 <PropertyGroup> 218 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)222 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 219 223 set ProjectDir=$(ProjectDir) 220 224 set SolutionDir=$(SolutionDir) … … 223 227 call PreBuildEvent.cmd 224 228 </PreBuildEvent> 225 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">229 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 226 230 export ProjectDir=$(ProjectDir) 227 231 export SolutionDir=$(SolutionDir) -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs
r8334 r8720 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Analysis; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; … … 80 81 private BestKnapsackSolutionAnalyzer BestKnapsackSolutionAnalyzer { 81 82 get { return Operators.OfType<BestKnapsackSolutionAnalyzer>().FirstOrDefault(); } 83 } 84 private SingleObjectivePopulationDiversityAnalyzer SingleObjectivePopulationDiversityAnalyzer { 85 get { return Operators.OfType<SingleObjectivePopulationDiversityAnalyzer>().FirstOrDefault(); } 82 86 } 83 87 #endregion … … 228 232 } 229 233 private void ParameterizeAnalyzer() { 230 BestKnapsackSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 231 BestKnapsackSolutionAnalyzer.MaximizationParameter.Hidden = true; 232 BestKnapsackSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name; 233 BestKnapsackSolutionAnalyzer.BestKnownQualityParameter.Hidden = true; 234 BestKnapsackSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name; 235 BestKnapsackSolutionAnalyzer.BestKnownSolutionParameter.Hidden = true; 236 BestKnapsackSolutionAnalyzer.BinaryVectorParameter.ActualName = SolutionCreator.BinaryVectorParameter.ActualName; 237 BestKnapsackSolutionAnalyzer.BinaryVectorParameter.Hidden = true; 238 BestKnapsackSolutionAnalyzer.KnapsackCapacityParameter.ActualName = KnapsackCapacityParameter.Name; 239 BestKnapsackSolutionAnalyzer.KnapsackCapacityParameter.Hidden = true; 240 BestKnapsackSolutionAnalyzer.WeightsParameter.ActualName = WeightsParameter.Name; 241 BestKnapsackSolutionAnalyzer.WeightsParameter.Hidden = true; 242 BestKnapsackSolutionAnalyzer.ValuesParameter.ActualName = ValuesParameter.Name; 243 BestKnapsackSolutionAnalyzer.ValuesParameter.Hidden = true; 234 if (BestKnapsackSolutionAnalyzer != null) { 235 BestKnapsackSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 236 BestKnapsackSolutionAnalyzer.MaximizationParameter.Hidden = true; 237 BestKnapsackSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name; 238 BestKnapsackSolutionAnalyzer.BestKnownQualityParameter.Hidden = true; 239 BestKnapsackSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name; 240 BestKnapsackSolutionAnalyzer.BestKnownSolutionParameter.Hidden = true; 241 BestKnapsackSolutionAnalyzer.BinaryVectorParameter.ActualName = SolutionCreator.BinaryVectorParameter.ActualName; 242 BestKnapsackSolutionAnalyzer.BinaryVectorParameter.Hidden = true; 243 BestKnapsackSolutionAnalyzer.KnapsackCapacityParameter.ActualName = KnapsackCapacityParameter.Name; 244 BestKnapsackSolutionAnalyzer.KnapsackCapacityParameter.Hidden = true; 245 BestKnapsackSolutionAnalyzer.WeightsParameter.ActualName = WeightsParameter.Name; 246 BestKnapsackSolutionAnalyzer.WeightsParameter.Hidden = true; 247 BestKnapsackSolutionAnalyzer.ValuesParameter.ActualName = ValuesParameter.Name; 248 BestKnapsackSolutionAnalyzer.ValuesParameter.Hidden = true; 249 } 250 251 if (SingleObjectivePopulationDiversityAnalyzer != null) { 252 SingleObjectivePopulationDiversityAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 253 SingleObjectivePopulationDiversityAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 254 SingleObjectivePopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results"; 255 SingleObjectivePopulationDiversityAnalyzer.SimilarityCalculator = Operators.OfType<KnapsackSimilarityCalculator>().SingleOrDefault(); 256 } 244 257 } 245 258 private void InitializeOperators() { … … 250 263 251 264 Operators.Add(new BestKnapsackSolutionAnalyzer()); 265 Operators.Add(new SingleObjectivePopulationDiversityAnalyzer()); 252 266 ParameterizeAnalyzer(); 253 267 foreach (IBinaryVectorOperator op in ApplicationManager.Manager.GetInstances<IBinaryVectorOperator>()) { -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/Plugin.cs.frame
r8334 r8720 28 28 [Plugin("HeuristicLab.Problems.Knapsack", "3.3.7.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.Knapsack-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Analysis", "3.3")] 30 31 [PluginDependency("HeuristicLab.Collections", "3.3")] 31 32 [PluginDependency("HeuristicLab.Common", "3.3")] -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/HeuristicLab.Problems.TestFunctions-3.3.csproj
r8600 r8720 162 162 </ItemGroup> 163 163 <ItemGroup> 164 <ProjectReference Include="..\..\HeuristicLab.Analysis\3.3\HeuristicLab.Analysis-3.3.csproj"> 165 <Project>{887425B4-4348-49ED-A457-B7D2C26DDBF9}</Project> 166 <Name>HeuristicLab.Analysis-3.3</Name> 167 </ProjectReference> 164 168 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 165 169 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> … … 249 253 --> 250 254 <PropertyGroup> 251 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)255 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 252 256 set ProjectDir=$(ProjectDir) 253 257 set SolutionDir=$(SolutionDir) … … 256 260 call PreBuildEvent.cmd 257 261 </PreBuildEvent> 258 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">262 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 259 263 export ProjectDir=$(ProjectDir) 260 264 export SolutionDir=$(SolutionDir) -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/Plugin.cs.frame
r8334 r8720 28 28 [Plugin("HeuristicLab.Problems.TestFunctions", "3.3.7.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Problems.TestFunctions-3.3.dll", PluginFileType.Assembly)] 30 [PluginDependency("HeuristicLab.Analysis", "3.3")] 30 31 [PluginDependency("HeuristicLab.Collections", "3.3")] 31 32 [PluginDependency("HeuristicLab.Common", "3.3")] -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs
r8493 r8720 23 23 using System.Collections.Generic; 24 24 using System.Linq; 25 using HeuristicLab.Analysis; 25 26 using HeuristicLab.Common; 26 27 using HeuristicLab.Core; … … 69 70 private BestSingleObjectiveTestFunctionSolutionAnalyzer BestSingleObjectiveTestFunctionSolutionAnalyzer { 70 71 get { return Operators.OfType<BestSingleObjectiveTestFunctionSolutionAnalyzer>().FirstOrDefault(); } 72 } 73 private SingleObjectivePopulationDiversityAnalyzer SingleObjectivePopulationDiversityAnalyzer { 74 get { return Operators.OfType<SingleObjectivePopulationDiversityAnalyzer>().FirstOrDefault(); } 71 75 } 72 76 #endregion … … 249 253 } 250 254 private void ParameterizeAnalyzers() { 251 BestSingleObjectiveTestFunctionSolutionAnalyzer.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName; 252 BestSingleObjectiveTestFunctionSolutionAnalyzer.ResultsParameter.ActualName = "Results"; 253 BestSingleObjectiveTestFunctionSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 254 BestSingleObjectiveTestFunctionSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name; 255 BestSingleObjectiveTestFunctionSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name; 256 BestSingleObjectiveTestFunctionSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 257 BestSingleObjectiveTestFunctionSolutionAnalyzer.EvaluatorParameter.ActualName = EvaluatorParameter.Name; 258 BestSingleObjectiveTestFunctionSolutionAnalyzer.BoundsParameter.ActualName = BoundsParameter.Name; 255 if (BestSingleObjectiveTestFunctionSolutionAnalyzer != null) { 256 BestSingleObjectiveTestFunctionSolutionAnalyzer.RealVectorParameter.ActualName = SolutionCreator.RealVectorParameter.ActualName; 257 BestSingleObjectiveTestFunctionSolutionAnalyzer.ResultsParameter.ActualName = "Results"; 258 BestSingleObjectiveTestFunctionSolutionAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 259 BestSingleObjectiveTestFunctionSolutionAnalyzer.BestKnownQualityParameter.ActualName = BestKnownQualityParameter.Name; 260 BestSingleObjectiveTestFunctionSolutionAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name; 261 BestSingleObjectiveTestFunctionSolutionAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 262 BestSingleObjectiveTestFunctionSolutionAnalyzer.EvaluatorParameter.ActualName = EvaluatorParameter.Name; 263 BestSingleObjectiveTestFunctionSolutionAnalyzer.BoundsParameter.ActualName = BoundsParameter.Name; 264 } 265 266 if (SingleObjectivePopulationDiversityAnalyzer != null) { 267 SingleObjectivePopulationDiversityAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 268 SingleObjectivePopulationDiversityAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName; 269 SingleObjectivePopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results"; 270 SingleObjectivePopulationDiversityAnalyzer.SimilarityCalculator = Operators.OfType<SingleObjectiveTestFunctionSimilarityCalculator>().SingleOrDefault(); 271 } 259 272 } 260 273 private void InitializeOperators() { … … 264 277 265 278 Operators.Add(new BestSingleObjectiveTestFunctionSolutionAnalyzer()); 279 Operators.Add(new SingleObjectivePopulationDiversityAnalyzer()); 266 280 ParameterizeAnalyzers(); 267 281 Operators.AddRange(ApplicationManager.Manager.GetInstances<IRealVectorOperator>().Cast<IOperator>()); … … 316 330 try { 317 331 BestKnownSolutionParameter.Value = Evaluator.GetBestKnownSolution(ProblemSize.Value); 318 } catch (ArgumentException e) { 332 } 333 catch (ArgumentException e) { 319 334 ErrorHandling.ShowErrorDialog(e); 320 335 ProblemSize.Value = Evaluator.MinimumProblemSize; -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/Analyzers/TSPPopulationDiversityAnalyzer.cs
r7259 r8720 20 20 #endregion 21 21 22 using System; 22 23 using HeuristicLab.Analysis; 23 24 using HeuristicLab.Common; … … 25 26 using HeuristicLab.Encodings.PermutationEncoding; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 using HeuristicLab.PluginInfrastructure; 27 29 28 30 namespace HeuristicLab.Problems.TravelingSalesman { 31 // BackwardsCompatibility3.3 32 #region Backwards compatible code, remove with 3.4 29 33 /// <summary> 30 34 /// An operator for analyzing the diversity of solutions of Traveling Salesman Problems given in path representation. 31 35 /// </summary> 36 [Obsolete] 37 [NonDiscoverableType] 32 38 [Item("TSPPopulationDiversityAnalyzer", "An operator for analyzing the diversity of solutions of Traveling Salesman Problems given in path representation.")] 33 39 [StorableClass] … … 79 85 } 80 86 } 87 #endregion 81 88 } -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
r8478 r8720 82 82 get { return Operators.OfType<TSPAlleleFrequencyAnalyzer>().FirstOrDefault(); } 83 83 } 84 private TSPPopulationDiversityAnalyzer TSPPopulationDiversityAnalyzer {85 get { return Operators.OfType<TSPPopulationDiversityAnalyzer>().FirstOrDefault(); }86 }87 84 private SingleObjectivePopulationDiversityAnalyzer SingleObjectivePopulationDiversityAnalyzer { 88 85 get { return Operators.OfType<SingleObjectivePopulationDiversityAnalyzer>().FirstOrDefault(); } … … 321 318 TSPAlleleFrequencyAnalyzer.BestKnownSolutionParameter.ActualName = BestKnownSolutionParameter.Name; 322 319 TSPAlleleFrequencyAnalyzer.ResultsParameter.ActualName = "Results"; 323 }324 325 if (TSPPopulationDiversityAnalyzer != null) {326 TSPPopulationDiversityAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name;327 TSPPopulationDiversityAnalyzer.SolutionParameter.ActualName = SolutionCreator.PermutationParameter.ActualName;328 TSPPopulationDiversityAnalyzer.QualityParameter.ActualName = Evaluator.QualityParameter.ActualName;329 TSPPopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results";330 320 } 331 321 … … 448 438 try { 449 439 EvaluateAndLoadTour(data.BestKnownTour); 450 } catch (InvalidOperationException) { 440 } 441 catch (InvalidOperationException) { 451 442 if (data.BestKnownQuality.HasValue) 452 443 BestKnownQuality = new DoubleValue(data.BestKnownQuality.Value); -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/SimilarityCalculators/VRPSimilarityCalculator.cs
r8346 r8720 92 92 93 93 public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) { 94 var sol1 = leftSolution.Variables[SolutionVariableName].Value as PotvinEncoding;95 var sol2 = rightSolution.Variables[SolutionVariableName].Value as PotvinEncoding;94 var sol1 = leftSolution.Variables[SolutionVariableName].Value as IVRPEncoding; 95 var sol2 = rightSolution.Variables[SolutionVariableName].Value as IVRPEncoding; 96 96 97 return CalculateSimilarity(sol1, sol2); 97 var potvinSol1 = sol1 is PotvinEncoding ? sol1 as PotvinEncoding : PotvinEncoding.ConvertFrom(sol1, ProblemInstance); 98 var potvinSol2 = sol2 is PotvinEncoding ? sol2 as PotvinEncoding : PotvinEncoding.ConvertFrom(sol2, ProblemInstance); 99 100 return CalculateSimilarity(potvinSol1, potvinSol2); 98 101 } 99 102 } -
trunk/sources/HeuristicLab.Problems.VehicleRouting/3.4/VehicleRoutingProblem.cs
r8346 r8720 24 24 using System.Drawing; 25 25 using System.Linq; 26 using HeuristicLab.Analysis; 26 27 using HeuristicLab.Common; 27 28 using HeuristicLab.Core; … … 112 113 set { SolutionCreatorParameter.Value = value; } 113 114 } 115 private SingleObjectivePopulationDiversityAnalyzer SingleObjectivePopulationDiversityAnalyzer { 116 get { return Operators.OfType<SingleObjectivePopulationDiversityAnalyzer>().FirstOrDefault(); } 117 } 114 118 #endregion 115 119 … … 244 248 ApplicationManager.Manager.GetInstances<IGeneralVRPOperator>().Cast<IOperator>()).OrderBy(op => op.Name)); 245 249 Operators.Add(new VRPSimilarityCalculator()); 250 Operators.Add(new SingleObjectivePopulationDiversityAnalyzer()); 246 251 247 252 IVRPCreator defaultCreator = null; … … 277 282 op.QualityVariableName = ProblemInstance.SolutionEvaluator.QualityParameter.ActualName; 278 283 op.ProblemInstance = ProblemInstance; 284 } 285 if (SingleObjectivePopulationDiversityAnalyzer != null) { 286 SingleObjectivePopulationDiversityAnalyzer.MaximizationParameter.ActualName = MaximizationParameter.Name; 287 SingleObjectivePopulationDiversityAnalyzer.QualityParameter.ActualName = ProblemInstance.SolutionEvaluator.QualityParameter.ActualName; 288 SingleObjectivePopulationDiversityAnalyzer.ResultsParameter.ActualName = "Results"; 289 SingleObjectivePopulationDiversityAnalyzer.SimilarityCalculator = Operators.OfType<VRPSimilarityCalculator>().SingleOrDefault(); 279 290 } 280 291 }
Note: See TracChangeset
for help on using the changeset viewer.