Changeset 15646 for branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/PackingItem.cs
- Timestamp:
- 01/24/18 13:17:00 (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/PackingItem.cs
r15617 r15646 43 43 get { return (IFixedValueParameter<IntValue>)Parameters["Material"]; } 44 44 } 45 45 46 46 public PackingShape TargetBin { 47 47 get { return TargetBinParameter.Value; } … … 60 60 61 61 62 public IFixedValueParameter<DoubleValue> SupportedWeightParameter { 63 get { return (IFixedValueParameter<DoubleValue>)Parameters["SupportedWeight"]; } 64 } 65 public double SupportedWeight { 66 get { return SupportedWeightParameter.Value.Value; } 67 set { SupportedWeightParameter.Value.Value = value; } 68 } 69 70 public IValueParameter<BoolValue> IsStackableParameter { 71 get { return (IValueParameter<BoolValue>)Parameters["IsStackable"]; } 72 } 73 74 /// <summary> 75 /// Indicates that another item can be stacked on the current one. 76 /// </summary> 77 public bool IsStackabel { 78 get { return IsStackableParameter.Value.Value; } 79 set { IsStackableParameter.Value.Value = value; } 80 } 81 62 82 public IValueParameter<BoolValue> RotateEnabledParameter { 63 83 get { return (IValueParameter<BoolValue>)Parameters["RotateEnabled"]; } … … 75 95 get { return (IValueParameter<BoolValue>)Parameters["Tilted"]; } 76 96 } 77 97 78 98 /// <summary> 79 99 /// Enables that the current item can be rotated. … … 110 130 set { TiltedParameter.Value.Value = value; } 111 131 } 112 132 113 133 public IFixedValueParameter<IntValue> LoadSecuringHeightParameter { 114 134 get { return (IFixedValueParameter<IntValue>)Parameters["LoadSecuringHeight"]; } 115 135 } 116 136 117 137 public IFixedValueParameter<IntValue> LoadSecuringWidthParameter { 118 138 get { return (IFixedValueParameter<IntValue>)Parameters["LoadSecuringWidth"]; } … … 195 215 return WidthParameter.Value.Value; 196 216 } 197 } 217 } 198 218 } 199 219 … … 255 275 set { DepthParameter.Value.Value = value; } 256 276 } 257 277 258 278 public bool SupportsStacking(IPackingItem other) { 259 279 return ((other.Material < this.Material) || (other.Material.Equals(this.Material) && other.Weight <= this.Weight)); … … 273 293 Parameters.Add(new FixedValueParameter<DoubleValue>("Weight")); 274 294 Parameters.Add(new FixedValueParameter<IntValue>("Material")); 295 296 Parameters.Add(new FixedValueParameter<DoubleValue>("SupportedWeight")); 297 275 298 Parameters.Add(new FixedValueParameter<BoolValue>("RotateEnabled")); 276 299 Parameters.Add(new FixedValueParameter<BoolValue>("Rotated")); 277 300 Parameters.Add(new FixedValueParameter<BoolValue>("TiltEnabled")); 278 301 Parameters.Add(new FixedValueParameter<BoolValue>("Tilted")); 279 302 Parameters.Add(new FixedValueParameter<BoolValue>("IsStackable")); 303 280 304 Parameters.Add(new FixedValueParameter<IntValue>("LoadSecuringHeight")); 281 305 Parameters.Add(new FixedValueParameter<IntValue>("LoadSecuringWidth")); 282 306 Parameters.Add(new FixedValueParameter<IntValue>("LoadSecuringDepth")); 307 308 IsStackabel = true; 283 309 284 310 RegisterEvents(); … … 294 320 295 321 public PackingItem(int width, int height, int depth, PackingShape targetBin, double weight, int material) 296 : this(width, height, depth, targetBin) { 322 : this(width, height, depth, targetBin) { 297 323 this.Weight = weight; 298 324 this.Material = material; 299 325 } 300 326 301 302 303 public PackingItem(PackingItem packingItem) 304 : this() { 327 328 329 public PackingItem(PackingItem packingItem) : this() { 305 330 OriginalWidth = packingItem.OriginalWidth; 306 331 OriginalHeight = packingItem.OriginalHeight; 307 OriginalDepth = 332 OriginalDepth = packingItem.OriginalDepth; 308 333 TargetBin = (PackingShape)packingItem.TargetBin.Clone(); 309 334 Weight = packingItem.Weight; … … 311 336 Rotated = packingItem.Rotated; 312 337 Tilted = packingItem.Tilted; 338 IsStackabel = packingItem.IsStackabel; 313 339 314 340 LoadSecuringDepth = packingItem.LoadSecuringDepth; … … 337 363 return string.Format("CuboidPackingItem ({0}, {1}, {2}; weight={3}, mat={4})", this.Width, this.Height, this.Depth, this.Weight, this.Material); 338 364 } 339 365 340 366 } 341 367 }
Note: See TracChangeset
for help on using the changeset viewer.