{"id":34056687,"url":"https://github.com/klb2/qmkpy","last_synced_at":"2025-12-14T03:01:32.930Z","repository":{"id":53117957,"uuid":"504215124","full_name":"klb2/qmkpy","owner":"klb2","description":"Python testbed for the Quadratic Multiple Knapsack Problem (QMKP)","archived":false,"fork":false,"pushed_at":"2023-04-04T03:10:50.000Z","size":221,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-31T05:21:54.483Z","etag":null,"topics":["knapsack-problem","multiple-knapsack-problem","operations-research","optimization","python","qmkp","qmkpy","quadractic-multiple-knapsack-problem","quadratic-knapsack-problem"],"latest_commit_sha":null,"homepage":"https://qmkpy.readthedocs.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/klb2.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-06-16T15:46:51.000Z","updated_at":"2024-07-15T10:43:14.000Z","dependencies_parsed_at":"2025-04-14T14:47:45.982Z","dependency_job_id":null,"html_url":"https://github.com/klb2/qmkpy","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/klb2/qmkpy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klb2%2Fqmkpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klb2%2Fqmkpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klb2%2Fqmkpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klb2%2Fqmkpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/klb2","download_url":"https://codeload.github.com/klb2/qmkpy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/klb2%2Fqmkpy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27716179,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["knapsack-problem","multiple-knapsack-problem","operations-research","optimization","python","qmkp","qmkpy","quadractic-multiple-knapsack-problem","quadratic-knapsack-problem"],"created_at":"2025-12-14T03:01:27.245Z","updated_at":"2025-12-14T03:01:29.765Z","avatar_url":"https://github.com/klb2.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# QMKPy: A Python Testbed for the Quadratic Multiple Knapsack Problem\n\n[![Pytest](https://github.com/klb2/qmkpy/actions/workflows/pytest.yml/badge.svg)](https://github.com/klb2/qmkpy/actions/workflows/pytest.yml)\n[![codecov](https://codecov.io/gh/klb2/qmkpy/branch/master/graph/badge.svg?token=NFBF1ZZEXQ)](https://codecov.io/gh/klb2/qmkpy)\n[![Read the docs status](https://readthedocs.org/projects/qmkpy/badge/?version=latest\u0026style=flat)](https://qmkpy.readthedocs.io)\n[![PyPI](https://img.shields.io/pypi/v/qmkpy)](https://pypi.org/project/qmkpy/)\n![License](https://img.shields.io/github/license/klb2/qmkpy)\n[![status](https://joss.theoj.org/papers/7e886b9c686dc93f8ac85aef9f4fb5bd/status.svg)](https://joss.theoj.org/papers/7e886b9c686dc93f8ac85aef9f4fb5bd)\n\n\nThis software package primarily aims at research in the areas of operations\nresearch and optimization.\nIt serves as a testbed that provides a way of quickly implementing and testing\nnew algorithms to solve the quadratic multiple knapsack problem (QMKP) and\ncompare it with existing solutions.\n\nThe goal is to encourage researchers and developers to share their algorithms\nand make them publicly available.\n\n\n## Problem Description\nThe QMKP is defined as the following combinatorial optimization problem\n\n$$\n\\begin{alignat}{3}\n\t\\max\\quad \u0026 \\sum_{u\\in\\mathcal{K}}\\Bigg(\\sum_{i\\in\\mathcal{A}(u)} p_{i} \u0026+\u0026\\sum_{\\substack{j\\in\\mathcal{A}(u), \\\\ j\\neq i}} p_{ij}\\Bigg)\\\\\n\t\\mathrm{s.t.}\\quad \u0026 \\sum_{i\\in\\mathcal{A}(u)} w_{i} \\leq c_u \u0026 \\quad \u0026 \\forall u\\in\\mathcal{K} \\\\\n\t\u0026 \\sum_{u=1}^{K} a_{iu} \\leq 1  \u0026 \u0026 \\forall i \\in \\{1, 2, \\dots, N\\}\n\\end{alignat}\n$$\n\nThis describes an assignment problem where one wants to assign $N\\in\\mathbb{N}$\nitems to $K\\in\\mathbb{N}$ knapsacks, which are described by the index set\n$\\mathcal{K}=\\{1, 2, \\dots, K\\}$.\nItem $i$ has the weight $w_i\\in\\mathbb{R_+}$ and knapsack $u$ has the weight\ncapacity $c_u\\mathbb{R_+}$.\nIf item $i$ is assigned to a knapsack, it yields the (non-negative) profit\n$p_i\\in\\mathbb{R_+}$.\nIf item $j$ (with $j\\neq i$ ) is assigned _to the same_ knapsack, we get the\nadditional joint profit $p_{ij}\\in\\mathbb{R_+}$.\n\nThe set of items which are assigned to knapsack $u$ is denoted by\n$\\mathcal{A}(u)$ and $a_{iu}\\in\\{0, 1\\}$ is an indicator whether item $i$ is\nassigned to knapsack $u$.\n\nThe objective of the above problem is to maximize the total profit such that\neach item is assigned to at most one knapsack and such that the weight capacity\nconstraints of the knapsacks are not violated.\n\n_Remark:_ The profits $p$ are also referred to as \"values\" in the literature.\n\n\n## Features\n\n- Quick and simple creation of QMKP instances\n- Saving/loading of problem instances for a simple creation and use of\n  reference datasets\n- Easy implementation of novel algorithms to solve the QMKP\n- High reproducibility and direct comparison between different algorithms\n\n\nThe benefit of enabling a simple and direct way of implementing novel\nalgorithms is highlighted by an example in the provided Jupyter notebook in\n[examples/Custom\nAlgorithm.ipynb](https://github.com/klb2/qmkpy/blob/master/examples/Custom%20Algorithm.ipynb).  \n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/klb2/qmkpy/HEAD?labpath=examples%2FCustom%20Algorithm.ipynb)\n\n\n## Installation\nThe package can easily be installed via pip.\nEither from the PyPI\n```bash\npip3 install qmkpy\n```\nor from the GitHub repository\n```bash\ngit clone https://github.com/klb2/qmkpy.git\ncd qmkpy\ngit checkout dev  # optional for the latest development version\npip3 install -r requirements.txt\npip3 install .\npip3 install pytest  # optional if you want to run the unit tests\n```\n\n## Usage\nIn order to test the installation and get an idea of how to use the QMKPy\npackage, you can take a look at the `examples/` directory.\nIt contains some standalone scripts that can be executed and perform some\nsimple tasks.\n\nMore detailed descriptions of the implemented algorithms and a documentation of\nthe API can be found in the [documentation](https://qmkpy.readthedocs.io).\n\nA collection of reference datasets can be found at\n[https://github.com/klb2/qmkpy-datasets](https://github.com/klb2/qmkpy-datasets).\n\n\n## Contributing\nPlease see\n[CONTRIBUTING.md](https://github.com/klb2/qmkpy/blob/master/CONTRIBUTING.md)\nfor guidelines on how to contribute to this project.\nIn particular, novel algorithms are always welcome. Please check out the\n[documentation](https://qmkpy.readthedocs.io/en/latest/developing.html#contributing-a-new-algorithm-to-the-package)\nfor a brief overview on how to implement new algorithms for the QMKPy\nframework.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklb2%2Fqmkpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fklb2%2Fqmkpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fklb2%2Fqmkpy/lists"}