diff --git a/src/OrientatedItemFactory.php b/src/OrientatedItemFactory.php index 920d6670..1fe4f595 100644 --- a/src/OrientatedItemFactory.php +++ b/src/OrientatedItemFactory.php @@ -323,8 +323,6 @@ protected function calculateAdditionalItemsPackedWithThisOrientation( $depthLeft, $currentRowLengthBeforePacking ) { - $packedCount = 0; - $currentRowLength = max($prevItem->getLength(), $currentRowLengthBeforePacking); $itemsToPack = $nextItems->topN(8); // cap lookahead as this gets recursive and slow @@ -373,9 +371,10 @@ protected function calculateAdditionalItemsPackedWithThisOrientation( $itemsToPack->remove($packedItem); } + $packedCount = $nextItems->count() - $itemsToPack->count(); $this->logger->debug('Lookahead with orientation', ['packedCount' => $packedCount, 'orientatedItem' => $prevItem]); - static::$lookaheadCache[$cacheKey] = $nextItems->count() - $itemsToPack->count(); + static::$lookaheadCache[$cacheKey] = $packedCount; } return static::$lookaheadCache[$cacheKey]; diff --git a/src/VolumePacker.php b/src/VolumePacker.php index e4e8fe4c..a68e3464 100644 --- a/src/VolumePacker.php +++ b/src/VolumePacker.php @@ -108,6 +108,7 @@ public function __construct(Box $box, ItemList $items) } $this->orientatedItemFactory = new OrientatedItemFactory($this->box); + $this->orientatedItemFactory->setLogger($this->logger); } /** @@ -152,7 +153,7 @@ public function pack() $this->stabiliseLayers(); } - $this->logger->debug('done with this box'); + $this->logger->debug('done with this box ' . $this->box->getReference()); return PackedBox::fromPackedItemList($this->box, $this->getPackedItemList()); } @@ -239,6 +240,7 @@ protected function packLayer($startDepth, $widthLeft, $lengthLeft, $depthLeft) public function stabiliseLayers() { $stabiliser = new LayerStabiliser(); + $stabiliser->setLogger($this->logger); $this->layers = $stabiliser->stabilise($this->layers); } diff --git a/src/WorkingVolume.php b/src/WorkingVolume.php index 68bc8ccf..03564692 100644 --- a/src/WorkingVolume.php +++ b/src/WorkingVolume.php @@ -59,7 +59,7 @@ public function __construct( */ public function getReference() { - return 'Working Volume'; + return "Working Volume {$this->width}x{$this->length}x{$this->depth}"; } /**