A collection of PARTITION algorithms
Project description
partition package
This is a collection of several algorithms to solve PARTITION.
The package offers two heuristics:
- the naive greedy heuristic
- the Karmakar-Karp heuristic or Largest Differencing Method (LDM) and a complete algorithm,
- the Complete Karmarkar-Karp algorithm.
The latter is also available in a more efficient version for some instances.
Resources on the partition problem
The implementation stem from a project during my master's degree. The resulting thesis is available, feel free to read especially the sections 1 to 3. From the references, I would like to recommend the following publications in particular:
R. E. Korf. A complete anytime algorithm for number partitioning. Artif. Intell., 106(2): 181–203, dec 1998. ISSN 0004-3702. doi:10.1016/S0004-3702(98)00086-1.
B. Hayes. Computing science: The easiest hard problem. American Scientist, 90(2):113–117, 2002. ISSN 00030996. URL http://www.jstor.org/stable/27857621.
S. Mertens. The easiest hard problem: number partitioning. In Computational Complexity and Statistical Physics. Oxford University Press, 12 2005. ISBN 9780195177374. doi:10.1093/oso/9780195177374.003.0012.
Installation and usage
Run pip install partitionpy
to install.
Example code:
import partitionpy
partitionpy.karmarkar_karp([4,5,6,7,8])
partitionpy.naive_greedy([4,5,6,7,8])
partitionpy.complete_karmarkar_karp([4,5,6,7,8])
partitionpy.kernelized_complete_karmarkar_karp([4,5,6,7,8])
partitionpy.complete_greedy([4,5,6,7,8])
Alternatives
This is by far not the only package for PARTITION. You may want to check out numberpartitioning and prtpy as well.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file partitionpy-1.0.0.tar.gz
.
File metadata
- Download URL: partitionpy-1.0.0.tar.gz
- Upload date:
- Size: 632.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 354299749d273c84fa4fefc46183630fa4986180f82f243fdeaee4f398b53930 |
|
MD5 | 35da7144bd13e190494ae6f0d9254989 |
|
BLAKE2b-256 | 63692e646fc10fef7d8d4b78578b0eebd26e6cf2f17872322bb59cad259176c9 |
File details
Details for the file partitionpy-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: partitionpy-1.0.0-py3-none-any.whl
- Upload date:
- Size: 22.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ee80663c7473b77574d66391deea16ecdadb550963da89c5ee9ac689a25b05f |
|
MD5 | eb24f33764201ec197801284d7076e62 |
|
BLAKE2b-256 | 05d36517501c307c3971c5444d3813606b049eb63b23ce4dcd6ed7a88654f577 |