Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/21/17 11:29:08 (7 years ago)
Author:
abeham
Message:

#2762, #2739: merged revisions 14708, 14709, 14971, 14978, 14979, 15167, 15230, 15233, 15240, 15241, 15276 to stable

Location:
stable
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • stable

  • stable/HeuristicLab.Problems.BinPacking

    • Property svn:mergeinfo set to (toggle deleted branches)
      /trunk/sources/HeuristicLab.Problems.BinPackingmergedeligible
      /branches/1721-RandomForestPersistence/HeuristicLab.Problems.BinPacking10321-10322
      /branches/Algorithms.GradientDescent/HeuristicLab.Problems.BinPacking5516-5520
      /branches/Benchmarking/sources/HeuristicLab.Problems.BinPacking6917-7005
      /branches/BinPackingExtension/HeuristicLab.Problems.BinPacking14835-15229
      /branches/CloningRefactoring/HeuristicLab.Problems.BinPacking4656-4721
      /branches/CodeEditor/HeuristicLab.Problems.BinPacking11700-11806
      /branches/DataAnalysis Refactoring/HeuristicLab.Problems.BinPacking5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Problems.BinPacking5815-6180
      /branches/DataAnalysis/HeuristicLab.Problems.BinPacking4458-4459,​4462,​4464
      /branches/DataPreprocessing/HeuristicLab.Problems.BinPacking10085-11101
      /branches/GP.Grammar.Editor/HeuristicLab.Problems.BinPacking6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Problems.BinPacking5060
      /branches/HLScript/HeuristicLab.Problems.BinPacking10331-10358
      /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Problems.BinPacking11570-12508
      /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Problems.BinPacking6123-9799
      /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Problems.BinPacking11130-12721
      /branches/HiveStatistics/sources/HeuristicLab.Problems.BinPacking12440-12877
      /branches/LogResidualEvaluator/HeuristicLab.Problems.BinPacking10202-10483
      /branches/NET40/sources/HeuristicLab.Problems.BinPacking5138-5162
      /branches/NSGA-II Changes/HeuristicLab.Problems.BinPacking12033-12122
      /branches/ParallelEngine/HeuristicLab.Problems.BinPacking5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.BinPacking7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Problems.BinPacking6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Problems.BinPacking6828
      /branches/RuntimeOptimizer/HeuristicLab.Problems.BinPacking8943-9078
      /branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.BinPacking7787-8333
      /branches/SlaveShutdown/HeuristicLab.Problems.BinPacking8944-8956
      /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Problems.BinPacking10204-10479
      /branches/SuccessProgressAnalysis/HeuristicLab.Problems.BinPacking5370-5682
      /branches/Trunk/HeuristicLab.Problems.BinPacking6829-6865
      /branches/UnloadJobs/HeuristicLab.Problems.BinPacking9168-9215
      /branches/VNS/HeuristicLab.Problems.BinPacking5594-5752
      /branches/crossvalidation-2434/HeuristicLab.Problems.BinPacking12948-12950
      /branches/histogram/HeuristicLab.Problems.BinPacking5959-6341
      /branches/symbreg-factors-2650/HeuristicLab.Problems.BinPacking14232-14825
      /trunk/sources/HeuristicLab.Problems.TestFunctions.MultiObjective/HeuristicLab.Problems.BinPacking14175
  • stable/HeuristicLab.Problems.BinPacking/3.3/2D/BinPacking2D.cs

    r14966 r15278  
    3434    public BinPacking2D(PackingShape binShape)
    3535      : base(binShape) {
    36       ExtremePoints = new SortedSet<PackingPosition>();
    3736      ExtremePoints.Add(binShape.Origin);
    3837      InitializeOccupationLayers();
     
    4140    [StorableConstructor]
    4241    protected BinPacking2D(bool deserializing) : base(deserializing) { }
    43     protected BinPacking2D(BinPacking2D original, Cloner cloner)
    44       : base(original, cloner) {
    45       this.ExtremePoints = new SortedSet<PackingPosition>(original.ExtremePoints.Select(p => cloner.Clone(p)));
    46     }
     42    protected BinPacking2D(BinPacking2D original, Cloner cloner) : base(original, cloner) { }
    4743    public override IDeepCloneable Clone(Cloner cloner) {
    4844      return new BinPacking2D(this, cloner);
     
    8884      };
    8985
    90       int epIndex = 0;
    91       while (epIndex < ExtremePoints.Count && (!IsPositionFeasible(rotatedItem, ExtremePoints.ElementAt(epIndex)))) { epIndex++; }
    92 
    93       if (epIndex < ExtremePoints.Count) {
    94         var currentPoint = ExtremePoints.ElementAt(epIndex);
    95 
    96         var result = new PackingPosition(currentPoint.AssignedBin, currentPoint.X, currentPoint.Y, rotated);
     86      var ep = ExtremePoints.Where(x => IsPositionFeasible(rotatedItem, x, stackingConstraints)).FirstOrDefault();
     87      if (ep != null) {
     88        var result = new PackingPosition(ep.AssignedBin, ep.X, ep.Y, rotated);
    9789        return result;
    9890      }
    9991      return null;
    10092    }
    101     public override PackingPosition FindPositionBySliding(PackingItem item, bool rotated) {
     93    public override PackingPosition FindPositionBySliding(PackingItem item, bool rotated, bool stackingConstraints) {
    10294      PackingPosition currentPosition = new PackingPosition(0,
    10395        BinShape.Width - (rotated ? item.Height : item.Width),
    10496        BinShape.Height - (rotated ? item.Width : item.Height), rotated);
    10597      //Slide the item as far as possible to the left
    106       while (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition))
    107         || IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition))) {
     98      while (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition), stackingConstraints)
     99        || IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition), stackingConstraints)) {
    108100        //Slide the item as far as possible to the bottom
    109         while (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition))) {
     101        while (IsPositionFeasible(item, PackingPosition.MoveDown(currentPosition), stackingConstraints)) {
    110102          currentPosition = PackingPosition.MoveDown(currentPosition);
    111103        }
    112         if (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition)))
     104        if (IsPositionFeasible(item, PackingPosition.MoveLeft(currentPosition), stackingConstraints))
    113105          currentPosition = PackingPosition.MoveLeft(currentPosition);
    114106      }
    115107
    116       return IsPositionFeasible(item, currentPosition) ? currentPosition : null;
    117     }
    118 
    119     public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items) {
     108      return IsPositionFeasible(item, currentPosition, stackingConstraints) ? currentPosition : null;
     109    }
     110
     111    public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, bool stackingConstraints) {
    120112      var temp = new List<int>(sequence);
    121113      for (int i = 0; i < temp.Count; i++) {
    122114        var item = items[temp[i]];
    123         var position = FindPositionBySliding(item, false);
     115        var position = FindPositionBySliding(item, false, stackingConstraints);
    124116        if (position != null) {
    125117          PackItem(temp[i], item, position);
     
    128120      }
    129121    }
    130     public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, Dictionary<int, bool> rotationArray) {
     122    public override void SlidingBasedPacking(ref IList<int> sequence, IList<PackingItem> items, Dictionary<int, bool> rotationArray, bool stackingConstraints) {
    131123      var temp = new List<int>(sequence);
    132124      for (int i = 0; i < temp.Count; i++) {
    133125        var item = items[temp[i]];
    134         var position = FindPositionBySliding(item, rotationArray[temp[i]]);
     126        var position = FindPositionBySliding(item, rotationArray[temp[i]], stackingConstraints);
    135127        if (position != null) {
    136128          PackItem(temp[i], item, position);
     
    150142      }
    151143    }
     144   
    152145    public override void ExtremePointBasedPacking(ref IList<int> sequence, IList<PackingItem> items, bool stackingConstraints, Dictionary<int, bool> rotationArray) {
    153146      var temp = new List<int>(sequence);
     
    186179      throw new NotSupportedException();
    187180    }
    188 
    189181    protected override void InitializeOccupationLayers() {
    190182      for (int i = 0; i * 10 <= BinShape.Width; i += 1) {
  • stable/HeuristicLab.Problems.BinPacking/3.3/2D/IntegerVectorEncoding/BottomLeftIntegerVectorDecoder.cs

    r14170 r15278  
    4747
    4848    protected override PackingPosition FindPositionForItem(BinPacking2D bp, PackingItem item) {
    49       return bp.FindPositionBySliding(item, rotated: false);
     49      return bp.FindPositionBySliding(item, rotated: false, stackingConstraints: false);
    5050    }
    5151
     
    5454      ref IList<int> remainingIDs, IList<PackingItem> items) {
    5555      var bp = new BinPacking2D(partialSolution.BinShape);
    56       bp.SlidingBasedPacking(ref remainingIDs, items);
     56      bp.SlidingBasedPacking(ref remainingIDs, items, stackingConstraints: false);
    5757      return bp;
    5858    }
  • stable/HeuristicLab.Problems.BinPacking/3.3/2D/PermutationEncoding/BottomLeftPermutationDecoder.cs

    r14170 r15278  
    4646      while (remainingIDs.Count > 0) {
    4747        var bp = new BinPacking2D(binShape);
    48         bp.SlidingBasedPacking(ref remainingIDs, items);
     48        bp.SlidingBasedPacking(ref remainingIDs, items, stackingConstraints: false);
    4949        result.Bins.Add(bp);
    5050      }
Note: See TracChangeset for help on using the changeset viewer.