Free cookie consent management tool by TermsFeed Policy Generator

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

#1966: refactoring: core compiles

File:
1 edited

Legend:

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

    r13606 r13612  
    3737    public BinPacking2D(RectangularPackingBin binMeasures)
    3838      : base(binMeasures) {
    39       //ExtremePoints = new HashSet<TwoDimensionalPacking>();
    4039      ExtremePoints = new SortedSet<TwoDimensionalPacking>(new EPComparer2D());
    4140      ExtremePoints.Add(binMeasures.Origin);
     
    5049      return new BinPacking2D(this, cloner);
    5150    }
    52                      
     51
    5352    protected override void GenerateNewExtremePointsForNewItem(RectangularPackingItem newItem, TwoDimensionalPacking position) {
    5453
     
    7372      if (sourcePointY.X < BinMeasures.Width && sourcePointY.Y < BinMeasures.Height) {
    7473        //Traversing down the x-axis 
    75         while (sourcePointY.X > 0 && !IsPointOccupied(new TwoDimensionalPacking (0,sourcePointY.X - 1, sourcePointY.Y))) {
     74        while (sourcePointY.X > 0 && !IsPointOccupied(new TwoDimensionalPacking(0, sourcePointY.X - 1, sourcePointY.Y))) {
    7675          sourcePointY.X--;
    7776        }
     
    111110        || IsPositionFeasible(measures, TwoDimensionalPacking.MoveDown(currentPosition))) {
    112111        //Slide the item as far as possible to the bottom
    113           while (IsPositionFeasible(measures, TwoDimensionalPacking.MoveDown(currentPosition))) {
    114             currentPosition = TwoDimensionalPacking.MoveDown(currentPosition);
    115         }
    116           if (IsPositionFeasible(measures, TwoDimensionalPacking.MoveLeft(currentPosition)))
     112        while (IsPositionFeasible(measures, TwoDimensionalPacking.MoveDown(currentPosition))) {
     113          currentPosition = TwoDimensionalPacking.MoveDown(currentPosition);
     114        }
     115        if (IsPositionFeasible(measures, TwoDimensionalPacking.MoveLeft(currentPosition)))
    117116          currentPosition = TwoDimensionalPacking.MoveLeft(currentPosition);
    118117      }
     
    120119      return IsPositionFeasible(measures, currentPosition) ? currentPosition : null;
    121120    }
    122    
     121
    123122    public override void SlidingBasedPacking(ref List<int> sequence, ItemList<RectangularPackingItem> itemMeasures) {
    124123      var temp = new List<int>(sequence);
     
    193192
    194193    protected override void InitializeOccupationLayers() {
    195       for (int i = 0; i*10 <= BinMeasures.Width; i += 1 ) {
     194      for (int i = 0; i * 10 <= BinMeasures.Width; i += 1) {
    196195        OccupationLayers[i] = new List<int>();
    197196      }
     
    207206      return OccupationLayers[position.X / 10];
    208207    }
    209     protected override List<int> GetLayerItemIDs(RectangularPackingItem measures, TwoDimensionalPacking position) { 
    210       List<int> result = new List<int> ();
     208    protected override List<int> GetLayerItemIDs(RectangularPackingItem measures, TwoDimensionalPacking position) {
     209      List<int> result = new List<int>();
    211210      int x1 = position.X / 10;
    212211      int x2 = (position.X + (position.Rotated ? measures.Height : measures.Width)) / 10;
Note: See TracChangeset for help on using the changeset viewer.