solomon-b / greedypacker Goto Github PK
View Code? Open in Web Editor NEW2D Bin Packing Algorithms
License: Other
2D Bin Packing Algorithms
License: Other
Hi!
I wanted to ask if you could create a new minor release to get the latest fixes in. A project I try to sort out uses greedypacker but installs it via downloading it and fixing f721991 by manually applying it.
Any chance this could be a new minor release it it can be installed via pip?
Cheers!
Any tips on how to work around this?
$ pip install -U greedypacker
Collecting greedypacker
Downloading greedypacker-0.4.tar.gz (17 kB)
Collecting sortedcontainers
Downloading sortedcontainers-2.4.0-py2.py3-none-any.whl (29 kB)
Building wheels for collected packages: greedypacker
Building wheel for greedypacker (setup.py) ... done
Created wheel for greedypacker: filename=greedypacker-0.4-py3-none-any.whl size=14445 sha256=87dcff3680492c11322f18df0ec34b5fa249307eadd7e5b1b3fd71a81a625f9e
Stored in directory: /home/aleksandr/.cache/pip/wheels/5f/19/41/1cb0522b53e10bf6cd9ba35bcacd8ca05559c73e56c48b70ea
Successfully built greedypacker
Installing collected packages: sortedcontainers, greedypacker
Successfully installed greedypacker-0.4 sortedcontainers-2.4.0
$ python3
Python 3.9.5 (default, May 14 2021, 00:00:00)
[GCC 11.1.1 20210428 (Red Hat 11.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import greedypacker
>>> M = greedypacker.BinManager(8, 4, pack_algo='shelf', heuristic='best_width_fit', wastemap=True, rotation=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/aleksandr/knapsack-virtualenv/lib/python3.9/site-packages/greedypacker/binmanager.py", line 58, in __init__
defaultBin = self._bin_factory()
File "/home/aleksandr/knapsack-virtualenv/lib/python3.9/site-packages/greedypacker/binmanager.py", line 131, in _bin_factory
return shelf.Sheet(self.bin_width, self.bin_height, self.rotation, self.wastemap, self.heuristic)
File "/home/aleksandr/knapsack-virtualenv/lib/python3.9/site-packages/greedypacker/shelf.py", line 68, in __init__
self.wastemap = guillotine.Guillotine(0, 0, rotation = self.rotation, heuristic='best_area')
File "/home/aleksandr/knapsack-virtualenv/lib/python3.9/site-packages/greedypacker/guillotine.py", line 56, in __init__
self.freerects = SortedListWithKey(iterable=None, key=lambda x: x.area, load=1000)
TypeError: __new__() got an unexpected keyword argument 'load'
>>> M = greedypacker.BinManager(8, 4, pack_algo='shelf', heuristic='best_width_fit', wastemap=True, rotation=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/aleksandr/knapsack-virtualenv/lib/python3.9/site-packages/greedypacker/binmanager.py", line 58, in __init__
defaultBin = self._bin_factory()
File "/home/aleksandr/knapsack-virtualenv/lib/python3.9/site-packages/greedypacker/binmanager.py", line 131, in _bin_factory
return shelf.Sheet(self.bin_width, self.bin_height, self.rotation, self.wastemap, self.heuristic)
File "/home/aleksandr/knapsack-virtualenv/lib/python3.9/site-packages/greedypacker/shelf.py", line 68, in __init__
self.wastemap = guillotine.Guillotine(0, 0, rotation = self.rotation, heuristic='best_area')
File "/home/aleksandr/knapsack-virtualenv/lib/python3.9/site-packages/greedypacker/guillotine.py", line 56, in __init__
self.freerects = SortedListWithKey(iterable=None, key=lambda x: x.area, load=1000)
TypeError: __new__() got an unexpected keyword argument 'load'
Right now the boxes can only be discrete integers, but it would be very useful for the algorithms to work using floats.
Edit: Nevermind, the moment I posted this I realized I could just use arbitrarily large boxes to get whatever precision I need. Thanks for the repo!
Hello!
Can you point me to the right direction on how to incorporate constraints into the algorithm? Specifically, each bin has a maximum weight, and the algorithm should pack the items taking into account that maximum weight.
Suppose we need to use multiple sheets, is there a way of doing this?
How to reproduce:
pip install greedypacker
import greedypacker
packer = greedypacker.BinManager(canvas[0], canvas[1],
pack_algo='shelf', heuristic='best_width_fit', wastemap=True, rotation=True)
Traceback (most recent call last):
File "C:/Users/---/PycharmProjects/---/test.py", line 9, in pack_test
pack_algo='shelf', heuristic='best_width_fit', wastemap=True, rotation=True)
File "C:\Users\---\PycharmProjects\---\venv\lib\site-packages\greedypacker\binmanager.py", line 58, in __init__
defaultBin = self._bin_factory()
File "C:\Users\---\PycharmProjects\---\venv\lib\site-packages\greedypacker\binmanager.py", line 131, in _bin_factory
return shelf.Sheet(self.bin_width, self.bin_height, self.rotation, self.wastemap, self.heuristic)
File "C:\Users\---\PycharmProjects\---\venv\lib\site-packages\greedypacker\shelf.py", line 68, in __init__
self.wastemap = guillotine.Guillotine(0, 0, rotation = self.rotation, heuristic='best_area')
File "C:\Users\---\PycharmProjects\---\venv\lib\site-packages\greedypacker\guillotine.py", line 56, in __init__
self.freerects = SortedListWithKey(iterable=None, key=lambda x: x.area, load=1000)
TypeError: __new__() got an unexpected keyword argument 'load
Using the source code from this repo I encountered no such errors and all tests ran successfully. As such, fixing this should be as simple as to update the pypi package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.