Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10105


Ignore:
Timestamp:
11/05/13 10:27:17 (11 years ago)
Author:
ascheibe
Message:

#1886 renamed some properties in SolutionInformation as suggested by swagner

Location:
branches/HeuristicLab.Analysis.AlgorithmBehavior
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/PermutationCacheTest.cs

    r10104 r10105  
    4242        //should be added
    4343        PermutationSolutionInformation pi = new PermutationSolutionInformation();
    44         pi.Generation = 9;
     44        pi.Iteration = 9;
    4545        pi.ProducedBy = ProducedBy.Mutation;
    4646        dict.Add(p, pi);
     
    4848        //should be added
    4949        pi = new PermutationSolutionInformation();
    50         pi.Generation = 10;
     50        pi.Iteration = 10;
    5151        pi.ProducedBy = ProducedBy.Mutation;
    5252        dict.Add(p, pi);
     
    5454        //should be added
    5555        pi = new PermutationSolutionInformation();
    56         pi.Generation = 10;
     56        pi.Iteration = 10;
    5757        pi.ProducedBy = ProducedBy.Crossover;
    5858        dict.Add(p, pi);
     
    6060        //should not be added
    6161        pi = new PermutationSolutionInformation();
    62         pi.Generation = 10;
     62        pi.Iteration = 10;
    6363        pi.ProducedBy = ProducedBy.Mutation;
    6464        dict.Add(p, pi);
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/AlgorithmBehaviorUnitTests/RealVectorSolutionCacheTest.cs

    r10104 r10105  
    5454        info = new RealVectorSolutionInformation();
    5555        info.ProducedBy = ProducedBy.Move;
    56         info.Generation = 20;
     56        info.Iteration = 20;
    5757        solutionCache.Add(vector, info);
    5858
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/PermutationEncoding/PermutationSolutionCacheCollector.cs

    r10091 r10105  
    9090      foreach (var sol in solutions) {
    9191        PermutationSolutionInformation info = new PermutationSolutionInformation();
    92         info.Generation = GenerationsParameter.ActualValue.Value;
     92        info.Iteration = GenerationsParameter.ActualValue.Value;
    9393        info.ProducedBy = ProducedBy.CrossoverAndMutation;
    9494
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/PermutationEncoding/PermutationSolutionInformation.cs

    r10096 r10105  
    4747
    4848      h = (h << 4) ^ (h >> 28) ^ ProducedBy.GetHashCode();
    49       h = (h << 4) ^ (h >> 28) ^ Generation.GetHashCode();
     49      h = (h << 4) ^ (h >> 28) ^ Iteration.GetHashCode();
    5050
    51       if (ParentList != null) {
    52         foreach (var parent in ParentList) {
     51      if (Predecessors != null) {
     52        foreach (var parent in Predecessors) {
    5353          h = (h << 4) ^ (h >> 28) ^ pweq.GetHashCode(parent);
    5454        }
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RealVectorEncoding/RealVectorSolutionCacheCollector.cs

    r10091 r10105  
    9090      foreach (var sol in solutions) {
    9191        RealVectorSolutionInformation info = new RealVectorSolutionInformation();
    92         info.Generation = GenerationsParameter.ActualValue.Value;
     92        info.Iteration = GenerationsParameter.ActualValue.Value;
    9393        info.ProducedBy = ProducedBy.CrossoverAndMutation;
    9494
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/RealVectorEncoding/RealVectorSolutionInformation.cs

    r10096 r10105  
    4646
    4747      h = (h << 4) ^ (h >> 28) ^ ProducedBy.GetHashCode();
    48       h = (h << 4) ^ (h >> 28) ^ Generation.GetHashCode();
     48      h = (h << 4) ^ (h >> 28) ^ Iteration.GetHashCode();
    4949
    50       if (ParentList != null) {
    51         foreach (var parent in ParentList) {
     50      if (Predecessors != null) {
     51        foreach (var parent in Predecessors) {
    5252          h = (h << 4) ^ (h >> 28) ^ pweq.GetHashCode(parent);
    5353        }
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/SolutionCache.cs

    r10104 r10105  
    9898
    9999    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>();
    101101    }
    102102  }
  • branches/HeuristicLab.Analysis.AlgorithmBehavior/HeuristicLab.Analysis.SolutionCaching/3.3/SolutionInformation.cs

    r10096 r10105  
    2727
    2828namespace 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 };
    3030
    3131  [Item("SolutionInformation", "Stores meta-information about a solution.")]
     
    3535    public ProducedBy ProducedBy { get; set; }
    3636    [Storable]
    37     public List<T> ParentList { get; set; }
     37    public List<T> Predecessors { get; set; }
    3838    [Storable]
    39     public int Generation { get; set; }
     39    public int Iteration { get; set; }
    4040    [Storable]
    4141    public ResultCollection InfoStore { get; set; }
    4242
    4343    public SolutionInformation() {
    44       ParentList = new List<T>();
     44      Predecessors = new List<T>();
    4545      InfoStore = new ResultCollection();
    4646    }
     
    5151      : base(original, cloner) {
    5252      this.ProducedBy = original.ProducedBy;
    53       this.ParentList = new List<T>(original.ParentList);
    54       this.Generation = original.Generation;
     53      this.Predecessors = new List<T>(original.Predecessors);
     54      this.Iteration = original.Iteration;
    5555      this.InfoStore = (ResultCollection)original.InfoStore.Clone(cloner);
    5656    }
     
    6464      if (pi == null) return false;
    6565
    66       if (ProducedBy == pi.ProducedBy && Generation == pi.Generation) {
    67         if (pi.ParentList == null && ParentList == null) return true;
    68         if (pi.ParentList != null && ParentList == null ||
    69           pi.ParentList == null && ParentList != null) return false;
    70         if (pi.ParentList.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;
    7171
    72         foreach (var p in ParentList) {
    73           if (!pi.ParentList.Contains(p)) return false;
     72        foreach (var p in Predecessors) {
     73          if (!pi.Predecessors.Contains(p)) return false;
    7474        }
    7575        foreach (IResult info in InfoStore) {
Note: See TracChangeset for help on using the changeset viewer.