Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/20/16 14:02:36 (8 years ago)
Author:
gkronber
Message:

#1966: refactoring of bin packing implementation

Location:
branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/BinPacking2D.cs

    r14055 r14128  
    6666
    6767      //Find ExtremePoints beginning from sourcepointY
    68       var sourcePointY = new PackingPosition(0, position.X, position.Y + newItem.Height);
     68      var sourcePointY = new PackingPosition(0, position.X, position.Y + newHeight);
    6969      if (sourcePointY.X < BinMeasures.Width && sourcePointY.Y < BinMeasures.Height) {
    7070        //Traversing down the x-axis 
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/BL/BottomLeftPackingSequenceDecoder.cs

    r14049 r14128  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Common;
    27 using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
    2827using HeuristicLab.Problems.BinPacking;
    2928using HeuristicLab.Encodings.PackingEncoding;
     29using HeuristicLab.Encodings.PermutationEncoding;
    3030
    3131namespace HeuristicLab.Problems.BinPacking2D {
     
    4545
    4646    public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) {
    47       var solution = encodedSolution as PackingSequenceEncoding;
     47      var solution = encodedSolution as Permutation;
    4848      if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence");
    4949      Solution result = new Solution(binMeasures);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointMultiComponentVectorDecoder2D.cs

    r14049 r14128  
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Common;
    26 using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
    2726using HeuristicLab.Problems.BinPacking;
    2827using HeuristicLab.Encodings.PackingEncoding;
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointPackingSequenceDecoder2D.cs

    r14049 r14128  
    2525using HeuristicLab.Core;
    2626using HeuristicLab.Common;
    27 using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
    2827using HeuristicLab.Problems.BinPacking;
    2928using HeuristicLab.Encodings.PackingEncoding;
     29using HeuristicLab.Encodings.PermutationEncoding;
    3030
    3131namespace HeuristicLab.Problems.BinPacking2D {
     
    4545
    4646    public override PackingPlan<PackingPosition, PackingShape, PackingItem> CreatePackingPlanFromEncoding(IItem encodedSolution, PackingShape binMeasures, ItemList<PackingItem> itemMeasures) {
    47       var solution = encodedSolution as PackingSequenceEncoding;
    48       if (solution == null) throw new InvalidOperationException("Encoding is not of type PackingSequence");
     47      var solution = encodedSolution as Permutation;
     48      if (solution == null) throw new InvalidOperationException("Encoding is not of type Permutation");
    4949      Solution result = new Solution(binMeasures, true, false);
    5050      result.Pack(solution, itemMeasures);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/HeuristicLab.Problems.BinPacking2D-3.3.csproj

    r14063 r14128  
    163163  <ItemGroup>
    164164    <Compile Include="BinPacking2D.cs" />
    165     <Compile Include="Decoders\BL\BottomLeftGroupingVectorDecoder.cs" />
    166     <Compile Include="Decoders\BL\BottomLeftMultiComponentVectorDecoder.cs" />
    167     <Compile Include="Decoders\BL\BottomLeftPackingSequenceDecoder.cs" />
    168     <Compile Include="Decoders\EP\ExtremePointGroupingVectorDecoder2D.cs" />
    169     <Compile Include="Decoders\EP\ExtremePointMultiComponentVectorDecoder2D.cs" />
    170     <Compile Include="Decoders\EP\ExtremePointPackingSequenceDecoder2D.cs" />
     165    <Compile Include="Decoders\EP\ExtremePointPackingSequenceDecoder2D.cs">
     166      <SubType>Code</SubType>
     167    </Compile>
    171168    <Compile Include="Instances\BPPData.cs" />
    172169    <Compile Include="Instances\RandomDataDescriptor.cs" />
     
    176173    <Compile Include="Interfaces\I2DOperator.cs" />
    177174    <Compile Include="Interfaces\I2DPSDecoder.cs" />
    178     <Compile Include="MoveEvaluators\PackingMoveEvaluator2DGV.cs" />
    179     <Compile Include="MoveEvaluators\PackingMoveEvaluator2DMCV.cs" />
    180     <Compile Include="MoveEvaluators\PackingMoveEvaluator2DPS.cs" />
    181175    <Compile Include="PackingItem.cs" />
    182176    <Compile Include="PackingPosition.cs" />
    183177    <Compile Include="PackingRatioEvaluator.cs" />
     178    <Compile Include="PackingSequenceProblem.cs" />
    184179    <Compile Include="PackingShape.cs" />
    185180    <Compile Include="Plugin.cs" />
    186     <Compile Include="Problem.cs" />
    187181    <Compile Include="Properties\AssemblyInfo.cs" />
    188182    <Compile Include="Solution.cs" />
     
    198192      <Name>HeuristicLab.Problems.BinPacking-3.3</Name>
    199193    </ProjectReference>
     194  </ItemGroup>
     195  <ItemGroup>
     196    <Folder Include="Decoders\BL\" />
     197    <Folder Include="MoveEvaluators\" />
    200198  </ItemGroup>
    201199  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DGV.cs

    r14049 r14128  
    2929  [Item("GroupingVectorMoveEvaluator2D", "Class for evaluating packing moves for 2dimensional problems.")]
    3030  [StorableClass]
    31   public class PackingMoveEvaluator2DGV : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I2DOperator {
     31  public class PackingMoveEvaluator2DGV<T> : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem, T>, ISingleObjectiveMoveEvaluator, IGroupingVectorMoveOperator, I2DOperator
     32  where T : class , IItem {
    3233    [StorableConstructor]
    3334    protected PackingMoveEvaluator2DGV(bool deserializing) : base(deserializing) { }
    34     protected PackingMoveEvaluator2DGV(PackingMoveEvaluator2DGV original, Cloner cloner)
     35    protected PackingMoveEvaluator2DGV(PackingMoveEvaluator2DGV<T> original, Cloner cloner)
    3536      : base(original, cloner) {
    3637    }
    3738    public override IDeepCloneable Clone(Cloner cloner) {
    38       return new PackingMoveEvaluator2DGV(this, cloner);
     39      return new PackingMoveEvaluator2DGV<T>(this, cloner);
    3940    }
    4041    public PackingMoveEvaluator2DGV()
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DMCV.cs

    r14049 r14128  
    2929  [Item("MultiComponentVectorMoveEvaluator2D", "Class for evaluating packing moves for 2dimensional problems.")]
    3030  [StorableClass]
    31   public class PackingMoveEvaluator2DMCV : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I2DOperator {
     31  public class PackingMoveEvaluator2DMCV<T> : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem, T>, ISingleObjectiveMoveEvaluator, IMultiComponentVectorMoveOperator, I2DOperator
     32  where T : class, IItem {
    3233    [StorableConstructor]
    3334    protected PackingMoveEvaluator2DMCV(bool deserializing) : base(deserializing) { }
    34     protected PackingMoveEvaluator2DMCV(PackingMoveEvaluator2DMCV original, Cloner cloner)
     35    protected PackingMoveEvaluator2DMCV(PackingMoveEvaluator2DMCV<T> original, Cloner cloner)
    3536      : base(original, cloner) {
    3637    }
    3738    public override IDeepCloneable Clone(Cloner cloner) {
    38       return new PackingMoveEvaluator2DMCV(this, cloner);
     39      return new PackingMoveEvaluator2DMCV<T>(this, cloner);
    3940    }
    4041    public PackingMoveEvaluator2DMCV()
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DPS.cs

    r14049 r14128  
    2929  [Item("PackingSequenceMoveEvaluator2D", "Class for evaluating packing moves for 2dimensional problems.")]
    3030  [StorableClass]
    31   public class PackingMoveEvaluator2DPS : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I2DOperator {
     31  public class PackingMoveEvaluator2DPS<T> : PackingMoveEvaluator<PackingPosition, PackingShape, PackingItem, T>, ISingleObjectiveMoveEvaluator, IPackingSequenceMoveOperator, I2DOperator
     32  where T : class, IItem {
    3233    [StorableConstructor]
    3334    protected PackingMoveEvaluator2DPS(bool deserializing) : base(deserializing) { }
    34     protected PackingMoveEvaluator2DPS(PackingMoveEvaluator2DPS original, Cloner cloner)
     35    protected PackingMoveEvaluator2DPS(PackingMoveEvaluator2DPS<T> original, Cloner cloner)
    3536      : base(original, cloner) {
    3637    }
    3738    public override IDeepCloneable Clone(Cloner cloner) {
    38       return new PackingMoveEvaluator2DPS(this, cloner);
     39      return new PackingMoveEvaluator2DPS<T>(this, cloner);
    3940    }
    4041    public PackingMoveEvaluator2DPS()
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Problem.cs

    r14055 r14128  
    2626using HeuristicLab.PluginInfrastructure;
    2727using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
    28 using HeuristicLab.Encodings.PackingEncoding.GroupingVector;
    2928using HeuristicLab.Problems.Instances;
    30 using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
    3129using HeuristicLab.Data;
    32 using System;
    3330using HeuristicLab.Problems.BinPacking;
    3431
     
    3734  [StorableClass]
    3835  [Creatable(CreatableAttribute.Categories.CombinatorialProblems, Priority = 300)]
    39   // TODO: only support 2d BPPData
    4036  public class Problem : Problem<PackingPosition, PackingShape, PackingItem>, IProblemInstanceConsumer<BPPData>, IProblemInstanceExporter<BPPData> {
    4137
     
    131127      if (SolutionCreator is PackingSequenceRandomCreator) {
    132128        PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I2DPSDecoder>());
    133       } else if (SolutionCreator is GroupingVectorRandomCreator) {
     129      } /*else if (SolutionCreator is GroupingVectorRandomCreator) {
    134130        PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I2DGVDecoder>());
    135131      } else if (SolutionCreator is MultiComponentVectorRandomCreator) {
    136132        PackingSolutionDecoderParameter.ValidValues.UnionWith(ApplicationManager.Manager.GetInstances<I2DMCVDecoder>());
    137       } else {
     133      } */ else {
    138134        string error = "The given problem does not support the selected solution-creator.";
    139135        ErrorHandling.ShowErrorDialog(error, null);
Note: See TracChangeset for help on using the changeset viewer.