Skip to main content

Solves a variety of knapsack problems

Project description

Build Status

knapsack_python: Solves a variety of knapsack problems

This package is a collection of solutions to various knapsack problems. In particular, it has solutions to:

  • the 01 knapsack problem,

  • the 01 multi-knapsack problem (MKP),

and potentially more in the future. A good introduction to these sorts of problems can be found on Wikipedia (here and here). Additionally, it contains functions I’ve found useful in my work. One such function is assign_all, which assigns all items to one or more knapsacks while trying to adhere as best as possible to the capacities of each knapsack. Most of the solutions are a direct translation of the solutions given in Silvano Martello and Paolo Toth excellent book *Knapsack Problems: Algorithms and Computer Implementations*.

The implementations of these solutions are all written in C++ and wrapped in Cython for use in Python.

Quickstart

  • pip install knapsack_python

or

Example

Dependencies

  • numpy

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

knapsack_python-0.1.2.tar.gz (387.5 kB view details)

Uploaded Source

File details

Details for the file knapsack_python-0.1.2.tar.gz.

File metadata

File hashes

Hashes for knapsack_python-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e37cf6bd65a9fe19c6e59ec39979a42541c5736a5515cfc2f6cdd2c1a922b4ab
MD5 dfa9fdd42558dfef51cce0976b1fc4be
BLAKE2b-256 98631a98a1dd703ff401f898338efb916a5914d1d15b22688a76617e077a0278

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page