Changeset 9226 for branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3
- Timestamp:
- 02/18/13 16:51:42 (12 years ago)
- Location:
- branches/LearningClassifierSystems
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/LearningClassifierSystems
- Property svn:ignore
-
old new 1 1 *.suo 2 bin
-
- Property svn:ignore
-
branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/CombinedIntegerVector.cs
r9194 r9226 21 21 22 22 using System; 23 using System.Collections.Generic;24 23 using System.Linq; 25 24 using System.Text; … … 264 263 return true; 265 264 } 266 267 public override bool Equals(object obj) {268 return base.Equals(obj);269 }270 271 public override int GetHashCode() {272 return base.GetHashCode();273 }274 275 [StorableClass]276 [Item("CombinedIntegerVectorComparer", "")]277 public class CombinedIntegerVectorComparer : Item, IEqualityComparer<CombinedIntegerVector>, IClassifierComparer {278 279 [StorableConstructor]280 protected CombinedIntegerVectorComparer(bool deserializing) : base(deserializing) { }281 protected CombinedIntegerVectorComparer(CombinedIntegerVectorComparer original, Cloner cloner)282 : base(original, cloner) {283 }284 public override IDeepCloneable Clone(Cloner cloner) {285 return new CombinedIntegerVectorComparer(this, cloner);286 }287 public CombinedIntegerVectorComparer() : base() { }288 289 public bool Equals(CombinedIntegerVector x, CombinedIntegerVector y) {290 for (int i = 0; i < x.array.Length; i++) {291 if (!x.array[i].Equals(y.array[i])) {292 return false;293 }294 }295 return true;296 }297 298 public int GetHashCode(CombinedIntegerVector obj) {299 int result = obj.actionLength;300 for (int i = 0; i < obj.array.Length; i++) {301 result ^= obj.array[i];302 }303 return result.GetHashCode();304 }305 306 public bool Equals(IAction x, IAction y) {307 var xCast = x as CombinedIntegerVector;308 var yCast = y as CombinedIntegerVector;309 return x != null && y != null && Equals(xCast, yCast);310 }311 312 public int GetHashCode(IAction obj) {313 var objCast = obj as CombinedIntegerVector;314 return objCast != null ? GetHashCode(objCast) : obj.GetHashCode();315 }316 }317 265 } 318 266 } -
branches/LearningClassifierSystems/HeuristicLab.Encodings.CombinedIntegerVectorEncoding/3.3/HeuristicLab.Encodings.CombinedIntegerVectorEncoding-3.3.csproj
r9194 r9226 121 121 <ItemGroup> 122 122 <Compile Include="CombinedIntegerVector.cs" /> 123 <Compile Include="CombinedIntegerVectorComparer.cs" /> 123 124 <Compile Include="CombinedIntegerVectorCreator.cs" /> 124 125 <Compile Include="CombinedIntegerVectorCrossover.cs" />
Note: See TracChangeset
for help on using the changeset viewer.