{"id":16708118,"url":"https://github.com/cyang-kth/maximum-coverage-location","last_synced_at":"2025-03-21T20:32:45.858Z","repository":{"id":40440081,"uuid":"223298341","full_name":"cyang-kth/maximum-coverage-location","owner":"cyang-kth","description":"A Python library for solving maximum coverage location problem","archived":false,"fork":false,"pushed_at":"2019-11-22T12:06:28.000Z","size":665,"stargazers_count":60,"open_issues_count":1,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T04:51:20.795Z","etag":null,"topics":["facility-location","gis","integer-programming","location-services","optimization"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyang-kth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.TXT","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-22T01:31:55.000Z","updated_at":"2024-12-23T00:59:44.000Z","dependencies_parsed_at":"2022-07-18T01:30:41.736Z","dependency_job_id":null,"html_url":"https://github.com/cyang-kth/maximum-coverage-location","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyang-kth%2Fmaximum-coverage-location","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyang-kth%2Fmaximum-coverage-location/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyang-kth%2Fmaximum-coverage-location/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyang-kth%2Fmaximum-coverage-location/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyang-kth","download_url":"https://codeload.github.com/cyang-kth/maximum-coverage-location/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244866029,"owners_count":20523451,"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":["facility-location","gis","integer-programming","location-services","optimization"],"created_at":"2024-10-12T19:42:09.155Z","updated_at":"2025-03-21T20:32:45.524Z","avatar_url":"https://github.com/cyang-kth.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Maximum coverage location problem (MCLP)\n\nThis repository provides a Python implementation of solving a classical instance of\nthe **maximum coverage location problem** described in Church 1974. \n\nThe problem is defined as: given **N** points, find **K** circles with radius of **r** \nto cover as many points as possible.\n\n- Example 1: Select 20 circles with radius of 0.1 to cover 300 points (uniform distribution)\n\n![example1](img/example1.png)\n\n(M is the number of candidate sites and C is the number of points covered)\n\n- Example 2: Select 20 circles with radius of 0.2 to cover 300 points (moon distribution)\n\n![example2](img/example2.png)\n\n\n### Problem formulation\n\nThe method randomly generates a set of candidate sites within the region\nof the input points. The problem is then solved by integer programming.\n\nThe mathematical formulation is given below:\n\n![math](img/mclp_math.png)\n\n\n### Demo and usage\n\n```\nfrom mclp import *\nimport numpy as np\nNpoints = 300\nfrom sklearn.datasets import make_moons\npoints,_ = make_moons(Npoints,noise=0.15)\n\n# Number of sites to select\nK = 20\n\n# Service radius of each site\nradius = 0.2\n\n# Candidate site size (random sites generated)\nM = 100\n\n# Run mclp \n# opt_sites is the location of optimal sites \n# f is the number of points covered\nopt_sites,f = mclp(points,K,radius,M)\n\n# Plot the result \nplot_result(points,opt_sites,radius)\n```\n\nCheck the jupyter-notebook [demo.ipynb](demo.ipynb).\n\nTo run the example interactively, inside the project directory type the command\n```\njupyter-notebook\n```\n\n### Requirements\n\n- Python 2.7\n- Scipy, Numpy (available as part of [Anaconda](https://www.anaconda.com/))\n- [Shapely](https://github.com/Toblerity/Shapely)\n- [Gurobi](https://www.gurobi.com/), commercial software (free for academic usage)\n\nIt is recommended to use Anaconda directly, where the packages can be installed with `pip` or `conda`.\n\n```\npip install shapely\nconda config --add channels http://conda.anaconda.org/gurobi\nconda install gurobi\n```\n\n### Contact\n\nCan Yang, Ph.D. student at KTH, Royal Institute of Technology in Sweden\n\nEmail: cyang(at)kth.se\n\nHomepage: https://people.kth.se/~cyang/\n\n### Reference\n\n- [Church R, ReVelle C. The maximal covering location problem. Papers in regional science, 1974, 32(1): 101-118.](https://link.springer.com/article/10.1007/BF01942293)\n- http://examples.gurobi.com/facility-location/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyang-kth%2Fmaximum-coverage-location","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyang-kth%2Fmaximum-coverage-location","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyang-kth%2Fmaximum-coverage-location/lists"}