Free cookie consent management tool by TermsFeed Policy Generator

Changeset 9563


Ignore:
Timestamp:
06/02/13 04:26:26 (11 years ago)
Author:
jhelm
Message:

#1966: Implemented additional Operator-Wrappers for PackingSequence and GroupingVector; Implemented additional problem-class for Rosenbauer-Problemstatement; Added marker-interfaces for decoder-types;

Location:
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3
Files:
86 added
6 deleted
43 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Analyzers/BestBinPackingSolutionAnalyzer.cs

    r9440 r9563  
    3434using HeuristicLab.Encodings.PackingEncoding.PackingPlan;
    3535using HeuristicLab.Problems.BinPacking.Shapes;
     36using HeuristicLab.Problems.BinPacking.Evaluators;
    3637
    3738namespace HeuristicLab.Problems.BinPacking.Analyzers {     
     
    4041  public class BestBinPackingSolutionAnalyzer<D, B, I> : BinPackingAnalyzer<D, B, I>, IStochasticOperator
    4142    where D : class, IPackingDimensions
    42     where B : PackingShape<D>, IPackingBin
    43     where I : PackingShape<D>, IPackingItem {
     43    where B : PackingShape<D>, IPackingBin, IRegularPackingShape
     44    where I : PackingShape<D>, IPackingItem, IRegularPackingShape {
    4445
    4546    protected BestBinPackingSolutionAnalyzer(BestBinPackingSolutionAnalyzer<D,B,I> original, Cloner cloner)
     
    9394          bestSolution.Quality.Value = qualities[i].Value;
    9495          bestSolution.PackingItemPositions = new ObservableDictionary<int, D> (solutions[i].PackingItemPositions);
     96          bestSolution.PackingBinMeasures = new ObservableDictionary<int, B>(solutions[i].PackingBinMeasures);
    9597        }
    9698      }
     99      string binUtilKey = "Overall Bin Utilization";
     100      DoubleValue binUtil = BinUtilizationRegularIdenticalBinEvaluator<D, B, I>.CalculateBinUtilization(bestSolution);
     101      if (!results.ContainsKey("Overall Bin Utilization"))
     102        results.Add(new Result(binUtilKey, binUtil));
     103      else
     104        results[binUtilKey].Value = binUtil;
    97105
    98106      return base.Apply();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/BL/BottomLeftFunctions.cs

    r9495 r9563  
    88using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
    99using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
     10using HeuristicLab.Encodings.PermutationEncoding;
    1011using HeuristicLab.Problems.BinPacking.Dimensions;
    1112using HeuristicLab.Problems.BinPacking.Interfaces;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/BL/BottomLeftGroupingVectorDecoder.cs

    r9495 r9563  
    4444      TwoDimensionalPacking,
    4545      RectangularPackingBin,
    46       RectangularPackingItem> {
     46      RectangularPackingItem>, I2DGVDecoder {
    4747
    4848    public BottomLeftGroupingVectorDecoder()
     
    6060
    6161
    62     public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     62    public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    6363
    6464      var solution = encodedSolution as GroupingVectorEncoding;
     
    6666
    6767      PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result =
    68         new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     68        new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures, itemMeasures);
    6969
    7070      result.PackingItemPositions = BottomLeftFunctions.BottomLeftPacking(solution, binMeasures, itemMeasures);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/BL/BottomLeftMultiComponentVectorDecoder.cs

    r9495 r9563  
    4444      TwoDimensionalPacking,
    4545      RectangularPackingBin,
    46       RectangularPackingItem> {
     46      RectangularPackingItem>, I2DMCVDecoder {
    4747
    4848    public BottomLeftMultiComponentVectorDecoder()
     
    6060
    6161
    62     public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     62    public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    6363
    6464      var solution = encodedSolution as MultiComponentVectorEncoding;
     
    6666
    6767      PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result =
    68         new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     68        new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures, itemMeasures);
    6969     
    7070      result.PackingItemPositions = BottomLeftFunctions.BottomLeftPacking(solution, binMeasures, itemMeasures);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/BL/BottomLeftPackingSequenceDecoder.cs

    r9495 r9563  
    4343      TwoDimensionalPacking,
    4444      RectangularPackingBin,
    45       RectangularPackingItem> {
     45      RectangularPackingItem>, I2DPSDecoder {
    4646
    4747    public BottomLeftPackingSequenceDecoder()
     
    5959
    6060
    61     public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     61    public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    6262
    6363      var solution = encodedSolution as PackingSequenceEncoding;
     
    6565
    6666      PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result =
    67         new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     67        new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures, itemMeasures);
    6868
    6969      result.PackingItemPositions = BottomLeftFunctions.BottomLeftPacking (solution, binMeasures, itemMeasures);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/EP/ExtremePointGroupingVectorDecoder2D.cs

    r9495 r9563  
    4444      TwoDimensionalPacking,
    4545      RectangularPackingBin,
    46       RectangularPackingItem> {
     46      RectangularPackingItem>, I2DGVDecoder {
    4747
    4848    public ExtremePointGroupingVectorDecoder2D ()
     
    6767    }
    6868
    69     public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     69    public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    7070                     
    7171      var solution = encodedSolution as GroupingVectorEncoding;
    7272      if (solution == null) throw new InvalidOperationException("Encoding is not of type GroupingVector");
    7373
    74       return Decode(solution, PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     74      return Decode(solution, binMeasures, itemMeasures);
    7575    }
    7676  }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/EP/ExtremePointMultiComponentVectorDecoder2D.cs

    r9495 r9563  
    4545      TwoDimensionalPacking,
    4646      RectangularPackingBin,
    47       RectangularPackingItem> {
     47      RectangularPackingItem>, I2DMCVDecoder {
    4848
    4949    public ExtremePointMultiComponentVectorDecoder2D ()
     
    6868    }
    6969
    70     public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     70    public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    7171
    7272      var solution = encodedSolution as MultiComponentVectorEncoding;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/EP/ExtremePointPackingSequenceDecoder2D.cs

    r9495 r9563  
    4343      TwoDimensionalPacking,
    4444      RectangularPackingBin,
    45       RectangularPackingItem> {
     45      RectangularPackingItem>, I2DPSDecoder {
    4646
    4747    public ExtremePointPackingSequenceDecoder2D ()
     
    5858
    5959
    60     public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
     60    public override PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, RectangularPackingBin binMeasures, ItemList<RectangularPackingItem> itemMeasures) {
    6161
    6262      var solution = encodedSolution as PackingSequenceEncoding;
     
    6464
    6565      PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem> result =
    66         new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     66        new PackingPlan<TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>(binMeasures, itemMeasures);
    6767
    68       result.PackingItemPositions = ExtremPointsFunctions2D.ExtremePointBasedPacking(solution, PackingItemMeasuresParameter.ActualValue, PackingBinMeasuresParameter.ActualValue);
     68      result.PackingItemPositions = ExtremPointsFunctions2D.ExtremePointBasedPacking(solution, itemMeasures, binMeasures);
    6969
    7070      return result;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/2D/EP/ExtremePointsFunctions2D.cs

    r9495 r9563  
    88using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
    99using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
     10using HeuristicLab.Encodings.PermutationEncoding;
    1011using HeuristicLab.Problems.BinPacking.Dimensions;
    1112using HeuristicLab.Problems.BinPacking.Interfaces;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/DBL/DeepestBottomLeftFunctions.cs

    r9495 r9563  
    88using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
    99using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
     10using HeuristicLab.Encodings.PermutationEncoding;
    1011using HeuristicLab.Problems.BinPacking.Dimensions;
    1112using HeuristicLab.Problems.BinPacking.Interfaces;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/DBL/DeepestBottomLeftGroupingVectorDecoder.cs

    r9495 r9563  
    4343      ThreeDimensionalPacking,
    4444      CuboidPackingBin,
    45       CuboidPackingItem> {
     45      CuboidPackingItem>, I3DGVDecoder {
    4646
    4747    public DeepestBottomLeftGroupingVectorDecoder()
     
    5959
    6060
    61     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     61    public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    6262
    6363      var solution = encodedSolution as GroupingVectorEncoding;
     
    6565
    6666      PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result = new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(
    67         PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     67        binMeasures, itemMeasures);
    6868
    6969      ObservableDictionary<int, ThreeDimensionalPacking> packingPositions = DeepestBottomLeftFunctions.DeepestLeftBottomPacking(
    7070        solution,
    71         PackingBinMeasuresParameter.ActualValue,
    72         PackingItemMeasuresParameter.ActualValue);
     71        binMeasures,
     72        itemMeasures);
    7373
    7474
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/DBL/DeepestBottomLeftMultiComponentVectorDecoder.cs

    r9495 r9563  
    4444      ThreeDimensionalPacking,
    4545      CuboidPackingBin,
    46       CuboidPackingItem> {
     46      CuboidPackingItem>, I3DMCVDecoder {
    4747
    4848    public DeepestBottomLeftMultiComponentVectorDecoder()
     
    6060
    6161
    62     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     62    public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    6363
    6464      var solution = encodedSolution as MultiComponentVectorEncoding;
     
    6666
    6767      PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result =
    68         new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     68        new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(binMeasures, itemMeasures);
    6969     
    7070      result.PackingItemPositions = DeepestBottomLeftFunctions.DeepestLeftBottomPacking (solution, binMeasures, itemMeasures);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/DBL/DeepestBottomLeftPackingSequenceDecoder.cs

    r9495 r9563  
    4343      ThreeDimensionalPacking,
    4444      CuboidPackingBin,
    45       CuboidPackingItem> {
     45      CuboidPackingItem>, I3DPSDecoder {
    4646
    4747    public DeepestBottomLeftPackingSequenceDecoder()
     
    5959
    6060
    61     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     61    public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    6262
    6363      var solution = encodedSolution as PackingSequenceEncoding;
     
    6565
    6666      PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result =
    67         new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     67        new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(binMeasures, itemMeasures);
    6868
    6969      result.PackingItemPositions = DeepestBottomLeftFunctions.DeepestLeftBottomPacking (solution, binMeasures, itemMeasures);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ExtremePointGroupingVectorDecoder3D.cs

    r9495 r9563  
    4444      ThreeDimensionalPacking,
    4545      CuboidPackingBin,
    46       CuboidPackingItem> {
     46      CuboidPackingItem>, I3DGVDecoder {
    4747
    4848    public ExtremePointGroupingVectorDecoder3D ()
     
    6767    }
    6868
    69     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     69    public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    7070                     
    7171      var solution = encodedSolution as GroupingVectorEncoding;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ExtremePointMultiComponentVectorDecoder3D.cs

    r9495 r9563  
    4545      ThreeDimensionalPacking,
    4646      CuboidPackingBin,
    47       CuboidPackingItem> {
     47      CuboidPackingItem>, I3DMCVDecoder {
    4848
    4949    public ExtremePointMultiComponentVectorDecoder3D ()
     
    6868    }
    6969
    70     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     70    public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    7171
    7272      var solution = encodedSolution as MultiComponentVectorEncoding;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ExtremePointPackingSequenceDecoder3D.cs

    r9495 r9563  
    4343      ThreeDimensionalPacking,
    4444      CuboidPackingBin,
    45       CuboidPackingItem> {
     45      CuboidPackingItem>, I3DPSDecoder {
    4646
    4747    public ExtremePointPackingSequenceDecoder3D ()
     
    5858
    5959
    60     public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     60    public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    6161
    6262      var solution = encodedSolution as PackingSequenceEncoding;
     
    6464
    6565      PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result =
    66         new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     66        new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(binMeasures, itemMeasures);
    6767
    68       result.PackingItemPositions = ExtremePointsFunctions3D.ExtremePointBasedPacking(solution, PackingItemMeasuresParameter.ActualValue, PackingBinMeasuresParameter.ActualValue);
     68      result.PackingItemPositions = ExtremePointsFunctions3D.ExtremePointBasedPacking(solution, itemMeasures, binMeasures);
    6969
    7070      return result;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ExtremePointsFunctions3D.cs

    r9495 r9563  
    99using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
    1010using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
     11using HeuristicLab.Encodings.PermutationEncoding;
    1112using HeuristicLab.Problems.BinPacking.Dimensions;
    1213using HeuristicLab.Problems.BinPacking.Interfaces;
     
    221222          return FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePoints, occupiedPoints, itemPositions, false);
    222223    }
     224    public static ThreeDimensionalPacking FindExtremePointForItemUsingMaterialAndWeightConstraint(int itemIndex, ItemList<CuboidPackingItem> itemMeasures, CuboidPackingBin binMeasures,
     225       HashSet<ThreeDimensionalPacking> extremePoints, List<int[, ,]> occupiedPoints, ObservableDictionary<int, ThreeDimensionalPacking> itemPositions, bool rotated) {
     226
     227      var itemFromList = itemMeasures[itemIndex];
     228      CuboidPackingItem item = new CuboidPackingItem(
     229        rotated ? itemFromList.Depth : itemFromList.Width,
     230        itemFromList.Height,
     231        rotated ? itemFromList.Width : itemFromList.Depth,
     232        itemFromList.TargetBin, itemFromList.Weight, itemFromList.Material);
     233
     234      int epIndex = 0;
     235      while (epIndex < extremePoints.Count &&
     236        (!DeepestBottomLeftFunctions.IsPositionFeasible(binMeasures, extremePoints.ElementAt(epIndex).AssignedBin, item, extremePoints.ElementAt(epIndex), itemPositions, itemMeasures) ||
     237        !IsStaticStable(occupiedPoints[extremePoints.ElementAt(epIndex).AssignedBin], item, extremePoints.ElementAt(epIndex)) ||
     238        !WeightIsSupported(occupiedPoints[extremePoints.ElementAt(epIndex).AssignedBin], item, extremePoints.ElementAt(epIndex), itemMeasures))) { epIndex++; }
     239
     240      if (epIndex < extremePoints.Count) {
     241        var result = extremePoints.ElementAt(epIndex);
     242        result.Rotated = rotated;
     243        return result;
     244      }
     245      return null;
     246    }
    223247    public static ThreeDimensionalPacking FindExtremePointForItem(int itemIndex, ItemList<CuboidPackingItem> itemMeasures, CuboidPackingBin binMeasures,
    224248        HashSet<ThreeDimensionalPacking> extremePoints, List<int[,,]> occupiedPoints, ObservableDictionary<int, ThreeDimensionalPacking> itemPositions, bool rotated) {
     
    228252        rotated ? itemFromList.Depth : itemFromList.Width,
    229253        itemFromList.Height,
    230         rotated ? itemFromList.Width : itemFromList.Depth, 
     254        rotated ? itemFromList.Width : itemFromList.Depth,
    231255        itemFromList.TargetBin);
    232256
     
    280304      return false;
    281305    }
     306    public static bool WeightIsSupported(int[, ,] occupiedPoints, CuboidPackingItem item, ThreeDimensionalPacking ep, ItemList<CuboidPackingItem> items) {
     307      //Static stability is given, if item is placed on the ground
     308      if (ep.Y == 0)
     309        return true;
     310
     311      if (items[occupiedPoints[ep.X, ep.Y - 1, ep.Z]].SupportsStacking(item)
     312        && items[occupiedPoints[ep.X + item.Width - 1, ep.Y - 1, ep.Z]].SupportsStacking(item)
     313        && items[occupiedPoints[ep.X, ep.Y - 1, ep.Z + item.Depth - 1]].SupportsStacking(item)
     314        && items[occupiedPoints[ep.X + item.Width - 1, ep.Y - 1, ep.Z + item.Depth - 1]].SupportsStacking(item))
     315        return true;
     316
     317      //int groundCount = 0;
     318      //for (int x = ep.X; x < ep.X + item.Width - 1; x++) {
     319      //  for (int z = ep.Z; z < ep.Z + item.Depth - 1; z++) {
     320      //    if (occupiedPoints[x,ep.Y-1, z] != -1)                                                     
     321      //      groundCount++;
     322      //  }
     323      //}
     324      //double stableGround = (double)(groundCount) / (double)(item.Width * item.Depth);
     325      //if (stableGround > 0.75)
     326      //  return true;
     327
     328      return false;
     329    }
    282330    public static List<int[, ,]>  OccupyPointsForNewItem(List<int[, ,]> occupiedPoints, CuboidPackingItem newItem, ThreeDimensionalPacking position, int itemIndex) {
    283331      int width = position.Rotated ? newItem.Depth : newItem.Width;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/3D/EP/ISOContainerMultiComponentVectorDecoder3D.cs

    r9495 r9563  
    4040
    4141namespace HeuristicLab.Problems.BinPacking.Decoders {
    42   [Item("Identical bin, three dimensional, extreme points based decoder for the MultiComponentVector encoding.", "<Description missing...>")]
     42  [Item("ISO container decoder for the MultiComponentVector encoding.", "<Description missing...>")]
    4343  [StorableClass]
    44   public class ISOContainerMultiComponentVectorDecoder3D : IdenticalBinPackingSolutionDecoder<
     44  public class ISOContainerMultiComponentVectorDecoder3D : PackingSolutionDecoder<
    4545      ThreeDimensionalPacking,
    4646      CuboidPackingBin,
    47       CuboidPackingItem,
    48       MultipleBinSizePackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>> {
     47      CuboidPackingItem>, I3DMCVDecoder {
    4948
    5049    public ISOContainerMultiComponentVectorDecoder3D ()
     
    6059    }
    6160
    62     public static MultipleBinSizePackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Decode(MultiComponentVectorEncoding solution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
     61    public static PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> Decode(MultiComponentVectorEncoding solution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    6362     
    64       MultipleBinSizePackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result =
    65         new MultipleBinSizePackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(new ObservableDictionary<int, CuboidPackingBin>(), itemMeasures);
     63      PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> result =
     64        new PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>(new ObservableDictionary<int, CuboidPackingBin>(), itemMeasures);
    6665
    6766      #region Preperations
    6867      int nrOfBins = solution.NrOfBins;
    69 
    70       //Get all indexes of items for every bin according to grouping-vector                     
     68                     
    7169      Dictionary<int, List<PackingInformation>> unpackedItemIndexesPerBin = new Dictionary<int, List<PackingInformation>>();
    72       Dictionary<int, HashSet<ThreeDimensionalPacking>> extremePointsForBin = new Dictionary<int, HashSet<ThreeDimensionalPacking>>();
     70      Dictionary<int, HashSet<ThreeDimensionalPacking>> extremePointsForBin = new Dictionary<int, HashSet<ThreeDimensionalPacking>>(); 
     71      ObservableDictionary<int, CuboidPackingBin> resultingBinMeasures = new ObservableDictionary<int, CuboidPackingBin>();
    7372      var occupiedPoints = new List<int[, ,]>();
    7473
     
    7978        extremePointsForBin[i].Add(new ThreeDimensionalPacking(i, 0, 0, 0, false));
    8079        occupiedPoints = ExtremePointsFunctions3D.IncreaseBinCountForOccupiedPoints(occupiedPoints, binMeasures);
     80        resultingBinMeasures[i] = new CuboidPackingBin(binMeasures.Width, binMeasures.Height, binMeasures.Depth);
    8181      }
    8282
     
    9595          var item = itemMeasures[itemIndex];
    9696
    97           extremePointsForBin[binNr] = ExtremePointsFunctions3D.OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, binMeasures);
    98           var positionFound = ExtremePointsFunctions3D.FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated);
     97          extremePointsForBin[binNr] = ExtremePointsFunctions3D.OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, resultingBinMeasures[binNr]);
     98          var positionFound = ExtremePointsFunctions3D.FindExtremePointForItemUsingMaterialAndWeightConstraint(itemIndex, itemMeasures, resultingBinMeasures[binNr], extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated);
     99
     100          if (positionFound == null && resultingBinMeasures[binNr].Depth.Equals(binMeasures.Depth)) {
     101            occupiedPoints = DoubleDepthForBinNr(occupiedPoints, ref resultingBinMeasures, binNr);
     102            positionFound = ExtremePointsFunctions3D.FindExtremePointForItemUsingMaterialAndWeightConstraint(itemIndex, itemMeasures, resultingBinMeasures[binNr], extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated);
     103          }
     104
    99105          if (positionFound != null) {
    100106            extremePointsForBin[binNr].Remove(positionFound);
    101107            itemPositions[itemIndex] = positionFound;
    102108            occupiedPoints = ExtremePointsFunctions3D.OccupyPointsForNewItem(occupiedPoints, item, positionFound, itemIndex);
    103             extremePointsForBin[binNr] = ExtremePointsFunctions3D.GenerateNewExtremePointsForNewItem(extremePointsForBin[binNr], occupiedPoints, item, positionFound, binMeasures);
     109            extremePointsForBin[binNr] = ExtremePointsFunctions3D.GenerateNewExtremePointsForNewItem(extremePointsForBin[binNr], occupiedPoints, item, positionFound, resultingBinMeasures[binNr]);
    104110          } else {
    105111            remainingItems.Add(unpackedItems[i]);
    106             //solution.PackingInformations[binNr].Remove(unpackedItems[i]);
     112            solution.PackingInformations[binNr].Remove(unpackedItems[i]);
    107113          }
    108114        }
     
    119125          var item = itemMeasures[itemIndex];
    120126
    121           extremePointsForBin[binNr] = ExtremePointsFunctions3D.OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, binMeasures);
    122           var positionFound = ExtremePointsFunctions3D.FindExtremePointForItem(itemIndex, itemMeasures, binMeasures, extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated);
     127          extremePointsForBin[binNr] = ExtremePointsFunctions3D.OrderExtremePoints(extremePointsForBin[binNr], occupiedPoints, resultingBinMeasures[binNr]);
     128          var positionFound = ExtremePointsFunctions3D.FindExtremePointForItemUsingMaterialAndWeightConstraint(itemIndex, itemMeasures, resultingBinMeasures[binNr], extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated);
     129
     130
     131          if (positionFound == null && resultingBinMeasures[binNr].Depth.Equals(binMeasures.Depth)) {
     132            occupiedPoints = DoubleDepthForBinNr(occupiedPoints, ref resultingBinMeasures, binNr);
     133            positionFound = ExtremePointsFunctions3D.FindExtremePointForItemUsingMaterialAndWeightConstraint(itemIndex, itemMeasures, resultingBinMeasures[binNr], extremePointsForBin[binNr], occupiedPoints, itemPositions, unpackedItems[i].Rotated);
     134          }
     135         
    123136          if (positionFound != null) {
    124137            extremePointsForBin[binNr].Remove(positionFound);
    125138            itemPositions[itemIndex] = positionFound;
    126139            occupiedPoints = ExtremePointsFunctions3D.OccupyPointsForNewItem(occupiedPoints, item, positionFound, itemIndex);
    127             extremePointsForBin[binNr] = ExtremePointsFunctions3D.GenerateNewExtremePointsForNewItem(extremePointsForBin[binNr], occupiedPoints, item, positionFound, binMeasures);
     140            extremePointsForBin[binNr] = ExtremePointsFunctions3D.GenerateNewExtremePointsForNewItem(extremePointsForBin[binNr], occupiedPoints, item, positionFound, resultingBinMeasures[binNr]);
    128141            remainingItems.Remove(unpackedItems[i]);
    129             //solution.PackingInformations[binNr].Add(unpackedItems[i]);
     142            solution.PackingInformations[binNr].Add(unpackedItems[i]);
    130143          }
    131144        }
     
    134147          extremePointsForBin[nrOfBins].Add(new ThreeDimensionalPacking(nrOfBins, 0, 0, 0, false));
    135148          occupiedPoints = ExtremePointsFunctions3D.IncreaseBinCountForOccupiedPoints(occupiedPoints, binMeasures);
    136           //solution.PackingInformations[nrOfBins] = new ItemList<PackingInformation>();
     149          resultingBinMeasures[nrOfBins] = new CuboidPackingBin(binMeasures.Width, binMeasures.Height, binMeasures.Depth);
     150          solution.PackingInformations[nrOfBins] = new ItemList<PackingInformation>();
    137151          nrOfBins++;
    138152        }
    139153      }
    140154
    141       return itemPositions;
    142 
    143 
     155      result.PackingItemPositions = itemPositions;
     156      result.PackingBinMeasures = resultingBinMeasures;
    144157      return result;
    145158    }
    146159
    147     protected override MultipleBinSizePackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IPackingSolutionEncoding encodedSolution) {
     160    private static List<int[, ,]> DoubleDepthForBinNr(List<int[, ,]> occupiedPoints, ref ObservableDictionary<int, CuboidPackingBin> binMeasures, int binNr) {
     161      var oldDepth = binMeasures[binNr].Depth;
     162      binMeasures[binNr].Depth = binMeasures[binNr].Depth * 2;
     163      var newBinOccupation = new int[binMeasures[binNr].Width, binMeasures[binNr].Height, binMeasures[binNr].Depth];
     164      for (int w = 0; w < binMeasures[binNr].Width; w++) {
     165        for (int h = 0; h < binMeasures[binNr].Height; h++) {
     166          for (int d = 0; d < binMeasures[binNr].Depth; d++) {
     167            if (d < oldDepth)
     168              newBinOccupation[w, h, d] = occupiedPoints[binNr][w, h, d];
     169            else
     170              newBinOccupation[w, h, d] = -1;
     171          }
     172        }
     173      }
     174
     175      occupiedPoints[binNr] = newBinOccupation;
     176      return occupiedPoints;
     177    }
     178
     179
     180
     181
     182    public override PackingPlan<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, CuboidPackingBin binMeasures, ItemList<CuboidPackingItem> itemMeasures) {
    148183
    149184      var solution = encodedSolution as MultiComponentVectorEncoding;
    150185      if (solution == null) throw new InvalidOperationException("Encoding is not of type MultiComponentVector");
    151186
    152       return Decode(solution, PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     187      return Decode(solution, binMeasures, itemMeasures);
    153188    }
    154189  }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Decoders/PackingSolutionDecoder.cs

    r9495 r9563  
    4747      get { return (LookupParameter<IRandom>)Parameters["Random"]; }
    4848    }
    49     public ILookupParameter<ItemList<I>> PackingItemMeasuresParameter {
     49    private ILookupParameter<ItemList<I>> PackingItemMeasuresParameter {
    5050      get { return (LookupParameter<ItemList<I>>)Parameters["PackingItemMeasures"]; }
    5151    }
    52     public ILookupParameter<B> PackingBinMeasuresParameter {
     52    private ILookupParameter<B> PackingBinMeasuresParameter {
    5353      get { return (LookupParameter<B>)Parameters["PackingBinMeasures"]; }
    5454    }
    55     public ILookupParameter<IPackingSolutionEncoding> EncodedSolutionParameter {
    56       get { return (ILookupParameter<IPackingSolutionEncoding>)Parameters["EncodedSolution"]; }
     55    public ILookupParameter<IItem> EncodedSolutionParameter {
     56      get { return (ILookupParameter<IItem>)Parameters["EncodedSolution"]; }
    5757    }
    5858    public ILookupParameter<PackingPlan<D,B,I>> PackingPlanParameter {
     
    6262
    6363    public PackingSolutionDecoder() : base() {
    64       Parameters.Add(new LookupParameter<IPackingSolutionEncoding>("EncodedSolution", "The new bin-packing solution represented as encoding."));
     64      Parameters.Add(new LookupParameter<IItem>("EncodedSolution", "The new bin-packing solution represented as encoding."));
    6565      Parameters.Add(new LookupParameter<PackingPlan<D, B, I>>("PackingPlan", "The decoded bin-packing solution represented as generalized packing plan."));
    6666      Parameters.Add(new LookupParameter<IRandom>("Random", "The pseudo random number generator which should be used for stochastic manipulation operators."));
     
    7575    }
    7676
    77     public abstract PackingPlan<D, B, I> CreatePackingPlanFromEncoding(IPackingSolutionEncoding solution, B binMeasures, ItemList<I> itemMeasures);
     77    public abstract PackingPlan<D, B, I> CreatePackingPlanFromEncoding(IItem solution, B binMeasures, ItemList<I> itemMeasures);
    7878
    7979    public override IOperation Apply() {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/GroupingVector/GroupingVectorCrossover.cs

    r9348 r9563  
    3030  [Item("Grouping Vector Crossover", "An operator which crosses two GroupingVector representations.")]
    3131  [StorableClass]
    32   public class GroupingVectorCrossover : PackingSolutionCrossover, IGroupingVectorOperator {
     32  public abstract class GroupingVectorCrossover : PackingSolutionCrossover, IGroupingVectorOperator {
    3333
    3434    [StorableConstructor]
     
    4040        ChildParameter.ActualName = "GroupingVector";
    4141    }
    42     public override IDeepCloneable Clone(Cloner cloner) {
    43       return new GroupingVectorCrossover(this, cloner);
    44     }
    4542
    46     public GroupingVectorEncoding Cross(IRandom random, GroupingVectorEncoding parent1, GroupingVectorEncoding parent2) {
    47       GroupingVectorEncoding result = new GroupingVectorEncoding();
    48       result.GroupingVector = SinglePointCrossover.Apply(random, parent1.GroupingVector, parent2.GroupingVector);
    49       return result;
    50     }
     43    public abstract GroupingVectorEncoding Cross(IRandom random, GroupingVectorEncoding parent1, GroupingVectorEncoding parent2);
    5144
    5245    public override IOperation Apply() {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/GroupingVector/GroupingVectorRandomCreator.cs

    r9440 r9563  
    6868    }
    6969
    70     protected override IPackingSolutionEncoding CreateSolution() {
     70    protected override IItem CreateSolution() {
    7171      return Apply(PackingItemsParameter.ActualValue.Value, LowerBoundParameter.ActualValue.Value, RandomParameter.ActualValue);
    7272    }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/MultiComponentVectorEncoding.cs

    r9495 r9563  
    4646        return nrOfItems;
    4747      }
    48     }
     48    } 
    4949
    5050    [StorableConstructor]
     
    6464      : base() {
    6565        PackingInformations = new ObservableDictionary<int, ItemList<PackingInformation>>();
    66     }
     66    }       
    6767
    6868    public override string ToString() {
     
    9595      return PackingInformations.GetHashCode();
    9696    }
     97
    9798  }
    9899
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/MultiComponentVector/MultiComponentVectorRandomCreator.cs

    r9495 r9563  
    7676    }
    7777
    78     protected override IPackingSolutionEncoding CreateSolution() {
     78    protected override IItem CreateSolution() {
    7979      return Apply(PackingItemsParameter.ActualValue.Value, LowerBoundParameter.ActualValue.Value, RandomParameter.ActualValue, SortedSequenceParameter.Value.Value);
    8080    }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/PackingPlan.cs

    r9495 r9563  
    3535
    3636namespace HeuristicLab.Encodings.PackingEncoding.PackingPlan {
    37   //RegularPackingPlan defines that the packingItems have to be parallel to the packingBin in every moment
    38   //SimpleRotation defines that the items may be rotated
    39   //  only in one dimension,
    40   //  only once and
    41   //  only by 90degree
    42   //    so that parallelism to the correlating bin is ensured
    43   //This definition implies that the floor of the (3D) objects never changes (what may be a wanted constraint in most cases..)
    4437  [Item("PackingPlan", "Represents a concrete solution for a bin-packing problem.")]
    4538  [StorableClass]
     
    8578    public PackingPlan(B binMeasures, ItemList<I> itemMeasures)
    8679      : base() {
    87       this.PackingItemMeasures = itemMeasures;
     80      this.PackingItemMeasures = new ItemList<I> (itemMeasures);
    8881      this.PackingBinMeasures = new ObservableDictionary<int, B>();
    8982      this.PackingBinMeasures[0] = binMeasures;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceCrossover.cs

    r9348 r9563  
    2929  [Item("PackingSequenceCrossover", "An operator which crosses two PackingSequence representations.")]
    3030  [StorableClass]
    31   public class PackingSequenceCrossover : PackingSolutionCrossover, IPackingSequenceOperator {
     31  public abstract class PackingSequenceCrossover : PackingSolutionCrossover, IPackingSequenceOperator {
    3232
    3333    [StorableConstructor]
     
    3939        ChildParameter.ActualName = "PackingSequence";
    4040    }
    41     public override IDeepCloneable Clone(Cloner cloner) {
    42       return new PackingSequenceCrossover(this, cloner);
    43     }
    4441
    45     public PackingSequenceEncoding Cross(IRandom random, PackingSequenceEncoding parent1, PackingSequenceEncoding parent2) {
    46       PackingSequenceEncoding result = new PackingSequenceEncoding();
    47       result.PackingSequence = CosaCrossover.Apply(random, parent1.PackingSequence, parent2.PackingSequence);
    48       return result;
    49     }
     42    public abstract PackingSequenceEncoding Cross(IRandom random, PackingSequenceEncoding parent1, PackingSequenceEncoding parent2);
    5043
    5144    public override IOperation Apply() {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceEncoding.cs

    r9348 r9563  
    3030  [Item("Packing Sequence Encoding", "Represents an encoding for a bin packing problem using permutation of item-indexes to define the packing sequence.")]
    3131  [StorableClass]
    32   public class PackingSequenceEncoding : Item, IPackingSolutionEncoding{
     32  public class PackingSequenceEncoding : Item, IPackingSolutionEncoding {
    3333
    3434    [Storable]
     
    3939    protected PackingSequenceEncoding(PackingSequenceEncoding original, Cloner cloner)
    4040      : base(original, cloner) {
    41         this.PackingSequence = cloner.Clone(original.PackingSequence);
     41      this.PackingSequence = cloner.Clone(original.PackingSequence);
    4242    }
    4343    public override IDeepCloneable Clone(Cloner cloner) {
     
    5353      StringBuilder sb = new StringBuilder();
    5454      sb.Append("[ ");
    55       sb.Append(PackingSequence.ToString() + " \n");         
     55      sb.Append(PackingSequence.ToString() + " \n");
    5656      sb.Append("]");
    5757      return sb.ToString();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceManipulator.cs

    r9348 r9563  
    3030  [Item("PackingSequenceManipulator", "An operator which manipulates a PackingSequence representation.")]
    3131  [StorableClass]
    32   public class PackingSequenceManipulator : PackingSolutionManipulator, IPackingSequenceOperator {
     32  public abstract class PackingSequenceManipulator : PackingSolutionManipulator, IPackingSequenceOperator {
    3333    [StorableConstructor]
    3434    protected PackingSequenceManipulator(bool deserializing) : base(deserializing) { }
     
    3838        EncodedSolutionParameter.ActualName = "PackingSequence";
    3939    }
    40     public override IDeepCloneable Clone(Cloner cloner) {
    41       return new PackingSequenceManipulator(this, cloner);
    42     }
    4340
    44     protected void Manipulate(IRandom random, PackingSequenceEncoding individual) {
    45       Swap2Manipulator.Apply(random, individual.PackingSequence);
    46     }
     41    protected abstract void Manipulate(IRandom random, PackingSequenceEncoding individual);
    4742
    4843    public override IOperation Apply() {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSequence/PackingSequenceRandomCreator.cs

    r9348 r9563  
    6060    public static PackingSequenceEncoding Apply(int items, IRandom random) {
    6161      var solution = new PackingSequenceEncoding();
    62       solution.PackingSequence = new Permutation(PermutationTypes.Absolute, items, random);
    63       return solution;
    64     }
     62      solution.PackingSequence = new Permutation(PermutationTypes.Absolute, items, random);
     63      return solution;
     64    }
    6565
    66     protected override IPackingSolutionEncoding CreateSolution() {
     66    protected override IItem CreateSolution() {
    6767      return Apply(PackingItemsParameter.ActualValue.Value, RandomParameter.ActualValue);
    6868    }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingSolutionCreator.cs

    r9348 r9563  
    3232  public abstract class PackingSolutionCreator : SingleSuccessorOperator, IPackingSolutionCreator {
    3333
    34     public ILookupParameter<IPackingSolutionEncoding> EncodedSolutionParameter {
    35       get { return (ILookupParameter<IPackingSolutionEncoding>)Parameters["EncodedPackingSolution"]; }
     34    public ILookupParameter<IItem> EncodedSolutionParameter {
     35      get { return (ILookupParameter<IItem>)Parameters["EncodedPackingSolution"]; }
    3636    }
    3737
     
    4141    public PackingSolutionCreator()
    4242      : base() {
    43         Parameters.Add(new LookupParameter<IPackingSolutionEncoding>("EncodedPackingSolution", "The new bin packing solution candidate."));
     43        Parameters.Add(new LookupParameter<IItem>("EncodedPackingSolution", "The new bin packing solution candidate."));
    4444    }
    4545
     
    4949    }
    5050
    51     protected abstract IPackingSolutionEncoding CreateSolution();
     51    protected abstract IItem CreateSolution();
    5252  }
    5353}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/Abstract/BinUtilizationRegularIdenticalBinEvaluator.cs

    r9495 r9563  
    6666
    6767      //if (itemPositionsAreValid)
    68       return CalculateBinUtilization(plan as SingleBinSizePackingPlan<D, B, I>, binMeasure, itemMeasures);
     68      return CalculateBinUtilization(plan as PackingPlan<D, B, I>);
    6969
    7070      //return quality;
    7171    }
    7272
    73     public static DoubleValue CalculateBinUtilization(SingleBinSizePackingPlan<D, B, I> plan, B binMeasure, ItemList<I> itemMeasures) {
     73    public static DoubleValue CalculateBinUtilization(PackingPlan<D, B, I> plan) {
    7474      int nrOfBins = plan.NrOfBins;
    7575      double result = 0;
    7676
    77       double usableSpace = binMeasure.MultipliedMeasures;
     77      //for (int i = 0; i < nrOfBins; i++) {
     78      //  double usableSpace = plan.GetPackingBinMeasuresForBinNr(i).MultipliedMeasures;
     79      //  var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
     80      //  var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
     81      //  double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
     82      //  result += (usedSpaceInThisBin / usableSpace);
     83      //}
     84
     85      //result = result / nrOfBins;
     86      //return new DoubleValue (result);
     87
     88      double totalUsedSpace = 0;
     89      double totalUsableSpace = 0;
     90
    7891      for (int i = 0; i < nrOfBins; i++) {
     92        double usableSpace = plan.GetPackingBinMeasuresForBinNr(i).MultipliedMeasures;
    7993        var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
    80         var packedItemsInThisBin = itemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
     94        var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
    8195        double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
    82         result += (usedSpaceInThisBin / usableSpace);
     96        //result += (usedSpaceInThisBin / usableSpace);
     97        totalUsableSpace += usableSpace;
     98        totalUsedSpace += usedSpaceInThisBin;
    8399      }
    84100
    85       result = result / nrOfBins;
    86       return new DoubleValue (result);
     101      result = totalUsedSpace / totalUsableSpace;
     102      return new DoubleValue(result);
    87103    }
    88104  }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Evaluators/Abstract/PackingRatioRegularIdenticalBinEvaluator.cs

    r9473 r9563  
    6666
    6767      //if (itemPositionsAreValid)
    68       return CalculatePackingRatio(plan as PackingPlan<D, B, I>, binMeasure, itemMeasures);
     68      return CalculatePackingRatio(plan as PackingPlan<D, B, I>);
    6969
    7070      //return quality;
     
    8080        k.......a constant, k>1.
    8181     */
    82     public static DoubleValue CalculatePackingRatio(PackingPlan<D, B, I> plan, B binMeasure, ItemList<I> itemMeasures) {
     82    public static DoubleValue CalculatePackingRatio(PackingPlan<D, B, I> plan) {
    8383      int nrOfBins = plan.NrOfBins;
    8484      double result = 0;
    8585
    8686      //C
    87       double usableSpace = binMeasure.MultipliedMeasures;
     87      //double usableSpace = binMeasure.MultipliedMeasures;
    8888      //nrOfBins = N
    8989      for (int i = 0; i < nrOfBins; i++) {
     90        //C
     91        double usableSpace = plan.GetPackingBinMeasuresForBinNr(0).MultipliedMeasures;//plan.GetPackingBinMeasuresForBinNr(i).MultipliedMeasures;
    9092        var indexes = plan.PackingItemPositions.Select((Value, Index) => new { Value, Index }).Where(s => s.Value.Value.AssignedBin == i).Select(s => s.Index);
    91         var packedItemsInThisBin = itemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
     93        var packedItemsInThisBin = plan.PackingItemMeasures.Select((Value, Index) => new { Value, Index }).Where(s => indexes.Contains(s.Index));
    9294        //Fi
    9395        double usedSpaceInThisBin = packedItemsInThisBin.Select(s => s.Value.MultipliedMeasures).Sum();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj

    r9495 r9563  
    181181    <Compile Include="Decoders\3D\DBL\DeepestBottomLeftPackingSequenceDecoder.cs" />
    182182    <Compile Include="Decoders\2D\BL\BottomLeftPackingSequenceDecoder.cs" />
     183    <Compile Include="Decoders\3D\EP\ISOContainerMultiComponentVectorDecoder3D.cs" />
    183184    <Compile Include="Decoders\PackingSolutionDecoder.cs" />
    184     <Compile Include="Encodings\GroupingVector\Moves\SingleGrouping\SingleGroupingMoveSoftTabuCriterion.cs" />
    185     <Compile Include="Encodings\GroupingVector\Moves\SingleGrouping\ExhaustiveSingleGroupingMoveGenerator.cs" />
    186     <Compile Include="Encodings\GroupingVector\Moves\SingleGrouping\SingleGroupingMove.cs" />
    187     <Compile Include="Encodings\GroupingVector\Moves\SingleGrouping\SingleGroupingMoveAttribute.cs" />
    188     <Compile Include="Encodings\GroupingVector\Moves\SingleGrouping\SingleGroupingMoveGenerator.cs" />
    189     <Compile Include="Encodings\GroupingVector\Moves\SingleGrouping\SingleGroupingMoveMaker.cs" />
    190     <Compile Include="Encodings\GroupingVector\Moves\SingleGrouping\SingleGroupingTabuMaker.cs" />
    191     <Compile Include="Encodings\GroupingVector\Moves\SingleGrouping\SingleGroupingMoveHardTabuCriterion.cs" />
    192     <Compile Include="Encodings\GroupingVector\Moves\SingleGrouping\StochasticSingleGroupingMoveGenerator.cs" />
    193     <Compile Include="Encodings\GroupingVector\UniformGroupingVectorManipulator.cs" />
     185    <Compile Include="Encodings\GroupingVector\GroupingVectorSwap2Manipulator.cs" />
     186    <Compile Include="Encodings\GroupingVector\GroupingVectorSinglePointCrossover.cs" />
     187    <Compile Include="Encodings\GroupingVector\GroupingVectorDiscreteCrossover.cs" />
     188    <Compile Include="Encodings\GroupingVector\Moves\GroupingMove.cs" />
     189    <Compile Include="Encodings\GroupingVector\Moves\GroupingMoveAttribute.cs" />
     190    <Compile Include="Encodings\GroupingVector\Moves\SwapGrouping\ExhaustiveSwapGroupingMoveGenerator.cs" />
     191    <Compile Include="Encodings\GroupingVector\Moves\SwapGrouping\SwapGroupingMove.cs" />
     192    <Compile Include="Encodings\GroupingVector\Moves\SwapGrouping\SwapGroupingMoveAttribute.cs" />
     193    <Compile Include="Encodings\GroupingVector\Moves\SwapGrouping\SwapGroupingMoveGenerator.cs" />
     194    <Compile Include="Encodings\GroupingVector\Moves\GroupingMoveMaker.cs" />
     195    <Compile Include="Encodings\GroupingVector\Moves\GroupingTabuMaker.cs" />
     196    <Compile Include="Encodings\GroupingVector\Moves\SwapGrouping\StochasticSwapGroupingMoveGenerator.cs" />
     197    <Compile Include="Encodings\GroupingVector\Moves\GroupingMoveSoftTabuCriterion.cs" />
     198    <Compile Include="Encodings\GroupingVector\Moves\ChangeGrouping\ExhaustiveChangeGroupingMoveGenerator.cs" />
     199    <Compile Include="Encodings\GroupingVector\Moves\ChangeGrouping\ChangeGroupingMove.cs" />
     200    <Compile Include="Encodings\GroupingVector\Moves\ChangeGrouping\ChangeGroupingMoveAttribute.cs" />
     201    <Compile Include="Encodings\GroupingVector\Moves\ChangeGrouping\ChangeGroupingMoveGenerator.cs" />
     202    <Compile Include="Encodings\GroupingVector\Moves\GroupingMoveHardTabuCriterion.cs" />
     203    <Compile Include="Encodings\GroupingVector\Moves\ChangeGrouping\StochasticChangeGroupingMoveGenerator.cs" />
     204    <Compile Include="Encodings\GroupingVector\GroupingVectorOnePositionManipulator.cs" />
    194205    <Compile Include="Encodings\GroupingVector\GroupingVectorCrossover.cs" />
    195206    <Compile Include="Encodings\GroupingVector\GroupingVectorEncoding.cs" />
    196207    <Compile Include="Encodings\GroupingVector\GroupingVectorManipulator.cs" />
    197208    <Compile Include="Encodings\GroupingVector\GroupingVectorRandomCreator.cs" />
    198     <Compile Include="Encodings\MultiComponentVector\SequencePreservingMultiComponentVectorCrossover.cs" />
    199     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\ChangePositionMoveAttribute.cs" />
    200     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\MCVTripleMoveAttribute.cs" />
    201     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\SwapPositionMoveAttribute.cs" />
    202     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\SingleGroupingMoveAttribute.cs" />
    203     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\MultiComponentVectorMoveAttribute.cs" />
    204     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Attributes\SingleItemRotationMoveAttribute.cs" />
    205     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\StochasticMCVTripleMoveGenerator.cs" />
    206     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\ExhaustiveMCVTripleMoveGenerator.cs" />
    207     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\ChangePositionMove.cs" />
    208     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\MCVTripleMove.cs" />
    209     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\MultiComponentVectorMoveHardTabuCriterion.cs" />
    210     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\MultiComponentVectorMove.cs" />
    211     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\SwapPositionMove.cs" />
    212     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\SingleItemRotationMove.cs" />
    213     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\ExhaustiveMultiComponentVectorMoveGenerator.cs" />
    214     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\Moves\SingleGroupingMove.cs" />
    215     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\MultiComponentVectorMoveGenerator.cs" />
    216     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\MultiComponentVectorMoveSoftTabuCriterion.cs" />
    217     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\MultiComponentVectorMoveMaker.cs" />
    218     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\MultiComponentVectorTabuMaker.cs" />
    219     <Compile Include="Encodings\MultiComponentVector\Moves\ThreeWay\StochasticMultiComponentVectorMoveGenerator.cs" />
     209    <Compile Include="Encodings\MultiComponentVector\BinBasedMultiComponentVectorCrossover.cs" />
     210    <Compile Include="Encodings\MultiComponentVector\SequenceBasedMultiComponentVectorCrossover.cs" />
     211    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\Attributes\ChangePositionMoveAttribute.cs" />
     212    <Compile Include="Encodings\MultiComponentVector\Moves\Triple\Attributes\MCVTripleMoveAttribute.cs" />
     213    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\Attributes\SwapPositionMoveAttribute.cs" />
     214    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\Attributes\SingleGroupingMoveAttribute.cs" />
     215    <Compile Include="Encodings\MultiComponentVector\Moves\MultiComponentVectorMoveAttribute.cs" />
     216    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\Attributes\SingleItemRotationMoveAttribute.cs" />
     217    <Compile Include="Encodings\MultiComponentVector\Moves\Triple\StochasticMCVTripleMoveGenerator.cs" />
     218    <Compile Include="Encodings\MultiComponentVector\Moves\Triple\ExhaustiveMCVTripleMoveGenerator.cs" />
     219    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\Moves\ChangePositionMove.cs" />
     220    <Compile Include="Encodings\MultiComponentVector\Moves\Triple\Moves\MCVTripleMove.cs" />
     221    <Compile Include="Encodings\MultiComponentVector\Moves\MultiComponentVectorMoveHardTabuCriterion.cs" />
     222    <Compile Include="Encodings\MultiComponentVector\Moves\MultiComponentVectorMove.cs" />
     223    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\Moves\SwapPositionMove.cs" />
     224    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\Moves\SingleItemRotationMove.cs" />
     225    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\ExhaustiveMultiComponentVectorMoveGenerator.cs" />
     226    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\Moves\SingleGroupingMove.cs" />
     227    <Compile Include="Encodings\MultiComponentVector\Moves\MultiComponentVectorMoveGenerator.cs" />
     228    <Compile Include="Encodings\MultiComponentVector\Moves\MultiComponentVectorMoveSoftTabuCriterion.cs" />
     229    <Compile Include="Encodings\MultiComponentVector\Moves\MultiComponentVectorMoveMaker.cs" />
     230    <Compile Include="Encodings\MultiComponentVector\Moves\MultiComponentVectorTabuMaker.cs" />
     231    <Compile Include="Encodings\MultiComponentVector\Moves\Multi\StochasticMultiComponentVectorMoveGenerator.cs" />
    220232    <Compile Include="Encodings\MultiComponentVector\MultiComponentVectorEncoding.cs">
    221233      <SubType>Code</SubType>
     
    226238    <Compile Include="Encodings\MultiComponentVector\ThreeWayMultiComponentVectorManipulator.cs" />
    227239    <Compile Include="Encodings\PackingPlans\PackingPlan.cs" />
    228     <Compile Include="Encodings\PackingSequence\PackingSequenceCrossover.cs" />
    229     <Compile Include="Encodings\PackingSequence\PackingSequenceManipulator.cs" />
    230     <Compile Include="Encodings\PackingSequence\PackingSequenceEncoding.cs" />
     240    <Compile Include="Encodings\PackingSequence\Moves\Insertion\ExhaustiveInsertionMoveGenerator.cs" />
     241    <Compile Include="Encodings\PackingSequence\Moves\Insertion\StochasticInsertionMoveGenerator.cs" />
     242    <Compile Include="Encodings\PackingSequence\Moves\Insertion\InsertionMove.cs" />
     243    <Compile Include="Encodings\PackingSequence\Moves\Insertion\InsertionMoveAttribute.cs" />
     244    <Compile Include="Encodings\PackingSequence\Moves\Insertion\InsertionMoveGenerator.cs" />
     245    <Compile Include="Encodings\PackingSequence\PackingSequenceInsertionManipulator.cs" />
     246    <Compile Include="Encodings\PackingSequence\PackingSequenceSwap2Manipulator.cs" />
     247    <Compile Include="Encodings\PackingSequence\PackingSequencePartiallyMatchedCrossover.cs" />
     248    <Compile Include="Encodings\PackingSequence\PackingSequenceOrderCrossover.cs" />
     249    <Compile Include="Encodings\PackingSequence\Moves\SequenceMove.cs" />
     250    <Compile Include="Encodings\PackingSequence\Moves\SequenceMoveAttribute.cs" />
     251    <Compile Include="Encodings\PackingSequence\Moves\GroupingMoveHardTabuCriterion.cs" />
     252    <Compile Include="Encodings\PackingSequence\Moves\GroupingMoveMaker.cs" />
     253    <Compile Include="Encodings\PackingSequence\Moves\GroupingMoveSoftTabuCriterion.cs" />
     254    <Compile Include="Encodings\PackingSequence\Moves\SequenceTabuMaker.cs" />
     255    <Compile Include="Encodings\PackingSequence\Moves\Swap2\ExhaustiveSwap2MoveGenerator.cs" />
     256    <Compile Include="Encodings\PackingSequence\Moves\Swap2\StochasticSwap2MoveGenerator.cs" />
     257    <Compile Include="Encodings\PackingSequence\Moves\Swap2\Swap2Move.cs" />
     258    <Compile Include="Encodings\PackingSequence\Moves\Swap2\Swap2MoveAttribute.cs" />
     259    <Compile Include="Encodings\PackingSequence\Moves\Swap2\Swap2MoveGenerator.cs" />
     260    <Compile Include="Encodings\PackingSequence\PackingSequenceCrossover.cs">
     261      <SubType>Code</SubType>
     262    </Compile>
     263    <Compile Include="Encodings\PackingSequence\PackingSequenceEncoding.cs">
     264      <SubType>Code</SubType>
     265    </Compile>
     266    <Compile Include="Encodings\PackingSequence\PackingSequenceManipulator.cs">
     267      <SubType>Code</SubType>
     268    </Compile>
    231269    <Compile Include="Encodings\PackingSequence\PackingSequenceRandomCreator.cs" />
    232270    <Compile Include="Encodings\PackingSolutionCreator.cs" />
     
    235273    <Compile Include="Evaluators\2D\PackingRatioRectangularIdenticalBinEvaluator.cs" />
    236274    <Compile Include="Evaluators\3D\PackingRatioCuboidIdenticalBinEvaluator.cs" />
     275    <Compile Include="Evaluators\Abstract\BinUtilizationRegularIdenticalBinEvaluator.cs" />
    237276    <Compile Include="Evaluators\Abstract\PackingRatioRegularIdenticalBinEvaluator.cs" />
    238277    <Compile Include="Evaluators\Abstract\RegularSimpleRotationIdenticalBinPackingPlanEvaluator.cs" />
     
    245284    <Compile Include="Instances\BPPORLIBParser.cs" />
    246285    <Compile Include="Instances\BPPORLIBDataDescriptor.cs" />
     286    <Compile Include="Instances\RealBPPData.cs" />
     287    <Compile Include="Interfaces\DecoderInterfaces\I2DMCVDecoder.cs" />
     288    <Compile Include="Interfaces\DecoderInterfaces\I3DMCVDecoder.cs" />
     289    <Compile Include="Interfaces\DecoderInterfaces\I2DGVDecoder.cs" />
     290    <Compile Include="Interfaces\DecoderInterfaces\I3DGVDecoder.cs" />
     291    <Compile Include="Interfaces\DecoderInterfaces\I2DPSDecoder.cs" />
     292    <Compile Include="Interfaces\DecoderInterfaces\I3DPSDecoder.cs" />
     293    <Compile Include="Interfaces\IPackingSequenceMoveOperator.cs" />
    247294    <Compile Include="Interfaces\I3DOperator.cs" />
    248295    <Compile Include="Interfaces\I2DOperator.cs" />
     
    265312    <Compile Include="Interfaces\IPackingShape.cs" />
    266313    <Compile Include="Interfaces\IPackingDimensions.cs" />
     314    <Compile Include="MoveEvaluators\PackingMoveEvaluator2DPS.cs" />
     315    <Compile Include="MoveEvaluators\PackingMoveEvaluator3DPS.cs" />
    267316    <Compile Include="MoveEvaluators\PackingMoveEvaluator.cs" />
    268317    <Compile Include="MoveEvaluators\PackingMoveEvaluator2DGV.cs">
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Interfaces/IPackingItem.cs

    r9348 r9563  
    3030  public interface IPackingItem : IPackingShape {
    3131    void AddTargetBinMeasures(int[] targetBinMeasures);
     32    double Weight { get; set; }
     33    int Material { get; set; }
     34    /// <summary>
     35    /// Returns if the "other" item can be stacked on this item.
     36    /// </summary>
     37    /// <param name="other"></param>
     38    /// <returns></returns>
     39    bool SupportsStacking (IPackingItem other);
    3240  }
    3341}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Interfaces/IPackingSolutionCreator.cs

    r9348 r9563  
    2929namespace HeuristicLab.Problems.BinPacking.Interfaces {
    3030  public interface IPackingSolutionCreator : ISolutionCreator{
    31     ILookupParameter<IPackingSolutionEncoding> EncodedSolutionParameter { get; }
     31    ILookupParameter<IItem> EncodedSolutionParameter { get; }
    3232  }
    3333}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/MoveEvaluators/PackingMoveEvaluator.cs

    r9495 r9563  
    9898      CurrentScopeParameter.ActualValue.Variables.Add(new Variable("PackingPlanAfterMove", packingPlan));
    9999
    100       DoubleValue quality = PackingRatioRegularIdenticalBinEvaluator<D, B, I>.CalculatePackingRatio(
    101         packingPlan, PackingBinMeasuresParameter.ActualValue, PackingItemMeasuresParameter.ActualValue);
     100      DoubleValue quality = PackingRatioRegularIdenticalBinEvaluator<D, B, I>.CalculatePackingRatio(packingPlan);
    102101
    103102      double moveQuality = quality.Value;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem/CuboidPackingItem.cs

    r9348 r9563  
    3838
    3939    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    }
    4045
    4146    [StorableConstructor]
     
    4348    protected CuboidPackingItem(CuboidPackingItem original, Cloner cloner)
    4449      : base(original, cloner) {
     50        this.Weight = original.Weight;
     51        this.Material = original.Material;
    4552    }
    4653    public override IDeepCloneable Clone(Cloner cloner) {
     
    5158    }
    5259
     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; }
    5361    public CuboidPackingItem(int width, int height, int depth, CuboidPackingBin targetBin) : base(width, height, depth) { this.TargetBin = new CuboidPackingBin(targetBin.Width, targetBin.Height, targetBin.Depth); }
    5462
     
    5664      TargetBin = new CuboidPackingBin(targetBinMeasures[0], targetBinMeasures[1], targetBinMeasures[2]);
    5765    }
     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    }
    5870  }
    5971}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/PackingItem/RectangularPackingItem.cs

    r9348 r9563  
    3737  public class RectangularPackingItem : RectangularPackingShape, IPackingItem{
    3838
    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    }
    4045
    4146    [StorableConstructor]
     
    4348    protected RectangularPackingItem(RectangularPackingItem original, Cloner cloner)
    4449      : base(original, cloner) {
     50      this.Weight = original.Weight;
     51      this.Material = original.Material;
    4552    }
    4653    public override IDeepCloneable Clone(Cloner cloner) {
     
    4855    }
    4956    public RectangularPackingItem() : base() {
    50 
    5157    }
    5258
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Plugin.cs

    r9495 r9563  
    2626  /// Plugin class for HeuristicLab.Problems.BinPacking plugin.
    2727  /// </summary>
    28   [Plugin("HeuristicLab.Problems.BinPacking", "3.3.7.9473")]
     28  [Plugin("HeuristicLab.Problems.BinPacking", "3.3.7.9495")]
    2929  [PluginFile("HeuristicLab.Problems.BinPacking-3.3.dll", PluginFileType.Assembly)]
    3030  [PluginDependency("HeuristicLab.Common", "3.3")]
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/CuboidIdenticalBinPackingProblem.cs

    r9495 r9563  
    4444using HeuristicLab.Problems.Instances;
    4545using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
     46using HeuristicLab.PluginInfrastructure;
    4647
    4748namespace HeuristicLab.Problems.BinPacking.Problem {
     
    112113    }
    113114    public CuboidIdenticalBinPackingProblem() : base(
    114       new PackingPlanEvaluationAlgorithm<PackingSequenceEncoding, ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>()) {
     115      new PackingPlanEvaluationAlgorithm<Permutation, ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>()) {
    115116    }
    116117
     
    121122      Operators.RemoveAll(op => typeof(I2DOperator).IsAssignableFrom(op.GetType()));
    122123
    123       if (SolutionCreator is PackingSequenceRandomCreator) {
    124         PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder3D();
    125       } else if (SolutionCreator is GroupingVectorRandomCreator) {
    126         PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder3D();
    127       } else if (SolutionCreator is MultiComponentVectorRandomCreator) {
    128         PackingSolutionDecoder = new ExtremePointMultiComponentVectorDecoder3D();
     124      PackingSolutionDecoderParameter.ValidValues.Clear();
     125      if (SolutionCreator is PackingSequenceRandomCreator) {   
     126        PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I3DPSDecoder>());
     127        //PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder3D();
     128      } else if (SolutionCreator is GroupingVectorRandomCreator) {     
     129        PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I3DGVDecoder>());
     130        //PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder3D();
     131      } else if (SolutionCreator is MultiComponentVectorRandomCreator) {   
     132        PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I3DMCVDecoder>());
     133        //PackingSolutionDecoder = ApplicationManager.Manager.GetInstances<ExtremePointMultiComponentVectorDecoder3D>().First();
    129134      } else {
    130135        string error = "The given problem does not support the selected solution-creator.";
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/ISOContainerBinPackingProblem.cs

    r9495 r9563  
    4949  [StorableClass]
    5050  [Creatable("Problems")]
    51   public class ISOContainerBinPackingProblem : RegularIdenticalBinPackingProblem<ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem> {
     51  public class ISOContainerBinPackingProblem : CuboidIdenticalBinPackingProblem {
     52
    5253
    5354    #region Default Instance
    54     private static readonly BPPData DefaultInstance = new BPPData() { 
    55       Name = "3D BPP Default Instance",
    56       Description = "The default instance for 3D Bin Packing.",
     55    private static readonly RealBPPData DefaultInstance = new RealBPPData() { 
     56      Name = "3D BPP with weigthed items Default Instance",
     57      Description = "The default instance for 3D Bin Packing Problem with weighted items.",
    5758      BinMeasures = new int[] {25,25,35},
    5859      ItemMeasures = new int[][] {
     
    99100        new int[] {9,11,9}
    100101      },
    101       Items = 30
     102      Items = 30,
     103      ItemWeights = new double[] {
     104        12*5*10,
     105        10*18*20,
     106        9*7*7,
     107        21*12*4,
     108        8*8*12,
     109        3*6*14,
     110        20*4*9,
     111        5*9*8,
     112        7*17*3,
     113        13*20*15,
     114        9*11*9,
     115        10*18*20,
     116        9*7*7,
     117        21*12*4,
     118        8*8*12,
     119        3*6*14,
     120        20*4*9,
     121        5*9*8,
     122        7*17*3,
     123        13*20*15,
     124        9*11*9,
     125        10*18*20,
     126        9*7*7,
     127        21*12*4,
     128        8*8*12,
     129        3*6*14,
     130        20*4*9,
     131        5*9*8,
     132        7*17*3,
     133        13*20*15,
     134        9*11*9
     135      },
     136      ItemMaterials = new int[] {
     137        1,
     138        0,
     139        0,
     140        1,
     141        0,
     142        0,
     143        1,
     144        1,
     145        0,
     146        1,
     147        1,
     148        0,
     149        0,
     150        1,
     151        0,
     152        0,
     153        1,
     154        1,
     155        0,
     156        1,
     157        1,
     158        0,
     159        0,
     160        1,
     161        0,
     162        0,
     163        1,
     164        1,
     165        0,
     166        1,
     167        1,
     168
     169      }
    102170    };
    103171    #endregion
     
    111179      return new ISOContainerBinPackingProblem(this, cloner);
    112180    }
    113     public ISOContainerBinPackingProblem() : base(
    114       new PackingPlanEvaluationAlgorithm<PackingSequenceEncoding, ThreeDimensionalPacking, CuboidPackingBin, CuboidPackingItem>()) {
     181    public ISOContainerBinPackingProblem()
     182      : base() {
    115183    }
    116184
     
    119187    #region Helpers
    120188    protected override void InitializeDecoder() {
    121       if (SolutionCreator is PackingSequenceRandomCreator) {
    122         PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder3D();
    123       } else if (SolutionCreator is GroupingVectorRandomCreator) {
    124         PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder3D();
    125       } else if (SolutionCreator is MultiComponentVectorRandomCreator) {
    126         PackingSolutionDecoder = new ExtremePointMultiComponentVectorDecoder3D();
     189      Operators.RemoveAll(op => typeof(I2DOperator).IsAssignableFrom(op.GetType()));
     190
     191      PackingSolutionDecoderParameter.ValidValues.Clear();
     192      if (SolutionCreator is MultiComponentVectorRandomCreator) {
     193        PackingSolutionDecoderParameter.ValidValues.Add(new ISOContainerMultiComponentVectorDecoder3D());
    127194      } else {
    128195        string error = "The given problem does not support the selected solution-creator.";
     
    131198    }
    132199
    133     protected override IPackingPlanEvaluator CreateDefaultEvaluator() {
    134       return new PackingRatioCuboidIdenticalBinEvaluator();
    135     }
    136 
    137200    protected override void InitializeProblemData() {
    138201      Load(DefaultInstance);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/RectangularIdenticalBinPackingProblem.cs

    r9495 r9563  
    108108    }
    109109    public RectangularIdenticalBinPackingProblem() : base(
    110       new PackingPlanEvaluationAlgorithm<PackingSequenceEncoding, TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>()) {
     110      new PackingPlanEvaluationAlgorithm<Permutation, TwoDimensionalPacking, RectangularPackingBin, RectangularPackingItem>()) {
    111111    }
    112112
     
    116116      Operators.RemoveAll(op => typeof(I3DOperator).IsAssignableFrom(op.GetType()));
    117117
    118       if (SolutionCreator is PackingSequenceRandomCreator) {
    119         PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder2D();
    120       } else if (SolutionCreator is GroupingVectorRandomCreator) {
    121         PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder2D();
    122       } else if (SolutionCreator is MultiComponentVectorRandomCreator) {
    123         PackingSolutionDecoder = new ExtremePointMultiComponentVectorDecoder2D();
     118      PackingSolutionDecoderParameter.ValidValues.Clear();
     119      if (SolutionCreator is PackingSequenceRandomCreator) {       
     120        PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I2DPSDecoder>());
     121        //PackingSolutionDecoder = new ExtremePointPackingSequenceDecoder2D();
     122      } else if (SolutionCreator is GroupingVectorRandomCreator) { 
     123        PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I2DGVDecoder>());
     124        //PackingSolutionDecoder = new ExtremePointGroupingVectorDecoder2D();
     125      } else if (SolutionCreator is MultiComponentVectorRandomCreator) { 
     126        PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I2DMCVDecoder>());
     127        //PackingSolutionDecoder = new ExtremePointMultiComponentVectorDecoder2D();
    124128      } else {
    125129        string error = "The given problem does not support the selected solution-creator.";
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/RegularIdenticalBinPackingProblem.cs

    r9495 r9563  
    5656      get { return (ValueParameter<B>)Parameters["PackingBinMeasures"]; }
    5757    }
    58     public OptionalValueParameter<IPackingSolutionDecoder> PackingSolutionDecoderParameter {
    59       get { return (OptionalValueParameter<IPackingSolutionDecoder>)Parameters["PackingSolutionDecoder"]; }
     58    public ConstrainedValueParameter<IPackingSolutionDecoder> PackingSolutionDecoderParameter {
     59      get { return (ConstrainedValueParameter<IPackingSolutionDecoder>)Parameters["PackingSolutionDecoder"]; }
    6060    }
    6161    #endregion
     
    8585      Parameters.Add(new ValueParameter<B>("PackingBinMeasures", "Packing-bin data defining the measures of the used bins.", new B()));
    8686      Parameters.Add(new ValueParameter<IPackingPlanEvaluator>("PackingPlanEvaluator", "The evaluator is used to determine the quality of a solution.", CreateDefaultEvaluator()));
    87       Parameters.Add(new OptionalValueParameter<IPackingSolutionDecoder>("PackingSolutionDecoder", "The operator that decodes the representation and creates a packing plan."));
     87      Parameters.Add(new ConstrainedValueParameter<IPackingSolutionDecoder>("PackingSolutionDecoder", "The operator that decodes the representation and creates a packing plan."));
    8888      this.Maximization.Value = true;
    8989      InitializeProblemInstance();
     
    232232
    233233    #region Problem instance handling
    234     public void Load(BPPData data) {
     234    public virtual void Load(BPPData data) {
     235      var realData = data as RealBPPData;
    235236      var binData = new B();
    236237      binData.InitializeFromMeasures (data.BinMeasures);
     
    241242        item.InitializeFromMeasures(data.ItemMeasures[j]);
    242243        item.AddTargetBinMeasures(data.BinMeasures);
     244        if (realData != null) {
     245          item.Weight = realData.ItemWeights[j];
     246          item.Material = realData.ItemMaterials[j];
     247        }
    243248        itemData.Add(item);
    244249      }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Shapes/CuboidPackingShape.cs

    r9440 r9563  
    130130      //Using "Clustered-Area-Height"-comparison as descr
    131131
    132       int result = this.MultipliedMeasures.CompareTo(other.MultipliedMeasures);
     132      int result = (this.Width * this.Depth).CompareTo (other.Width * other.Depth);
     133   
     134    if (result == 0)
     135    result = this.MultipliedMeasures.CompareTo(other.MultipliedMeasures);
    133136      //if (result == 0) {
    134137      //  result = this.Depth.CompareTo(other.Depth) + this.Width.CompareTo(other.Width);
    135138      //  if (result == 0) {       
    136139      //    result = this.Width.CompareTo(other.Width);
    137           if (result == 0)               
    138             result = this.Height.CompareTo(other.Height);
     140    if (result == 0)               
     141    result = this.Height.CompareTo(other.Height);
    139142      //  }
    140143      //}
Note: See TracChangeset for help on using the changeset viewer.