Git Product home page Git Product logo

greedypacker's People

Contributors

pyrige avatar ransomw avatar solomon-b avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

greedypacker's Issues

__new__() got an unexpected keyword argument 'load'

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'

Allow floating point boxes as input instead of just integers?

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!

pip package is broken

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.

How to incorporate constraints into the algorithm?

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.

Create new minor release

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!

Error when try run Guillotine algorithm

How can run demo/matplotlib_demo.py with pack_algo = 'guillotine'?
I try run with guillotine with any heuristic of guillotine but i facing an error when i run with
$ python matplotlib_demo.py:
capture

Bellow my custom code in matplotlib_demo.py:

capture

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.