Changeset 12247 for branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Optimization.Operators/3.3/SolutionSimilarityCalculator.cs
- Timestamp:
- 03/24/15 11:17:08 (9 years ago)
- Location:
- branches/HeuristicLab.DatasetRefactor/sources
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.DatasetRefactor/sources
- Property svn:mergeinfo changed
-
branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Optimization.Operators/3.3/SolutionSimilarityCalculator.cs
r12105 r12247 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 … … 146 146 var da2 = q2 as DoubleArray; 147 147 148 if (da1 != null && da2 != null) 149 return da1.SequenceEqual(da2); 148 if (da1 != null && da2 != null) { 149 if (da1.Length != da2.Length) 150 throw new ArgumentException("The quality arrays must have the same length."); 151 152 for (int i = 0; i < da1.Length; ++i) { 153 if (!da1[i].IsAlmost(da2[i])) 154 return false; 155 } 156 157 return true; 158 } 150 159 151 160 throw new ArgumentException("Could not determine quality equality.");
Note: See TracChangeset
for help on using the changeset viewer.