Comments (4)
OK, I'll certainly keep this on the list. In the meantime, something that might work for you is using custom sorting - as this works when the vinyl is packed first, depending on your application you can probably enforce that using the mechanism at https://boxpacker.io/en/stable/sortation.html#overriding-the-default-algorithm
$sorter = new CustomItemSorter();
$itemList = new ItemList($sorter);
class CustomItemSorter extends DefaultItemSorter
{
public function compare(Item $itemA, Item $itemB): int
{
if ($itemA->isVinyl()) { // or check a category, or ->getDepth() < 15 or whatever works in your app to identify one
return -1;
}
if ($itemB->isVinyl()) {
return 1;
}
// fall back to regular rules
return parent::compare($itemA, $itemB);
}
}
from boxpacker.
To add more info to this, the item list gets sorted so that the 2nd box gets checked first because it has a greater volume. It then tries several orientations for that box, except just lying it flat, and fails to fit the 1st box. If you bump the depth of the 1st item up to 15 it works fine.
from boxpacker.
Hi, thanks for the minimal testcase - makes it a lot easier to reproduce and debug.
This is one of those ones where I can easily make changes that makes this particular example pack better, but then others end up packing worse - I'll keep seeing if I can find the right heuristic.
Is this just an odd example that you've found, or this a typical scenario for what you're trying to pack with a large flat item that's almost (but not quite), the same dimensions as the box not being put at the bottom?
from boxpacker.
Thanks for looking into this @dvdoug - it's a great package and all other package combinations are working flawlessly.
The issue we're having is with a vinyl record box plus a DVD box set, and the reason for the outer box dimensions.
from boxpacker.
Related Issues (20)
- Is something wrong with single-product packaging with multiple boxes HOT 5
- Partitioned Boxes HOT 3
- Optimize box suggestion by box cost? HOT 1
- Unexpected box packing result HOT 3
- Its not compatible with php 8.1 version HOT 4
- Spaces between items HOT 2
- Request for Information on Streamlining Product Packing HOT 17
- Can't initialize class (not found). Composer problem? HOT 1
- Uncaught Error: Class "DVDoug\BoxPacker\Test\TestBox" not found (composer/3.12.0)
- Optimizer error HOT 5
- does it has a web service interface ? HOT 1
- Separate Visualiser and BoxPacker
- $packedBoxes only contains one box HOT 2
- Uncaught Error - Classes not found? HOT 1
- Item interface and description property HOT 1
- Feature request: Support for decimals / floating point values HOT 2
- More emphasis on box emptyWeight HOT 1
- Not optimal packing in a box HOT 7
- Diagonal rotations HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from boxpacker.