{ "info": { "author": "Benjamin F. Maier", "author_email": "bfmaier@physik.hu-berlin.de", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "binpacking\n==========\n\nThis package contains greedy algorithms to solve two typical bin packing\nproblems, (i) sorting items into a constant number of bins, (ii) sorting\nitems into a low number of bins of constant size. Here's a usage example\n\n.. code:: python\n\n >>> import binpacking\n >>>\n >>> b = { 'a': 10, 'b': 10, 'c':11, 'd':1, 'e': 2,'f':7 }\n >>> bins = binpacking.to_constant_bin_number(b,4) # 4 being the number of bins\n >>> print(\"===== dict\\n\",b,\"\\n\",bins)\n ===== dict\n {'a': 10, 'b': 10, 'c': 11, 'd': 1, 'e': 2, 'f': 7}\n [{'c': 11}, {'b': 10}, {'a': 10}, {'f': 7, 'e': 2, 'd': 1}]\n >>>\n >>> b = list(b.values())\n >>> bins = binpacking.to_constant_volume(b,11) # 11 being the bin volume\n >>> print(\"===== list\\n\",b,\"\\n\",bins)\n ===== list\n [10, 10, 11, 1, 2, 7]\n [[11], [10], [10], [7, 2, 1]]\n\nConsider you have a list of items, each carrying a weight *w\\_i*.\nTypical questions are\n\n#. How can we distribute the items to a minimum number of bins *N* of\n equal volume *V*?\n#. How can we distribute the items to exactly *N* bins where each\n carries items that sum up to approximately equal weight?\n\nProblems like this can easily occur in modern computing. Assume you have\nto run computations where a lot of files of different sizes have to be\nloaded into the memory. However, you only have a machine with 8GB of\nRAM. How should you bind the files such that you have to run your\nprogram a minimum amount of times? This is equivalent to solving problem\n1.\n\nWhat about problem 2? Say you have to run a large number of\ncomputations. For each of the jobs you know the time it will probably\ntake to finish. However, you only have a CPU with 4 cores. How should\nyou distribute the jobs to the 4 cores such that they will all finish at\napproximately the same time?\n\nThe package provides the command line tool \"binpacking\" using which one\ncan easily bin pack csv-files containing a column that can be identified\nwith a weight. To see the usage enter\n\n.. code:: bash\n\n $ binpacking -h\n Usage: binpacking [options]\n\n Options:\n -h, --help show this help message and exit\n -f FILEPATH, --filepath=FILEPATH\n path to the csv-file to be bin-packed\n -V V_MAX, --volume=V_MAX\n maximum volume per bin (constant volume algorithm will\n be used)\n -N N_BIN, --n-bin=N_BIN\n number of bins (constant bin number algorithm will be\n used)\n -c WEIGHT_COLUMN, --weight-column=WEIGHT_COLUMN\n integer (or string) giving the column number (or\n column name in header) where the weight is stored\n -H, --has-header parse this option if there is a header in the csv-file\n -d DELIM, --delimiter=DELIM\n delimiter in the csv-file (use \"tab\" for tabs)\n -q QUOTECHAR, --quotechar=QUOTECHAR\n quotecharacter in the csv-file\n -l LOWER_BOUND, --lower-bound=LOWER_BOUND\n weights below this bound will not be considered\n -u UPPER_BOUND, --upper-bound=UPPER_BOUND\n weights exceeding this bound will not be considered\n\nInstall\n-------\n\n.. code:: bash\n\n pip install binpacking\n\nExamples\n--------\n\nIn the repository's directory\n\n.. code:: bash\n\n cd examples/\n binpacking -f hamlet_word_count.csv -V 2000 -H -c count -l 10 -u 1000\n binpacking -f hamlet_word_count.csv -N 4 -H -c count \n\nor in Python\n\n.. code:: python\n\n import binpacking\n\n b = { 'a': 10, 'b': 10, 'c':11, 'd':1, 'e': 2,'f':7 }\n bins = binpacking.to_constant_bin_number(b,4)\n print(\"===== dict\\n\",b,\"\\n\",bins)\n\n b = list(b.values())\n bins = binpacking.to_constant_volume(b,11)\n print(\"===== list\\n\",b,\"\\n\",bins)", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://www.github.com/benmaier/binpacking", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "binpacking", "package_url": "https://pypi.org/project/binpacking/", "platform": "", "project_url": "https://pypi.org/project/binpacking/", "project_urls": { "Homepage": "https://www.github.com/benmaier/binpacking" }, "release_url": "https://pypi.org/project/binpacking/1.4.1/", "requires_dist": null, "requires_python": "", "summary": "Heuristic distribution of weighted items to bins (either a fixed number of bins or a fixed number of volume per bin). Data may be in form of list, dictionary, list of tuples or csv-file.", "version": "1.4.1" }, "last_serial": 4898756, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "43da4d16eaa6c39ef225d76cce25a610", "sha256": "9bacc9b5a3c1bdab30e8e3ed9a046e185ad7e7cf34923929cbdada8981a45f6f" }, "downloads": -1, "filename": "binpacking-1.0.tar.gz", "has_sig": false, "md5_digest": "43da4d16eaa6c39ef225d76cce25a610", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5126, "upload_time": "2016-04-01T21:46:30", "url": "https://files.pythonhosted.org/packages/d0/eb/7a7e6f4be7376260e97879cf51f1e3b9ff614f31e97355b3e26a587a2535/binpacking-1.0.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "f115c5007be1451aebf9e62cd456bb80", "sha256": "391be11adae73cfeacc1cd2be6642f843b5ac5a06d92d5ab449ffc1dddcec459" }, "downloads": -1, "filename": "binpacking-1.1.tar.gz", "has_sig": false, "md5_digest": "f115c5007be1451aebf9e62cd456bb80", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5437, "upload_time": "2016-04-01T22:04:51", "url": "https://files.pythonhosted.org/packages/51/d6/a26db6fd38fba493c3bfbd51e91b14a985bcc08dcf2900a9fd850f3b8507/binpacking-1.1.tar.gz" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "e7fa91c845894081740cabc91ecce33d", "sha256": "8c9ea06beaaafa4ba13bc98dbafd2d4b482b225a25a6151e62220563faafc324" }, "downloads": -1, "filename": "binpacking-1.2.tar.gz", "has_sig": false, "md5_digest": "e7fa91c845894081740cabc91ecce33d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5446, "upload_time": "2016-04-01T22:13:12", "url": "https://files.pythonhosted.org/packages/9b/e4/a7ee63c0f201c5edb5817e36f964c571112fc00b23e8887bee4b41ac97f4/binpacking-1.2.tar.gz" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "ddf887eb393124cb685f4f370bc0fd49", "sha256": "e8e04302b8e421cd202aed1c76e004d617c71031379db14b4118ffa8c9e39c25" }, "downloads": -1, "filename": "binpacking-1.3.tar.gz", "has_sig": false, "md5_digest": "ddf887eb393124cb685f4f370bc0fd49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5647, "upload_time": "2016-10-26T10:55:56", "url": "https://files.pythonhosted.org/packages/c9/fe/56782753922a195d332d419949f889c1d59cab7b1780db2351bd8b99501c/binpacking-1.3.tar.gz" } ], "1.4": [ { "comment_text": "", "digests": { "md5": "27e51a4df681a7bef35c85bbfe206faa", "sha256": "234e49a9b4f38b05f3ad9f82b29e59578b94e3112a02c26b9d3ecd0bc1fa724c" }, "downloads": -1, "filename": "binpacking-1.4.tar.gz", "has_sig": false, "md5_digest": "27e51a4df681a7bef35c85bbfe206faa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5799, "upload_time": "2019-03-05T10:32:58", "url": "https://files.pythonhosted.org/packages/7a/9a/c336fe2f0546f17d945e6f9f6bc06b8b306d10750b20ec6e12715c32f7f8/binpacking-1.4.tar.gz" } ], "1.4.1": [ { "comment_text": "", "digests": { "md5": "9147f5b5c2be159e1c53292f76f33a5e", "sha256": "f2bd30b341406708305ae29e51959f486bfd3fe68f5b7d1a963489a6353f0cbc" }, "downloads": -1, "filename": "binpacking-1.4.1.tar.gz", "has_sig": false, "md5_digest": "9147f5b5c2be159e1c53292f76f33a5e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7606, "upload_time": "2019-03-05T10:58:38", "url": "https://files.pythonhosted.org/packages/dc/97/7e632f6dcd46c806160211d1e9a5cda1641cbb1a74fb5967024c5aa52ed5/binpacking-1.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9147f5b5c2be159e1c53292f76f33a5e", "sha256": "f2bd30b341406708305ae29e51959f486bfd3fe68f5b7d1a963489a6353f0cbc" }, "downloads": -1, "filename": "binpacking-1.4.1.tar.gz", "has_sig": false, "md5_digest": "9147f5b5c2be159e1c53292f76f33a5e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7606, "upload_time": "2019-03-05T10:58:38", "url": "https://files.pythonhosted.org/packages/dc/97/7e632f6dcd46c806160211d1e9a5cda1641cbb1a74fb5967024c5aa52ed5/binpacking-1.4.1.tar.gz" } ] }