Coder Social home page Coder Social logo

gis-ops / maximum-coverage-location Goto Github PK

View Code? Open in Web Editor NEW

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

1.0 1.0 0.0 692 KB

A Python library for solving maximum coverage location problem

License: MIT License

Python 100.00%

maximum-coverage-location's Introduction

Maximum coverage location problem (MCLP)

A fork of Can Yang's - "Maximum Coverage Location" repository using python-mip instead of gurobipy.

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)

Reference

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.