Changeset 10104 for branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching
- Timestamp:
- 11/04/13 10:18:18 (11 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RealVectorEncoding/RealVectorEqualityComparer.cs
r10026 r10104 42 42 43 43 public override int GetHashCode(RealVector obj) { 44 //compute FNV hash 45 int h = 216613626; 46 47 for (int i = 0; i < obj.Length; i++) { 48 h = (h * 16777619) ^ obj[i].GetHashCode(); 44 unchecked { 45 int hash = 17; 46 for (int i = 0; i < obj.Length; i++) { 47 hash = hash * 23 + obj[i].GetHashCode(); 48 } 49 return hash; 49 50 } 50 return h;51 51 } 52 52 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/SolutionCache.cs
r10090 r10104 28 28 29 29 namespace HeuristicLab.Analysis.SolutionCaching { 30 //TODO: should implement a collection interface 30 31 [Item("SolutionCache", "Stores solutions generated by an algorithm.")] 31 32 [StorableClass] … … 88 89 } 89 90 91 public virtual IEnumerable<TKey> Keys() { 92 return solutionDictionary.Keys; 93 } 94 95 public virtual IEnumerable<List<TValue>> Values() { 96 return solutionDictionary.Values; 97 } 98 90 99 public virtual List<TKey> GetSolutionsFromGeneration(int generation) { 91 100 return solutionDictionary.Where(x => x.Value.Count(y => y.Generation == generation) != 0).Select(x => x.Key).ToList<TKey>();
Note: See TracChangeset
for help on using the changeset viewer.