Changeset 10105
- Timestamp:
- 11/05/13 10:27:17 (11 years ago)
- Location:
- branches/HeuristicLab.Analysis.AlgorithmBehavior
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/PermutationCacheTest.cs
r10104 r10105 42 42 //should be added 43 43 PermutationSolutionInformation pi = new PermutationSolutionInformation(); 44 pi. Generation = 9;44 pi.Iteration = 9; 45 45 pi.ProducedBy = ProducedBy.Mutation; 46 46 dict.Add(p, pi); … … 48 48 //should be added 49 49 pi = new PermutationSolutionInformation(); 50 pi. Generation = 10;50 pi.Iteration = 10; 51 51 pi.ProducedBy = ProducedBy.Mutation; 52 52 dict.Add(p, pi); … … 54 54 //should be added 55 55 pi = new PermutationSolutionInformation(); 56 pi. Generation = 10;56 pi.Iteration = 10; 57 57 pi.ProducedBy = ProducedBy.Crossover; 58 58 dict.Add(p, pi); … … 60 60 //should not be added 61 61 pi = new PermutationSolutionInformation(); 62 pi. Generation = 10;62 pi.Iteration = 10; 63 63 pi.ProducedBy = ProducedBy.Mutation; 64 64 dict.Add(p, pi); -
branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/RealVectorSolutionCacheTest.cs
r10104 r10105 54 54 info = new RealVectorSolutionInformation(); 55 55 info.ProducedBy = ProducedBy.Move; 56 info. Generation = 20;56 info.Iteration = 20; 57 57 solutionCache.Add(vector, info); 58 58 -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/PermutationEncoding/PermutationSolutionCacheCollector.cs
r10091 r10105 90 90 foreach (var sol in solutions) { 91 91 PermutationSolutionInformation info = new PermutationSolutionInformation(); 92 info. Generation = GenerationsParameter.ActualValue.Value;92 info.Iteration = GenerationsParameter.ActualValue.Value; 93 93 info.ProducedBy = ProducedBy.CrossoverAndMutation; 94 94 -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/PermutationEncoding/PermutationSolutionInformation.cs
r10096 r10105 47 47 48 48 h = (h << 4) ^ (h >> 28) ^ ProducedBy.GetHashCode(); 49 h = (h << 4) ^ (h >> 28) ^ Generation.GetHashCode();49 h = (h << 4) ^ (h >> 28) ^ Iteration.GetHashCode(); 50 50 51 if (P arentList!= null) {52 foreach (var parent in P arentList) {51 if (Predecessors != null) { 52 foreach (var parent in Predecessors) { 53 53 h = (h << 4) ^ (h >> 28) ^ pweq.GetHashCode(parent); 54 54 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RealVectorEncoding/RealVectorSolutionCacheCollector.cs
r10091 r10105 90 90 foreach (var sol in solutions) { 91 91 RealVectorSolutionInformation info = new RealVectorSolutionInformation(); 92 info. Generation = GenerationsParameter.ActualValue.Value;92 info.Iteration = GenerationsParameter.ActualValue.Value; 93 93 info.ProducedBy = ProducedBy.CrossoverAndMutation; 94 94 -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RealVectorEncoding/RealVectorSolutionInformation.cs
r10096 r10105 46 46 47 47 h = (h << 4) ^ (h >> 28) ^ ProducedBy.GetHashCode(); 48 h = (h << 4) ^ (h >> 28) ^ Generation.GetHashCode();48 h = (h << 4) ^ (h >> 28) ^ Iteration.GetHashCode(); 49 49 50 if (P arentList!= null) {51 foreach (var parent in P arentList) {50 if (Predecessors != null) { 51 foreach (var parent in Predecessors) { 52 52 h = (h << 4) ^ (h >> 28) ^ pweq.GetHashCode(parent); 53 53 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/SolutionCache.cs
r10104 r10105 98 98 99 99 public virtual List<TKey> GetSolutionsFromGeneration(int generation) { 100 return solutionDictionary.Where(x => x.Value.Count(y => y. Generation == generation) != 0).Select(x => x.Key).ToList<TKey>();100 return solutionDictionary.Where(x => x.Value.Count(y => y.Iteration == generation) != 0).Select(x => x.Key).ToList<TKey>(); 101 101 } 102 102 } -
branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/SolutionInformation.cs
r10096 r10105 27 27 28 28 namespace HeuristicLab.Analysis.SolutionCaching { 29 public enum ProducedBy { Crossover, Mutation, CrossoverAndMutation, Move, Other};29 public enum ProducedBy { Other = 0, Crossover = 1, Mutation = 2, CrossoverAndMutation = 3, Move = 4 }; 30 30 31 31 [Item("SolutionInformation", "Stores meta-information about a solution.")] … … 35 35 public ProducedBy ProducedBy { get; set; } 36 36 [Storable] 37 public List<T> P arentList{ get; set; }37 public List<T> Predecessors { get; set; } 38 38 [Storable] 39 public int Generation { get; set; }39 public int Iteration { get; set; } 40 40 [Storable] 41 41 public ResultCollection InfoStore { get; set; } 42 42 43 43 public SolutionInformation() { 44 P arentList= new List<T>();44 Predecessors = new List<T>(); 45 45 InfoStore = new ResultCollection(); 46 46 } … … 51 51 : base(original, cloner) { 52 52 this.ProducedBy = original.ProducedBy; 53 this.P arentList = new List<T>(original.ParentList);54 this. Generation = original.Generation;53 this.Predecessors = new List<T>(original.Predecessors); 54 this.Iteration = original.Iteration; 55 55 this.InfoStore = (ResultCollection)original.InfoStore.Clone(cloner); 56 56 } … … 64 64 if (pi == null) return false; 65 65 66 if (ProducedBy == pi.ProducedBy && Generation == pi.Generation) {67 if (pi.P arentList == null && ParentList== null) return true;68 if (pi.P arentList != null && ParentList== null ||69 pi.P arentList == null && ParentList!= null) return false;70 if (pi.P arentList.Count != ParentList.Count) return false;66 if (ProducedBy == pi.ProducedBy && Iteration == pi.Iteration) { 67 if (pi.Predecessors == null && Predecessors == null) return true; 68 if (pi.Predecessors != null && Predecessors == null || 69 pi.Predecessors == null && Predecessors != null) return false; 70 if (pi.Predecessors.Count != Predecessors.Count) return false; 71 71 72 foreach (var p in P arentList) {73 if (!pi.P arentList.Contains(p)) return false;72 foreach (var p in Predecessors) { 73 if (!pi.Predecessors.Contains(p)) return false; 74 74 } 75 75 foreach (IResult info in InfoStore) {
Note: See TracChangeset
for help on using the changeset viewer.