Changeset 9563 for branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem
- Timestamp:
- 06/02/13 04:26:26 (12 years ago)
- Location:
- branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem/CuboidPackingItem.cs
r9348 r9563 38 38 39 39 public CuboidPackingBin TargetBin { get; set; } 40 public double Weight { get; set; } 41 public int Material { get; set; } 42 public bool SupportsStacking(IPackingItem other) { 43 return ((other.Material < this.Material) || (other.Material.Equals(this.Material) && other.Weight <= this.Weight)); 44 } 40 45 41 46 [StorableConstructor] … … 43 48 protected CuboidPackingItem(CuboidPackingItem original, Cloner cloner) 44 49 : base(original, cloner) { 50 this.Weight = original.Weight; 51 this.Material = original.Material; 45 52 } 46 53 public override IDeepCloneable Clone(Cloner cloner) { … … 51 58 } 52 59 60 public CuboidPackingItem(int width, int height, int depth, CuboidPackingBin targetBin, double weight, int material) : this(width, height, depth, targetBin) { this.Weight = weight; this.Material = material; } 53 61 public CuboidPackingItem(int width, int height, int depth, CuboidPackingBin targetBin) : base(width, height, depth) { this.TargetBin = new CuboidPackingBin(targetBin.Width, targetBin.Height, targetBin.Depth); } 54 62 … … 56 64 TargetBin = new CuboidPackingBin(targetBinMeasures[0], targetBinMeasures[1], targetBinMeasures[2]); 57 65 } 66 67 public override string ToString() { 68 return String.Format("CuboidPackingItem ({0}, {1}, {2}; w={3}, m={4})", this.Width, this.Height, this.Depth, this.Weight,this.Material); 69 } 58 70 } 59 71 } -
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem/RectangularPackingItem.cs
r9348 r9563 37 37 public class RectangularPackingItem : RectangularPackingShape, IPackingItem{ 38 38 39 public RectangularPackingBin TargetBin { get; set; } 39 public RectangularPackingBin TargetBin { get; set; } 40 public double Weight { get; set; } 41 public int Material { get; set; } 42 public bool SupportsStacking(IPackingItem other) { 43 return ((other.Material < this.Material) || (other.Material.Equals(this.Material) && other.Weight <= this.Weight)); 44 } 40 45 41 46 [StorableConstructor] … … 43 48 protected RectangularPackingItem(RectangularPackingItem original, Cloner cloner) 44 49 : base(original, cloner) { 50 this.Weight = original.Weight; 51 this.Material = original.Material; 45 52 } 46 53 public override IDeepCloneable Clone(Cloner cloner) { … … 48 55 } 49 56 public RectangularPackingItem() : base() { 50 51 57 } 52 58
Note: See TracChangeset
for help on using the changeset viewer.