Coder Social home page Coder Social logo

heshamshawqy / maximum-coverage-location Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cyang-kth/maximum-coverage-location

0.0 0.0 0.0 665 KB

A Python library for solving maximum coverage location problem

License: MIT License

Jupyter Notebook 95.77% Python 4.23%

maximum-coverage-location's Introduction

Maximum coverage location problem (MCLP)

This repository provides a Python implementation of solving a classical instance of the maximum coverage location problem described in Church 1974.

The problem is defined as: given N points, find K circles with radius of r to cover as many points as possible.

  • Example 1: Select 20 circles with radius of 0.1 to cover 300 points (uniform distribution)

example1

(M is the number of candidate sites and C is the number of points covered)

  • Example 2: Select 20 circles with radius of 0.2 to cover 300 points (moon distribution)

example2

Problem formulation

The method randomly generates a set of candidate sites within the region of the input points. The problem is then solved by integer programming.

The mathematical formulation is given below:

math

Demo and usage

from mclp import *
import numpy as np
Npoints = 300
from sklearn.datasets import make_moons
points,_ = make_moons(Npoints,noise=0.15)

# Number of sites to select
K = 20

# Service radius of each site
radius = 0.2

# Candidate site size (random sites generated)
M = 100

# Run mclp 
# opt_sites is the location of optimal sites 
# f is the number of points covered
opt_sites,f = mclp(points,K,radius,M)

# Plot the result 
plot_result(points,opt_sites,radius)

Check the jupyter-notebook demo.ipynb.

To run the example interactively, inside the project directory type the command

jupyter-notebook

Requirements

  • Python 2.7
  • Scipy, Numpy (available as part of Anaconda)
  • Shapely
  • Gurobi, commercial software (free for academic usage)

It is recommended to use Anaconda directly, where the packages can be installed with pip or conda.

pip install shapely
conda config --add channels http://conda.anaconda.org/gurobi
conda install gurobi

Contact

Can Yang, Ph.D. student at KTH, Royal Institute of Technology in Sweden

Email: cyang(at)kth.se

Homepage: https://people.kth.se/~cyang/

Reference

maximum-coverage-location's People

Contributors

cyang-kth avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.