Changeset 8988
- Timestamp:
- 12/03/12 13:32:42 (12 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Operators/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Operators/3.3/SingleObjectiveSolutionSimilarityCalculator.cs
r8334 r8988 48 48 protected SingleObjectiveSolutionSimilarityCalculator() : base() { } 49 49 50 public override bool Equals(IScope x, IScope y) { 51 if (object.ReferenceEquals(x, y)) return true; 52 if (x == null || y == null) return false; 53 double q1 = ((DoubleValue)x.Variables[QualityVariableName].Value).Value; 54 double q2 = ((DoubleValue)y.Variables[QualityVariableName].Value).Value; 55 return q1.IsAlmost(q2) && CalculateSolutionSimilarity(x, y).IsAlmost(1.0); 56 } 57 50 58 public override int GetHashCode(IScope scope) { 51 59 return ((DoubleValue)scope.Variables[QualityVariableName].Value).Value.GetHashCode(); -
trunk/sources/HeuristicLab.Optimization.Operators/3.3/SolutionSimilarityCalculator.cs
r8413 r8988 80 80 } 81 81 82 public bool Equals(IScope x, IScope y) {83 if (object.ReferenceEquals(x, y)) return true;84 if (x == null || y == null) return false;85 return CalculateSolutionSimilarity(x, y) == 1.0;86 }87 88 82 public abstract double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution); 83 public abstract bool Equals(IScope x, IScope y); 89 84 public abstract int GetHashCode(IScope obj); 90 85 }
Note: See TracChangeset
for help on using the changeset viewer.