Skip to main content

Framework for solving the Quadratic Multiple Knapsack Problem (QMKP)

Project description

QMKPy: A Python Framework for the Quadratic Multiple Knapsack Problem

Pytest codecov Read the docs status PyPI License

This software package primarily aims at research in the areas of operations research and optimization. It provides a way of quickly implementing and testing new algorithms to solve the quadratic multiple knapsack problem (QMKP) and compare it with existing solutions.

Problem Description

The QMKP is defined as the following combinatorial optimization problem

$$ \begin{alignat}{3} \max\quad & \sum_{u\in\mathcal{K}}\Bigg(\sum_{i\in\mathcal{A}(u)} p_{i} &+&\sum_{\substack{j\in\mathcal{A}(u), \ j\neq i}} p_{ij}\Bigg)\ \mathrm{s.t.}\quad & \sum_{i\in\mathcal{A}(u)} w_{i} \leq c_u & \quad & \forall u\in\mathcal{K} \ & \sum_{u=1}^{K} a_{iu} \leq 1 & & \forall 1\leq i \leq N \end{alignat} $$

This describes an assignment problem where one wants to assign $N$ items to $K$ knapsacks. If item $i$ is assigned to a knapsack, it yields the profit $p_i$. If item $j$ (with $j\neq i$ ) is assigned to the same knapsack, we get the additional joint profit $p_{ij}$.

Features

  • Quick and simple creation of QMKP instances
  • Saving/loading of problem instances for a simple creation and use of reference datasets
  • Easy implementation of novel algorithms to solve the QMKP
  • High reproducibility and direct comparison between different algorithms

Installation

The package can easily be installed via pip. Either from the PyPI

pip3 install qmkpy

or from the GitHub repository

git clone https://github.com/klb2/qmkpy.git
cd qmkpy
git checkout dev  # optional for the latest development version
pip3 install .

Usage

In order to test the installation and get an idea of how to use the QMKPy package, you can take a look at the examples/ directory. It contains some standalone scripts that can be executed and perform some simple tasks.

More detailed descriptions of the implemented algorithms and a documentation of the API can be found in the documentation.

A collection of reference datasets can be found at https://github.com/klb2/qmkpy-datasets.

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

qmkpy-1.1.0.tar.gz (26.6 kB view hashes)

Uploaded Source

Built Distribution

qmkpy-1.1.0-py3-none-any.whl (28.1 kB view hashes)

Uploaded Python 3

Supported by

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