Changeset 13607


Ignore:
Timestamp:
02/08/16 21:13:43 (6 years ago)
Author:
gkronber
Message:

#1966 refactoring (moved 2d-specific classes into separate project)

Location:
branches/HeuristicLab.BinPacking
Files:
2 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/BL/BottomLeftGroupingVectorDecoder.cs

    r13032 r13607  
    3030using HeuristicLab.Problems.BinPacking.Interfaces;
    3131using HeuristicLab.Encodings.PackingEncoding.GroupingVector;
     32using HeuristicLab.Problems.BinPacking2D;
    3233
    3334namespace HeuristicLab.Problems.BinPacking.Decoders {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/BL/BottomLeftPackingSequenceDecoder.cs

    r13032 r13607  
    3131using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
    3232using HeuristicLab.Problems.BinPacking.Interfaces;
     33using HeuristicLab.Problems.BinPacking2D;
    3334
    3435namespace HeuristicLab.Problems.BinPacking.Decoders {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointGroupingVectorDecoder2D.cs

    r13032 r13607  
    3131using HeuristicLab.Problems.BinPacking.Interfaces;
    3232using HeuristicLab.Encodings.PackingEncoding.GroupingVector;
     33using HeuristicLab.Problems.BinPacking2D;
    3334
    3435namespace HeuristicLab.Problems.BinPacking.Decoders {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointMultiComponentVectorDecoder2D.cs

    r13032 r13607  
    3030using HeuristicLab.Problems.BinPacking.Interfaces;
    3131using HeuristicLab.Encodings.PackingEncoding.MultiComponentVector;
     32using HeuristicLab.Problems.BinPacking2D;
    3233
    3334namespace HeuristicLab.Problems.BinPacking.Decoders {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Decoders/EP/ExtremePointPackingSequenceDecoder2D.cs

    r13032 r13607  
    3131using HeuristicLab.Encodings.PackingEncoding.PackingSequence;
    3232using HeuristicLab.Problems.BinPacking.Interfaces;
     33using HeuristicLab.Problems.BinPacking2D;
    3334
    3435namespace HeuristicLab.Problems.BinPacking.Decoders {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/HeuristicLab.Problems.BinPacking2D-3.3.csproj

    r13606 r13607  
    171171    <Compile Include="MoveEvaluators\PackingMoveEvaluator2DMCV.cs" />
    172172    <Compile Include="MoveEvaluators\PackingMoveEvaluator2DPS.cs" />
     173    <Compile Include="PackingPlan2D.cs" />
    173174    <Compile Include="PackingRatioRectangularIdenticalBinEvaluator.cs" />
    174175    <Compile Include="Plugin.cs" />
     
    185186    <None Include="Plugin.cs.frame" />
    186187  </ItemGroup>
    187   <ItemGroup />
     188  <ItemGroup>
     189    <ProjectReference Include="..\..\HeuristicLab.Problems.BinPacking\3.3\HeuristicLab.Problems.BinPacking-3.3.csproj">
     190      <Project>{F8A55094-3CD5-4034-B0CA-5BD7FFB016D4}</Project>
     191      <Name>HeuristicLab.Problems.BinPacking-3.3</Name>
     192    </ProjectReference>
     193  </ItemGroup>
    188194  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    189195  <PropertyGroup>
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/Interfaces/I2DOperator.cs

    r13606 r13607  
    2020#endregion
    2121
    22 namespace HeuristicLab.Problems.BinPacking.Interfaces {
     22namespace HeuristicLab.Problems.BinPacking2D.Interfaces {
    2323  public interface I2DOperator {
    2424  }
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DGV.cs

    r13606 r13607  
    2828using HeuristicLab.Problems.BinPacking.PackingBin;
    2929using HeuristicLab.Problems.BinPacking.PackingItem;
     30using HeuristicLab.Problems.BinPacking2D.Interfaces;
    3031
    3132namespace HeuristicLab.Problems.BinPacking {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DMCV.cs

    r13606 r13607  
    2828using HeuristicLab.Problems.BinPacking.PackingBin;
    2929using HeuristicLab.Problems.BinPacking.PackingItem;
     30using HeuristicLab.Problems.BinPacking2D.Interfaces;
    3031
    3132namespace HeuristicLab.Problems.BinPacking {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking.2D/3.3/MoveEvaluators/PackingMoveEvaluator2DPS.cs

    r13606 r13607  
    2828using HeuristicLab.Problems.BinPacking.PackingBin;
    2929using HeuristicLab.Problems.BinPacking.PackingItem;
     30using HeuristicLab.Problems.BinPacking2D.Interfaces;
    3031
    3132namespace HeuristicLab.Problems.BinPacking {
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/BinPacking3D.cs

    r13032 r13607  
    5050      return new BinPacking3D(this, cloner);
    5151    }
    52                                        
     52
    5353    protected override void GenerateNewExtremePointsForNewItem(CuboidPackingItem newItem, ThreeDimensionalPacking position) {
    5454      int newWidth = position.Rotated ? newItem.Depth : newItem.Width;
     
    5858      var sourcePointX = new ThreeDimensionalPacking(0, position.X + newWidth, position.Y, position.Z);
    5959      if (sourcePointX.X < BinMeasures.Width && sourcePointX.Y < BinMeasures.Height && sourcePointX.Z < BinMeasures.Depth) {
    60         //Traversing down the y-axis           
     60        //Traversing down the y-axis 
    6161        ThreeDimensionalPacking current = new ThreeDimensionalPacking(0, sourcePointX.X, sourcePointX.Y, sourcePointX.Z);
    62         while (current.Y > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveDown (current))) {
     62        while (current.Y > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveDown(current))) {
    6363          current = ThreeDimensionalPacking.MoveDown(current);
    6464        }
     
    6969        ExtremePoints.Add(current);
    7070
    71         //Traversing down the z-axis                 
     71        //Traversing down the z-axis
    7272        current = new ThreeDimensionalPacking(0, sourcePointX.X, sourcePointX.Y, sourcePointX.Z);
    73         while (current.Z > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveBack (current))) {
     73        while (current.Z > 0 && !IsPointOccupied(ThreeDimensionalPacking.MoveBack(current))) {
    7474          current = ThreeDimensionalPacking.MoveBack(current);
    7575        }
     
    184184        || IsPositionFeasible(measures, ThreeDimensionalPacking.MoveBack(currentPosition))) {
    185185        //Slide the item as far as possible to the left
    186           while (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveLeft(currentPosition))
    187         || IsPositionFeasible(measures, ThreeDimensionalPacking.MoveBack(currentPosition))) {
     186        while (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveLeft(currentPosition))
     187      || IsPositionFeasible(measures, ThreeDimensionalPacking.MoveBack(currentPosition))) {
    188188          //Slide the item as far as possible to the back
    189189          while (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveBack(currentPosition))) {
     
    193193            currentPosition = ThreeDimensionalPacking.MoveLeft(currentPosition);
    194194        }
    195           if (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveDown(currentPosition)))
    196             currentPosition = ThreeDimensionalPacking.MoveDown(currentPosition);
     195        if (IsPositionFeasible(measures, ThreeDimensionalPacking.MoveDown(currentPosition)))
     196          currentPosition = ThreeDimensionalPacking.MoveDown(currentPosition);
    197197      }
    198198
    199199      return IsPositionFeasible(measures, currentPosition) ? currentPosition : null;
    200200    }
    201    
     201
    202202    public override void SlidingBasedPacking(ref List<int> sequence, ItemList<CuboidPackingItem> itemMeasures) {
    203203      var temp = new List<int>(sequence);
     
    244244      }
    245245    }
    246                                                    
     246
    247247    public override int ShortestPossibleSideFromPoint(ThreeDimensionalPacking position) {
    248248
     
    255255        return shortestSide;
    256256
    257       ThreeDimensionalPacking current = new ThreeDimensionalPacking (0, position.X, position.Y, position.Z);
     257      ThreeDimensionalPacking current = new ThreeDimensionalPacking(0, position.X, position.Y, position.Z);
    258258      while (current.X < width && IsPointOccupied(current)) { current = ThreeDimensionalPacking.MoveRight(current); }
    259259      if (current.X - position.X < shortestSide)
     
    262262
    263263      current = new ThreeDimensionalPacking(0, position.X, position.Y, position.Z);
    264       while (current.Y < height && IsPointOccupied(current)) { current = ThreeDimensionalPacking.MoveUp (current); }
     264      while (current.Y < height && IsPointOccupied(current)) { current = ThreeDimensionalPacking.MoveUp(current); }
    265265      if (current.Y - position.Y < shortestSide)
    266266        shortestSide = current.Y - position.Y;
     
    279279        return true;
    280280
    281       if (IsPointOccupied (new ThreeDimensionalPacking (0, position.X, position.Y - 1, position.Z))
    282         && IsPointOccupied (new ThreeDimensionalPacking (0, position.X + item.Width-1, position.Y - 1, position.Z))
    283         && IsPointOccupied (new ThreeDimensionalPacking (0, position.X, position.Y - 1, position.Z + item.Depth-1))
    284         && IsPointOccupied (new ThreeDimensionalPacking (0, position.X + item.Width-1, position.Y - 1, position.Z + item.Depth-1)))
     281      if (IsPointOccupied(new ThreeDimensionalPacking(0, position.X, position.Y - 1, position.Z))
     282        && IsPointOccupied(new ThreeDimensionalPacking(0, position.X + item.Width - 1, position.Y - 1, position.Z))
     283        && IsPointOccupied(new ThreeDimensionalPacking(0, position.X, position.Y - 1, position.Z + item.Depth - 1))
     284        && IsPointOccupied(new ThreeDimensionalPacking(0, position.X + item.Width - 1, position.Y - 1, position.Z + item.Depth - 1)))
    285285        return true;
    286286
     
    316316      }
    317317    }
    318          
     318
    319319    public bool IsSupportedByAtLeastOnePoint(CuboidPackingItem item, ThreeDimensionalPacking position) {
    320320      if (position.Y == 0)
     
    326326          if (IsPointOccupied(new ThreeDimensionalPacking(0, x, y, z)))
    327327            return true;
    328      
     328
    329329      return false;
    330330    }
     
    334334
    335335      if (ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X, ep.Y - 1, ep.Z))].SupportsStacking(item)
    336         && ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X + item.Width-1, ep.Y - 1, ep.Z))].SupportsStacking(item)
    337         && ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X, ep.Y - 1, ep.Z + item.Depth-1))].SupportsStacking(item)
    338         && ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X + item.Width-1, ep.Y - 1, ep.Z + item.Depth-1))].SupportsStacking(item))
     336        && ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X + item.Width - 1, ep.Y - 1, ep.Z))].SupportsStacking(item)
     337        && ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X, ep.Y - 1, ep.Z + item.Depth - 1))].SupportsStacking(item)
     338        && ItemMeasures[PointOccupation(new ThreeDimensionalPacking(0, ep.X + item.Width - 1, ep.Y - 1, ep.Z + item.Depth - 1))].SupportsStacking(item))
    339339        return true;
    340340
    341341      return false;
    342     }   
    343    
     342    }
     343
    344344
    345345    protected override void InitializeOccupationLayers() {
    346       for (int i = 0; i*10 <= BinMeasures.Depth; i += 1) {
     346      for (int i = 0; i * 10 <= BinMeasures.Depth; i += 1) {
    347347        OccupationLayers[i] = new List<int>();
    348348      }
     
    370370  }
    371371  public class EPComparer3D : IComparer<ThreeDimensionalPacking> {
    372     public int Compare(ThreeDimensionalPacking a, ThreeDimensionalPacking b) { 
    373         int result = a.Z.CompareTo (b.Z);
     372    public int Compare(ThreeDimensionalPacking a, ThreeDimensionalPacking b) {
     373      int result = a.Z.CompareTo(b.Z);
    374374      if (result == 0)
    375         result = a.X.CompareTo (b.X);
     375        result = a.X.CompareTo(b.X);
    376376      if (result == 0)
    377377        result = a.Y.CompareTo(b.Y);
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Encodings/PackingPlans/PackingPlan.cs

    r13606 r13607  
    249249    #endregion
    250250  }
    251 
    252 
    253 
    254 
    255 
    256 
    257 
    258251}
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/HeuristicLab.Problems.BinPacking-3.3.csproj

    r13606 r13607  
    299299      <SubType>Code</SubType>
    300300    </Compile>
     301    <Compile Include="PackingPlan3D.cs" />
    301302    <Compile Include="Problem\BinPackingProblem.cs" />
    302303    <Compile Include="Problem\ISOContainerBinPackingProblem.cs" />
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/CuboidIdenticalBinPackingProblem.cs

    r13460 r13607  
    109109    #region Helpers
    110110    protected override void InitializeDecoder() {
    111       Operators.RemoveAll(op => op is I2DOperator);
     111      // Operators.RemoveAll(op => op is I2DOperator); TODO
    112112
    113113      PackingSolutionDecoderParameter.ValidValues.Clear();
  • branches/HeuristicLab.BinPacking/HeuristicLab.Problems.BinPacking/3.3/Problem/ISOContainerBinPackingProblem.cs

    r13460 r13607  
    170170    #region Helpers
    171171    protected override void InitializeDecoder() {
    172       Operators.RemoveAll(op => op is I2DOperator);
     172      // Operators.RemoveAll(op => op is I2DOperator); TODO
    173173
    174174      PackingSolutionDecoderParameter.ValidValues.Clear();
Note: See TracChangeset for help on using the changeset viewer.