Skip to main content

partition package

This is a collection of several algorithms to solve PARTITION.

test lint mypy coverage

The package offers two heuristics:

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.

Metadata

Release files for partitionpy 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for partitionpy 1.0.0
File Size Uploaded Provenance Actions
partitionpy-1.0.0.tar.gz 632.8 kB Without provenance Details for partitionpy-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for partitionpy 1.0.0
File Interpreter ABI Platform Actions
partitionpy-1.0.0-py3-none-any.whl Python 3 none any Details for partitionpy-1.0.0-py3-none-any.whl

Total release size: 655.1 kB

Release files / partitionpy-1.0.0.tar.gz

Download URL partitionpy-1.0.0.tar.gz
Size 632.8 kB
Tags Source
SHA-256 checksum
How to use checksums
354299749d273c84fa4fefc46183630fa4986180f82f243fdeaee4f398b53930
BLAKE2b-256 checksum
How to use checksums
63692e646fc10fef7d8d4b78578b0eebd26e6cf2f17872322bb59cad259176c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / partitionpy-1.0.0-py3-none-any.whl

Download URL partitionpy-1.0.0-py3-none-any.whl
Size 22.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ee80663c7473b77574d66391deea16ecdadb550963da89c5ee9ac689a25b05f
BLAKE2b-256 checksum
How to use checksums
05d36517501c307c3971c5444d3813606b049eb63b23ce4dcd6ed7a88654f577
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Security for partitionpy 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page