Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/14/17 00:04:58 (7 years ago)
Author:
abeham
Message:

#2762:

  • Moved initialization / cloning of extreme points list to base class
  • Removed residual space from base class and put it into derived class for 3d bin packing
  • Updated sample
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.BinPacking/3.3/BinPacking.cs

    r15240 r15241  
    5050    [Storable]
    5151    protected Dictionary<int, List<int>> OccupationLayers { get; set; }
    52 
    53     [Storable]
    54     public Dictionary<TPos, Tuple<int,int,int>> ResidualSpace { get; protected set; }
    55 
     52   
    5653    #endregion Properties
    5754
     
    6562      Items = new ObservableDictionary<int, TItem>();
    6663      BinShape = (TBin)binShape.Clone();
     64      ExtremePoints = new SortedSet<TPos>();
    6765      OccupationLayers = new Dictionary<int, List<int>>();
    6866    }
     
    8179      }
    8280      this.BinShape = (TBin)original.BinShape.Clone(cloner);
     81      this.ExtremePoints = new SortedSet<TPos>(original.ExtremePoints.Select(p => cloner.Clone(p)));
    8382      this.OccupationLayers = new Dictionary<int, List<int>>();
    8483      foreach (var kvp in original.OccupationLayers) {
    8584        OccupationLayers.Add(kvp.Key, new List<int>(kvp.Value));
    8685      }
    87     }
    88 
    89     [StorableHook(HookType.AfterDeserialization)]
    90     private void AfterDeserialization() {
    91       // BackwardsCompatibility3.3
    92       #region Backwards compatible code, remove with 3.4
    93       if (ResidualSpace == null)
    94         ResidualSpace = new Dictionary<TPos, Tuple<int, int, int>>();
    95       #endregion
    9686    }
    9787
     
    110100      Positions[itemID] = position;
    111101      ExtremePoints.Remove(position);
    112       if (ResidualSpace != null) ResidualSpace.Remove(position);
    113102      foreach (int id in Items.Select(x => x.Key))
    114103        GenerateNewExtremePointsForNewItem(Items[id], Positions[id]);
Note: See TracChangeset for help on using the changeset viewer.