Changeset 9175 for branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/CombinedIntegerVector.cs
- Timestamp:
- 01/21/13 16:33:47 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/CombinedIntegerVector.cs
r9167 r9175 142 142 IntMatrix actionBounds = new IntMatrix(actionPartLength, bounds.Columns); 143 143 int start = length - actionPartLength; 144 int rows = bounds.Rows; 144 145 for (int i = start; i < length; i++) { 145 int pos = i % bounds.Rows;146 int pos = i % rows; 146 147 for (int j = 0; j < bounds.Columns; j++) { 147 148 actionBounds[i - start, j] = bounds[pos, j]; … … 160 161 curbounds = i % bounds.Rows; 161 162 //if don't care symbol is matched, next indices can be checked 162 if (this[i] .Equals(bounds[curbounds, 1] - 1)) {163 if (this[i] == bounds[curbounds, 1] - 1) { 163 164 continue; 164 165 } 165 if ( !this[i].Equals(targetVector[i])) {166 if (this[i] != targetVector[i]) { 166 167 return false; 167 168 } … … 241 242 242 243 public bool Equals(IClassifier other) { 243 return this.MatchAction(other) && this.MatchCondition(other); 244 var cast = other as CombinedIntegerVector; 245 if (cast == null) { return false; } 246 for (int i = 0; i < array.Length; i++) { 247 if (!array[i].Equals(cast.array[i])) { 248 return false; 249 } 250 } 251 return true; 244 252 } 245 253 … … 251 259 return result.GetHashCode(); 252 260 } 253 254 public bool Identical(IClassifier classifier) {255 var cast = classifier as CombinedIntegerVector;256 if (cast != null) {257 for (int i = 0; i < array.Length; i++) {258 if (!array[i].Equals(cast.array[i])) {259 return false;260 }261 }262 }263 return true;264 }265 261 } 266 262 }
Note: See TracChangeset
for help on using the changeset viewer.