{"id":17606530,"url":"https://github.com/mhahsler/qap","last_synced_at":"2025-06-26T16:09:19.695Z","repository":{"id":45801545,"uuid":"43436722","full_name":"mhahsler/qap","owner":"mhahsler","description":"Heuristics for the Quadratic Assignment Problem (QAP) - R package","archived":false,"fork":false,"pushed_at":"2024-08-27T22:16:18.000Z","size":556,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-26T16:04:58.242Z","etag":null,"topics":["combinatorial-optimization","cran","heuristic","qap","quadratic-assignment-problem","r"],"latest_commit_sha":null,"homepage":"","language":"Fortran","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/mhahsler.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"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}},"created_at":"2015-09-30T14:09:04.000Z","updated_at":"2025-02-04T18:03:25.000Z","dependencies_parsed_at":"2024-10-22T22:37:50.416Z","dependency_job_id":null,"html_url":"https://github.com/mhahsler/qap","commit_stats":{"total_commits":49,"total_committers":2,"mean_commits":24.5,"dds":"0.020408163265306145","last_synced_commit":"9a4f6444e30b8d13bfa4ad6fcb2dc1909626e848"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mhahsler/qap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhahsler%2Fqap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhahsler%2Fqap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhahsler%2Fqap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhahsler%2Fqap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mhahsler","download_url":"https://codeload.github.com/mhahsler/qap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mhahsler%2Fqap/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262099718,"owners_count":23258668,"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","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":["combinatorial-optimization","cran","heuristic","qap","quadratic-assignment-problem","r"],"created_at":"2024-10-22T15:44:45.767Z","updated_at":"2025-06-26T16:09:19.662Z","avatar_url":"https://github.com/mhahsler.png","language":"Fortran","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n```{r echo=FALSE, results = 'asis'}\npkg \u003c- 'qap'\n\nsource(\"https://raw.githubusercontent.com/mhahsler/pkg_helpers/main/pkg_helpers.R\")\npkg_title(pkg)\n```\n\n## Introduction\n\nThis package implements heuristics for the [Quadratic Assignment Problem (QAP)](https://en.wikipedia.org/wiki/Quadratic_assignment_problem).\nThe QAP was introduced as a combinatorial optimization problem from the category of facilities location \nproblems in operations research (Koopmans and Beckmann; 1957). \nIt also has many applications in data analysis including cluster analysis and seriation (see Hubert and Schultz; 1976).\n\nThe problem is NP-hard and the package implements the very effective simulated annealing heuristic \ndescribed in Burkard and Rendl (1984).\n\n\n```{r echo=FALSE, results = 'asis'}\npkg_usage(pkg)\npkg_citation(pkg)\npkg_install(pkg)\n```\n\n## Usage\n\nThe package contains a copy of the problem instances and solutions\nfrom [QAPLIB](https://coral.ise.lehigh.edu/data-sets/qaplib/).\nWe load the `had20` QAPLIB problem. The problem contains the A and B matrices and the optimal solution and the optimal\nobjective function value. \n```{r}\nlibrary(qap)\nset.seed(1000)\n\np \u003c- read_qaplib(system.file(\"qaplib\", \"had20.dat\", package = \"qap\"))\np$solution\np$opt\n```\n\nWe run the simulated annealing heuristic 10 times and use the best solution.\n```{r}\na \u003c- qap(p$A, p$B, rep = 10)\na\n```\n\nCompare the solution with known optimum (% above optimum).\n```{r}\n(attr(a, \"obj\") - p$opt)/p$opt * 100\n```\n\n## References\n\n* \n```{r results=\"asis\", echo = FALSE} \n  print(citation(\"qap\"), style = \"text\")\n```\n* R.E. Burkard and F. Rendl (1984). A thermodynamically motivated simulation procedure for combinatorial optimization problems. _European Journal of Operations Research,_ 17(2):169-174.\n  https://doi.org/10.1016/0377-2217(84)90231-5\n* Koopmans TC, Beckmann M (1957). Assignment problems and the location of economic activities. _Econometrica_ 25(1):53-76.\n  https://doi.org/10.2307/1907742\n* Hubert, L., and Schultz, J. (1976). Quadratic assignment as a general data analysis strategy. \n  _British Journal of Mathematical and Statistical Psychology,_ 29(2), 190–241. \n  https://doi.org/10.1111/j.2044-8317.1976.tb00714.x\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhahsler%2Fqap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmhahsler%2Fqap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmhahsler%2Fqap/lists"}