Description Usage Arguments Value Examples
max_coverage
solves the binary optimisation problem known as the
"maximal covering location problem" as described by Church
(http://www.geo .ucsb.edu/~forest/G294download/MAX_COVER_RLC_CSR.pdf).
This package was implemented to make it easier to solve this problem in the
context of the research initially presented by Chan et al
(http://circ.ahajournals.org/content/127/17/1801.short) to identify ideal
locations to place AEDs.
1 2 3 | max_coverage(existing_facility, proposed_facility, user, distance_cutoff,
n_added, d_existing_user = NULL, d_proposed_user = NULL,
solver = "glpk")
|
existing_facility |
data.frame containing the facilities that are already in existing, with columns names lat, and long. |
proposed_facility |
data.frame containing the facilities that are being proposed, with column names lat, and long. |
user |
data.frame containing the users of the facilities, along with column names lat, and long. |
distance_cutoff |
numeric indicating the distance cutoff (in metres) you are interested in. If a number is less than distance_cutoff, it will be 1, if it is greater than it, it will be 0. |
n_added |
the maximum number of facilities to add. |
d_existing_user |
Optional distance matrix between existing facilities and users. Default distances are direct (geospherical ellipsoidal) distances; this allows alternative measures such as street-network distances to be submitted (see Examples). |
d_proposed_user |
Option distance matrix between proposed facilities and users (see Examples). |
solver |
character "glpk" (default) or "lpSolve". "gurobi" is currently in development, see https://github.com/njtierney/maxcovr/issues/25 |
dataframe of results
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | library(dplyr)
# already existing locations
york_selected <- york %>% filter(grade == "I")
# proposed locations
york_unselected <- york %>% filter(grade != "I")
mc_result <- max_coverage(existing_facility = york_selected,
proposed_facility = york_unselected,
user = york_crime,
distance_cutoff = 100,
n_added = 20)
mc_result
summary(mc_result)
# get the facilities chosen
mc_result$facility_selected
# get the users affected
mc_result$user_affected
# get the summaries
mc_result$summary
# Example of street-network distance calculations
## Not run:
library(dodgr)
net <- dodgr_streetnet_sf ("york england") %>%
weight_streetnet (wt_profile = "foot")
from <- match_points_to_graph (v, york_selected [, c ("long", "lat")])
to <- match_points_to_graph (v, york_crime [, c ("long", "lat")])
d_existing_user <- dodgr_dists (net, from = from, to = to)
from <- match_points_to_graph (v, york_unselected [, c ("long", "lat")])
d_proposed_user <- dodgr_dists (net, from = from, to = to)
mc_result <- max_coverage(existing_facility = york_selected,
proposed_facility = york_unselected,
user = york_crime,
distance_cutoff = 100,
n_added = 20,
d_existing_user = d_existing_user,
d_proposed_user = d_proposed_user)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.