Ignore:
Timestamp:
01/24/18 13:17:00 (3 years ago)
Author:
rhanghof
Message:

#2817:

  • Dealing with stackable items
  • Enhanced the Evaluator
  • Added parameters some paramters to the packing items
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2817-BinPackingSpeedup/HeuristicLab.Problems.BinPacking/3.3/3D/PackingItem.cs

    r15617 r15646  
    4343      get { return (IFixedValueParameter<IntValue>)Parameters["Material"]; }
    4444    }
    45    
     45
    4646    public PackingShape TargetBin {
    4747      get { return TargetBinParameter.Value; }
     
    6060
    6161
     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
    6282    public IValueParameter<BoolValue> RotateEnabledParameter {
    6383      get { return (IValueParameter<BoolValue>)Parameters["RotateEnabled"]; }
     
    7595      get { return (IValueParameter<BoolValue>)Parameters["Tilted"]; }
    7696    }
    77    
     97
    7898    /// <summary>
    7999    /// Enables that the current item can be rotated.
     
    110130      set { TiltedParameter.Value.Value = value; }
    111131    }
    112    
     132
    113133    public IFixedValueParameter<IntValue> LoadSecuringHeightParameter {
    114134      get { return (IFixedValueParameter<IntValue>)Parameters["LoadSecuringHeight"]; }
    115135    }
    116    
     136
    117137    public IFixedValueParameter<IntValue> LoadSecuringWidthParameter {
    118138      get { return (IFixedValueParameter<IntValue>)Parameters["LoadSecuringWidth"]; }
     
    195215          return WidthParameter.Value.Value;
    196216        }
    197       } 
     217      }
    198218    }
    199219
     
    255275      set { DepthParameter.Value.Value = value; }
    256276    }
    257    
     277
    258278    public bool SupportsStacking(IPackingItem other) {
    259279      return ((other.Material < this.Material) || (other.Material.Equals(this.Material) && other.Weight <= this.Weight));
     
    273293      Parameters.Add(new FixedValueParameter<DoubleValue>("Weight"));
    274294      Parameters.Add(new FixedValueParameter<IntValue>("Material"));
     295
     296      Parameters.Add(new FixedValueParameter<DoubleValue>("SupportedWeight"));     
     297
    275298      Parameters.Add(new FixedValueParameter<BoolValue>("RotateEnabled"));
    276299      Parameters.Add(new FixedValueParameter<BoolValue>("Rotated"));
    277300      Parameters.Add(new FixedValueParameter<BoolValue>("TiltEnabled"));
    278301      Parameters.Add(new FixedValueParameter<BoolValue>("Tilted"));
    279      
     302      Parameters.Add(new FixedValueParameter<BoolValue>("IsStackable"));
     303
    280304      Parameters.Add(new FixedValueParameter<IntValue>("LoadSecuringHeight"));
    281305      Parameters.Add(new FixedValueParameter<IntValue>("LoadSecuringWidth"));
    282306      Parameters.Add(new FixedValueParameter<IntValue>("LoadSecuringDepth"));
     307
     308      IsStackabel = true;
    283309
    284310      RegisterEvents();
     
    294320
    295321    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) {
    297323      this.Weight = weight;
    298324      this.Material = material;
    299325    }
    300326
    301    
    302 
    303     public PackingItem(PackingItem packingItem)
    304       : this() {
     327
     328
     329    public PackingItem(PackingItem packingItem) : this() {
    305330      OriginalWidth = packingItem.OriginalWidth;
    306331      OriginalHeight = packingItem.OriginalHeight;
    307       OriginalDepth =  packingItem.OriginalDepth;
     332      OriginalDepth = packingItem.OriginalDepth;
    308333      TargetBin = (PackingShape)packingItem.TargetBin.Clone();
    309334      Weight = packingItem.Weight;
     
    311336      Rotated = packingItem.Rotated;
    312337      Tilted = packingItem.Tilted;
     338      IsStackabel = packingItem.IsStackabel;
    313339
    314340      LoadSecuringDepth = packingItem.LoadSecuringDepth;
     
    337363      return string.Format("CuboidPackingItem ({0}, {1}, {2}; weight={3}, mat={4})", this.Width, this.Height, this.Depth, this.Weight, this.Material);
    338364    }
    339    
     365
    340366  }
    341367}
Note: See TracChangeset for help on using the changeset viewer.