Changeset 10026 for branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching
- Timestamp:
- 10/04/13 17:24:46 (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
r10023 r10026 21 21 22 22 using System.Collections.Generic; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Encodings.RealVectorEncoding; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 35 36 public override bool Equals(RealVector x, RealVector y) { 36 37 for (int i = 0; i < x.Length; i++) { 37 if ( x[i] != y[i]) return false;38 if (!x[i].IsAlmost(y[i])) return false; 38 39 } 39 40 return true; -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/SolutionCache.cs
r10023 r10026 21 21 22 22 using System.Collections.Generic; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 32 33 public abstract class SolutionCache<TKey, TValue> : Item 33 34 where TKey : Item 34 where TValue : Item{35 where TValue : SolutionInformation<TKey> { 35 36 36 37 [Storable] … … 83 84 return solutionDictionary.Count; 84 85 } 86 87 public virtual List<TKey> GetSolutionsFromGeneration(int generation) { 88 return solutionDictionary.Where(x => x.Value.Count(y => y.Generation == generation) != 0).Select(x => x.Key).ToList<TKey>(); 89 } 85 90 } 86 91 }
Note: See TracChangeset
for help on using the changeset viewer.