QMKPy

QMKPy: A Python Testbed for the Quadratic Multiple Knapsack Problem - Published in JOSS (2022)

https://github.com/klb2/qmkpy

Science Score: 95.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org
  • Committers with academic emails
    2 of 3 committers (66.7%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords

knapsack-problem multiple-knapsack-problem operations-research optimization python qmkp qmkpy quadractic-multiple-knapsack-problem quadratic-knapsack-problem
Last synced: 4 months ago · JSON representation

Repository

Python testbed for the Quadratic Multiple Knapsack Problem (QMKP)

Basic Info
Statistics
  • Stars: 8
  • Watchers: 1
  • Forks: 2
  • Open Issues: 0
  • Releases: 1
Topics
knapsack-problem multiple-knapsack-problem operations-research optimization python qmkp qmkpy quadractic-multiple-knapsack-problem quadratic-knapsack-problem
Created over 3 years ago · Last pushed over 2 years ago
Metadata Files
Readme Changelog Contributing License

README.md

QMKPy: A Python Testbed for the Quadratic Multiple Knapsack Problem

Pytest codecov Read the docs status PyPI License status

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

The goal is to encourage researchers and developers to share their algorithms and make them publicly available.

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 cu & \quad & \forall u\in\mathcal{K} \ & \sum{u=1}^{K} a{iu} \leq 1 & & \forall i \in {1, 2, \dots, N} \end{alignat} $$

This describes an assignment problem where one wants to assign $N\in\mathbb{N}$ items to $K\in\mathbb{N}$ knapsacks, which are described by the index set $\mathcal{K}={1, 2, \dots, K}$. Item $i$ has the weight $wi\in\mathbb{R+}$ and knapsack $u$ has the weight capacity $cu\mathbb{R+}$. If item $i$ is assigned to a knapsack, it yields the (non-negative) profit $pi\in\mathbb{R+}$. If item $j$ (with $j\neq i$ ) is assigned to the same knapsack, we get the additional joint profit $p{ij}\in\mathbb{R+}$.

The set of items which are assigned to knapsack $u$ is denoted by $\mathcal{A}(u)$ and $a_{iu}\in{0, 1}$ is an indicator whether item $i$ is assigned to knapsack $u$.

The objective of the above problem is to maximize the total profit such that each item is assigned to at most one knapsack and such that the weight capacity constraints of the knapsacks are not violated.

Remark: The profits $p$ are also referred to as "values" in the literature.

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

The benefit of enabling a simple and direct way of implementing novel algorithms is highlighted by an example in the provided Jupyter notebook in examples/Custom Algorithm.ipynb.
Binder

Installation

The package can easily be installed via pip. Either from the PyPI bash pip3 install qmkpy or from the GitHub repository bash git clone https://github.com/klb2/qmkpy.git cd qmkpy git checkout dev # optional for the latest development version pip3 install -r requirements.txt pip3 install . pip3 install pytest # optional if you want to run the unit tests

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.

Contributing

Please see CONTRIBUTING.md for guidelines on how to contribute to this project. In particular, novel algorithms are always welcome. Please check out the documentation for a brief overview on how to implement new algorithms for the QMKPy framework.

Owner

  • Name: Karl-Ludwig Besser
  • Login: klb2
  • Kind: user
  • Location: USA
  • Company: Princeton University

Postdoc at Princeton University in the area of wireless communications. My research interests lie in the areas of ultra-reliable communications and copulas.

JOSS Publication

QMKPy: A Python Testbed for the Quadratic Multiple Knapsack Problem
Published
November 02, 2022
Volume 7, Issue 79, Page 4718
Authors
Karl-Ludwig Besser ORCID
Institute for Communications Technology, Technische Universität Braunschweig, Germany
Eduard A. Jorswieck ORCID
Institute for Communications Technology, Technische Universität Braunschweig, Germany
Editor
Mehmet Hakan Satman ORCID
Tags
knapsack problems QMKP operations research combinatorial optimization

GitHub Events

Total
Last Year

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 109
  • Total Committers: 3
  • Avg Commits per committer: 36.333
  • Development Distribution Score (DDS): 0.018
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
KLB k****r@t****e 107
Mehmet Hakan Satman m****n@g****m 1
Daniel S. Katz d****z@i****g 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 18
  • Total pull requests: 2
  • Average time to close issues: 13 days
  • Average time to close pull requests: about 6 hours
  • Total issue authors: 3
  • Total pull request authors: 2
  • Average comments per issue: 1.06
  • Average comments per pull request: 1.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • ulf1 (10)
  • max-little (7)
  • ngocbh (1)
Pull Request Authors
  • jbytecode (1)
  • danielskatz (1)
Top Labels
Issue Labels
bug (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 31 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 2
  • Total versions: 3
  • Total maintainers: 1
pypi.org: qmkpy

Framework for solving the Quadratic Multiple Knapsack Problem (QMKP)

  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 31 Last month
Rankings
Dependent packages count: 10.1%
Dependent repos count: 11.5%
Forks count: 19.2%
Stargazers count: 21.6%
Average: 24.4%
Downloads: 59.5%
Maintainers (1)
klb
Last synced: 4 months ago

Dependencies

examples/requirements.txt pypi
  • matplotlib *
  • qmkpy *
requirements.txt pypi
  • numpy *
setup.py pypi
  • numpy *
.github/workflows/documentation.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • actions/upload-artifact v3 composite
.github/workflows/pytest.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v3 composite