Open njtierney opened 7 years ago
OK so the previous version used the additional change in n_cov and pct_cov.
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(maxcovr)
# subset to be the places with towers built on them.
york_selected <- york %>% filter(grade == "I")
york_unselected <- york %>% filter(grade != "I")
# OK, what if I just use some really crazy small data to optimise over.
#
mc_relocate <- max_coverage_relocation(existing_facility = york_selected,
proposed_facility = york_unselected,
user = york_crime,
distance_cutoff = 100,
cost_install = 5000,
cost_removal = 200,
cost_total = 600000)
mc_relocate
#>
#> -----------------------------------------
#> Model Fit: maxcovr relocation model
#> -----------------------------------------
#> model_used: max_coverage_relocation
#> existing_facility: york_selected
#> proposed_facility: york_unselected
#> user: york_crime
#> distance_cutoff: 100
#> cost_install: 5000
#> cost_removal: 200
#> cost_total: 6e+05
#> solver: lpSolve
#> -----------------------------------------
summary(mc_relocate)
#>
#> ---------------------------------------
#> Model Fit: maxcovr relocation model
#> ---------------------------------------
#> Distance Cutoff: 100m
#> Facilities:
#> Added: 103
#> Removed: 2
#> Coverage (Additional):
#> # Users: 693 (354)
#> Proportion: 0.382 (0.1951)
#> Distance (m) to Facility:
#> Avg: 560
#> SD: 719
#> Costs:
#> Total: 6e+05
#> Install: 5000
#> Removal: 200
#> ---------------------------------------
And here is the new implementation, showing (previous)
.
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(maxcovr)
# subset to be the places with towers built on them.
york_selected <- york %>% filter(grade == "I")
york_unselected <- york %>% filter(grade != "I")
# OK, what if I just use some really crazy small data to optimise over.
#
mc_relocate <- max_coverage_relocation(existing_facility = york_selected,
proposed_facility = york_unselected,
user = york_crime,
distance_cutoff = 100,
cost_install = 5000,
cost_removal = 200,
cost_total = 600000)
mc_relocate
#>
#> -----------------------------------------
#> Model Fit: maxcovr relocation model
#> -----------------------------------------
#> model_used: max_coverage_relocation
#> existing_facility: york_selected
#> proposed_facility: york_unselected
#> user: york_crime
#> distance_cutoff: 100
#> cost_install: 5000
#> cost_removal: 200
#> cost_total: 6e+05
#> solver: lpSolve
#> -----------------------------------------
summary(mc_relocate)
#>
#> ---------------------------------------
#> Model Fit: maxcovr relocation model
#> ---------------------------------------
#> Distance Cutoff: 100m
#> Facilities:
#> Added: 103
#> Removed: 2
#> Coverage (Previous):
#> # Users: 693 (339)
#> Proportion: 0.382 (0.1869)
#> Distance (m) to Facility (Previous):
#> Avg: 560 (1400)
#> SD: 719 (1597)
#> Costs:
#> Total: 6e+05
#> Install: 5000
#> Removal: 200
#> ---------------------------------------
The reduction in average and SD distances
The amount of resources used? Is there any left over?
Maybe make something clearer about the facilities added and removed: