Changeset 12126
- Timestamp:
- 03/04/15 15:22:21 (10 years ago)
- Location:
- trunk/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Operators/3.3/SolutionSimilarityCalculator.cs
r12085 r12126 111 111 if (x == null || y == null) return false; 112 112 113 var q1 = x.Variables[QualityVariableName] ;114 var q2 = x.Variables[QualityVariableName];113 var q1 = x.Variables[QualityVariableName].Value; 114 var q2 = y.Variables[QualityVariableName].Value; 115 115 116 116 return CheckQualityEquality(q1, q2) && CalculateSolutionSimilarity(x, y).IsAlmost(1.0); … … 133 133 } 134 134 } 135 return 0; // throw exception?135 return 0; 136 136 } 137 137 … … 147 147 148 148 if (da1 != null && da2 != null) 149 return da1.SequenceEqual(da2);149 return !da1.Zip(da2, Tuple.Create).Any(x => !x.Item1.IsAlmost(x.Item2)); 150 150 151 151 throw new ArgumentException("Could not determine quality equality."); -
trunk/sources/HeuristicLab.Problems.Knapsack/3.3/KnapsackProblem.cs
r12102 r12126 252 252 Operators.Add(new KnapsackSimultaneousPathRelinker()); 253 253 Operators.Add(new KnapsackSimilarityCalculator()); 254 Operators.Add(new QualitySimilarityCalculator { QualityVariableName = SolutionCreator.BinaryVectorParameter.ActualName });254 Operators.Add(new QualitySimilarityCalculator()); 255 255 Operators.Add(new NoSimilarityCalculator()); 256 256 … … 310 310 op.ParentsParameter.Hidden = true; 311 311 } 312 foreach ( KnapsackSimilarityCalculator op in Operators.OfType<KnapsackSimilarityCalculator>()) {312 foreach (ISolutionSimilarityCalculator op in Operators.OfType<ISolutionSimilarityCalculator>()) { 313 313 op.SolutionVariableName = SolutionCreator.BinaryVectorParameter.ActualName; 314 314 op.QualityVariableName = Evaluator.QualityParameter.ActualName; -
trunk/sources/HeuristicLab.Problems.TestFunctions/3.3/SingleObjectiveTestFunctionProblem.cs
r12102 r12126 261 261 Operators.Add(new SingleObjectiveTestFunctionPathRelinker()); 262 262 Operators.Add(new SingleObjectiveTestFunctionSimilarityCalculator()); 263 Operators.Add(new QualitySimilarityCalculator { QualityVariableName = SolutionCreator.RealVectorParameter.ActualName });263 Operators.Add(new QualitySimilarityCalculator()); 264 264 Operators.Add(new NoSimilarityCalculator()); 265 265 … … 385 385 op.ParentsParameter.Hidden = true; 386 386 } 387 foreach (var op in Operators.OfType< SingleObjectiveTestFunctionSimilarityCalculator>()) {387 foreach (var op in Operators.OfType<ISolutionSimilarityCalculator>()) { 388 388 op.SolutionVariableName = SolutionCreator.RealVectorParameter.ActualName; 389 389 op.QualityVariableName = Evaluator.QualityParameter.ActualName; 390 op.Bounds = Bounds; 390 var calc = op as SingleObjectiveTestFunctionSimilarityCalculator; 391 if (calc != null) calc.Bounds = Bounds; 391 392 } 392 393 } -
trunk/sources/HeuristicLab.Problems.TravelingSalesman/3.3/TravelingSalesmanProblem.cs
r12102 r12126 234 234 Operators.Add(new TSPSimultaneousPathRelinker()); 235 235 Operators.Add(new TSPSimilarityCalculator()); 236 Operators.Add(new QualitySimilarityCalculator { QualityVariableName = SolutionCreator.PermutationParameter.ActualName });236 Operators.Add(new QualitySimilarityCalculator()); 237 237 Operators.Add(new NoSimilarityCalculator()); 238 238 … … 359 359 op.ParentsParameter.Hidden = true; 360 360 } 361 foreach ( TSPSimilarityCalculator op in Operators.OfType<TSPSimilarityCalculator>()) {361 foreach (ISolutionSimilarityCalculator op in Operators.OfType<ISolutionSimilarityCalculator>()) { 362 362 op.SolutionVariableName = SolutionCreator.PermutationParameter.ActualName; 363 363 op.QualityVariableName = Evaluator.QualityParameter.ActualName;
Note: See TracChangeset
for help on using the changeset viewer.