<!DOCTYPE html>
<!-- Generated by pkgdown: do not edit by hand --><html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Using max_coverage_relocation • maxcovr</title>
<!-- jquery --><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script><!-- Bootstrap --><link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.7/flatly/bootstrap.min.css" rel="stylesheet" crossorigin="anonymous">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha256-U5ZEeKfGNOja007MMD3YBI0A3OSZOQbeG6z2f2Y0hu8=" crossorigin="anonymous"></script><!-- Font Awesome icons --><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous">
<!-- clipboard.js --><script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.4/clipboard.min.js" integrity="sha256-FiZwavyI2V6+EXO1U+xzLG3IKldpiTFf3153ea9zikQ=" crossorigin="anonymous"></script><!-- sticky kit --><script src="https://cdnjs.cloudflare.com/ajax/libs/sticky-kit/1.1.3/sticky-kit.min.js" integrity="sha256-c4Rlo1ZozqTPE2RLuvbusY3+SU1pQaJC0TjuhygMipw=" crossorigin="anonymous"></script><!-- pkgdown --><link href="../pkgdown.css" rel="stylesheet">
<script src="../pkgdown.js"></script><meta property="og:title" content="Using max_coverage_relocation">
<meta property="og:description" content="">
<meta name="twitter:card" content="summary">
<!-- mathjax --><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js" integrity="sha256-nvJJv9wWKEm88qvoQl9ekL2J+k/RWIsaSScxxlsrv8k=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/config/TeX-AMS-MML_HTMLorMML.js" integrity="sha256-84DKXVJXs0/F8OTMzX4UR909+jtl4G7SPypPavF+GfA=" crossorigin="anonymous"></script><!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
    <div class="container template-article">
      <header><div class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <span class="navbar-brand">
        <a class="navbar-link" href="../index.html">maxcovr</a>
        <span class="version label label-default" data-toggle="tooltip" data-placement="bottom" title="Released version">0.1.3.9200</span>
      </span>
    </div>

    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
<li>
  <a href="../index.html">
    <span class="fa fa-home fa-lg"></span>
     
  </a>
</li>
<li>
  <a href="../reference/index.html">Reference</a>
</li>
<li class="dropdown">
  <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false">
    Articles
     
    <span class="caret"></span>
  </a>
  <ul class="dropdown-menu" role="menu">
<li>
      <a href="../articles/cross_validation_with_maxcovr.html">Using Cross Validation with maxcovr</a>
    </li>
    <li>
      <a href="../articles/intro_to_maxcovr.html">Using maxcovr</a>
    </li>
    <li>
      <a href="../articles/using_max_coverage_relocation.html">Using max_coverage_relocation</a>
    </li>
  </ul>
</li>
<li>
  <a href="../news/index.html">Changelog</a>
</li>
      </ul>
<ul class="nav navbar-nav navbar-right">
<li>
  <a href="https://github.com/njtierney/maxcovr">
    <span class="fa fa-github fa-lg"></span>
     
  </a>
</li>
      </ul>
</div>
<!--/.nav-collapse -->
  </div>
<!--/.container -->
</div>
<!--/.navbar -->

      
      </header><div class="row">
  <div class="col-md-9 contents">
    <div class="page-header toc-ignore">
      <h1>Using max_coverage_relocation</h1>
                        <h4 class="author">Nicholas Tierney</h4>
            
            <h4 class="date">2019-06-13</h4>
      
      <small class="dont-index">Source: <a href="https://github.com/njtierney/maxcovr/blob/master/vignettes/using_max_coverage_relocation.Rmd"><code>vignettes/using_max_coverage_relocation.Rmd</code></a></small>
      <div class="hidden name"><code>using_max_coverage_relocation.Rmd</code></div>

    </div>

    
    
<p>This vignette provides a guide to using <code>maxcovr</code> to solve the maximum covering location problem, assuming that you can relocate facilities.</p>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb1-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(dplyr)</a></code></pre></div>
<pre><code>## 
## Attaching package: 'dplyr'</code></pre>
<pre><code>## The following objects are masked from 'package:stats':
## 
##     filter, lag</code></pre>
<pre><code>## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union</code></pre>
<div class="sourceCode" id="cb5"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb5-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/library">library</a></span>(maxcovr)</a></code></pre></div>
<p>The “fixed location” method provided in <code>max_coverage</code> is limited in that it assumes that you cannot move existing facilities. <code>max_coverage_relocation</code> assumes that you can move already existing facilities, but that there is some cost of removal, and a cost of installation.</p>
<p>To illustrate the benefits of relocation, we are first going to consider an example where the existing facilities provide no coverage to users. We identify facility locations that are really far away.</p>
<div class="sourceCode" id="cb6"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb6-1" title="1">york_selected_worst_id &lt;-<span class="st"> </span>york_crime <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb6-2" title="2"><span class="st">    </span><span class="kw"><a href="../reference/nearest.html">nearest</a></span>(york) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb6-3" title="3"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/arrange.html">arrange</a></span>(<span class="op">-</span>distance) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb6-4" title="4"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/slice.html">slice</a></span>(<span class="dv">1</span><span class="op">:</span><span class="dv">20</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb6-5" title="5"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(desig_id) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb6-6" title="6"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/distinct.html">distinct</a></span>(desig_id)</a>
<a class="sourceLine" id="cb6-7" title="7">    </a>
<a class="sourceLine" id="cb6-8" title="8">    </a>
<a class="sourceLine" id="cb6-9" title="9"><span class="co"># york_worst &lt;- york_selected_worst_id %&gt;% </span></a>
<a class="sourceLine" id="cb6-10" title="10">york_existing_worst &lt;-<span class="st"> </span>york_selected_worst_id <span class="op">%&gt;%</span><span class="st"> </span></a>
<a class="sourceLine" id="cb6-11" title="11"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/join.html">left_join</a></span>(york,</a>
<a class="sourceLine" id="cb6-12" title="12">              <span class="dt">by =</span> <span class="st">"desig_id"</span>)</a></code></pre></div>
<p>Then we identify some really ideal locations.</p>
<div class="sourceCode" id="cb7"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb7-1" title="1">york_not_selected_worst &lt;-<span class="st"> </span>york <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb7-2" title="2"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/join.html">anti_join</a></span>(york_existing_worst,</a>
<a class="sourceLine" id="cb7-3" title="3">              <span class="dt">by =</span> <span class="st">"desig_id"</span>)</a>
<a class="sourceLine" id="cb7-4" title="4"></a>
<a class="sourceLine" id="cb7-5" title="5">york_proposed_best &lt;-<span class="st"> </span></a>
<a class="sourceLine" id="cb7-6" title="6"><span class="st"> </span>york_crime <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb7-7" title="7"><span class="st">    </span><span class="kw"><a href="../reference/nearest.html">nearest</a></span>(york_not_selected_worst) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb7-8" title="8"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/arrange.html">arrange</a></span>(distance) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb7-9" title="9"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/slice.html">slice</a></span>(<span class="dv">1</span><span class="op">:</span><span class="dv">100</span>) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb7-10" title="10"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/select.html">select</a></span>(desig_id) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb7-11" title="11"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/distinct.html">distinct</a></span>(desig_id) <span class="op">%&gt;%</span></a>
<a class="sourceLine" id="cb7-12" title="12"><span class="st">    </span><span class="kw"><a href="https://dplyr.tidyverse.org/reference/join.html">left_join</a></span>(york,</a>
<a class="sourceLine" id="cb7-13" title="13">              <span class="dt">by =</span> <span class="st">"desig_id"</span>)</a></code></pre></div>
<div class="sourceCode" id="cb8"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb8-1" title="1">york_proposed_best</a></code></pre></div>
<pre><code>## # A tibble: 101 x 7
##    desig_id  long   lat object_id pref_ref name                       grade
##    &lt;chr&gt;    &lt;dbl&gt; &lt;dbl&gt;     &lt;int&gt;    &lt;int&gt; &lt;chr&gt;                      &lt;chr&gt;
##  1 DYO788   -1.09  54.0      3362   463995 &lt;NA&gt;                       II*  
##  2 DYO857   -1.08  54.0      5549   463864 UNIVERSITY COLLEGE OF RIP… II   
##  3 DYO857   -1.08  54.0      4212   463864 UNIVERSITY COLLEGE OF RIP… II   
##  4 DYO1212  -1.08  54.0      5843   463237 &lt;NA&gt;                       II   
##  5 DYO1212  -1.08  54.0      4506   463237 &lt;NA&gt;                       II   
##  6 DYO862   -1.08  54.0      5554   463874 &lt;NA&gt;                       II   
##  7 DYO862   -1.08  54.0      4217   463874 &lt;NA&gt;                       II   
##  8 DYO1146  -1.08  54.0      5793   463399 &lt;NA&gt;                       II   
##  9 DYO1146  -1.08  54.0      4456   463399 &lt;NA&gt;                       II   
## 10 DYO1078  -1.09  54.0      5730   463443 THE ADELPHI HOTEL AND THE… II   
## # … with 91 more rows</code></pre>
<div class="sourceCode" id="cb10"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb10-1" title="1">york_existing_worst</a></code></pre></div>
<pre><code>## # A tibble: 21 x 7
##    desig_id   long   lat object_id pref_ref name                      grade
##    &lt;chr&gt;     &lt;dbl&gt; &lt;dbl&gt;     &lt;int&gt;    &lt;int&gt; &lt;chr&gt;                     &lt;chr&gt;
##  1 DYO91    -0.980  54.0      3545   328688 SANDBURN CROSS IN GROUND… II   
##  2 DYO91    -0.980  54.0      4882   328688 SANDBURN CROSS IN GROUND… II   
##  3 DYO222   -1.20   54.0      3720   331644 PEAR TREE FARMHOUSE       II   
##  4 DYO222   -1.20   54.0      5057   331644 PEAR TREE FARMHOUSE       II   
##  5 DYO1477  -0.983  54.0      6043   328687 MILEPOST APPROXIMATELY 7… II   
##  6 DYO1477  -0.983  54.0      4707   328687 MILEPOST APPROXIMATELY 7… II   
##  7 DYO138   -1.21   54.0      3591   331645 CROFT FARMHOUSE           II   
##  8 DYO138   -1.21   54.0      4928   331645 CROFT FARMHOUSE           II   
##  9 DYO137   -1.19   54.0      3590   331701 BOUNDARY POST AT SE 5303… II   
## 10 DYO137   -1.19   54.0      4927   331701 BOUNDARY POST AT SE 5303… II   
## # … with 11 more rows</code></pre>
<p>Let’s look at the coverage of these places,</p>
<div class="sourceCode" id="cb12"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb12-1" title="1"><span class="kw"><a href="../reference/coverage.html">coverage</a></span>(york_existing_worst,</a>
<a class="sourceLine" id="cb12-2" title="2">         york_crime,</a>
<a class="sourceLine" id="cb12-3" title="3">         <span class="dt">distance_cutoff =</span> <span class="dv">100</span>)</a></code></pre></div>
<pre><code>## # A tibble: 1 x 7
##   distance_within n_cov n_not_cov prop_cov prop_not_cov dist_avg dist_sd
##             &lt;dbl&gt; &lt;int&gt;     &lt;int&gt;    &lt;dbl&gt;        &lt;dbl&gt;    &lt;dbl&gt;   &lt;dbl&gt;
## 1             100     0      1814        0            1    5674.   1040.</code></pre>
<p>So these are <em>worst</em> placements - we should choose some better facilities. However, if we consider the possibility that we could move these existing facilities to better locations, then we might be able to save a lot of money! We can do this with <code>max_coverage_relocation</code>.</p>
<p>Here we use <code>max_coverage_relocation</code>, which is similar in form to <code>max_coverage</code>.</p>
<p>Here, we specify:</p>
<ul>
<li>
<code>existing_facility</code> with <code>york_existing_worst</code>
</li>
<li>
<code>proposed_facility</code> with <code>york_proposed_best</code>
</li>
<li>
<code>user</code> is <code>york_crime</code>,</li>
<li>
<code>distance_cutoff</code> is 100 - for 100m</li>
</ul>
<p>instead of specifying <code>n_added</code>, as in <code>max_coverage</code>, we specify three <code>cost_</code> parameters:</p>
<ul>
<li>
<code>cost_install</code> is the cost of buying a new facility and installing it</li>
<li>
<code>cost_removal</code> is the cost of removing a facility and installing it in a new location</li>
<li>
<code>cost_total</code> is the total available money to spend.</li>
</ul>
<p>Here we state that the installation cost is 10, the remocal cost is 1, and the total available cost is 10. There is only enough total resources to install one facility.</p>
<div class="sourceCode" id="cb14"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb14-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/system.time">system.time</a></span>(</a>
<a class="sourceLine" id="cb14-2" title="2">mc_relocate_worst &lt;-<span class="st">  </span><span class="kw"><a href="../reference/max_coverage_relocation.html">max_coverage_relocation</a></span>(</a>
<a class="sourceLine" id="cb14-3" title="3">    <span class="dt">existing_facility =</span> york_existing_worst,</a>
<a class="sourceLine" id="cb14-4" title="4">    <span class="dt">proposed_facility =</span> york_proposed_best,</a>
<a class="sourceLine" id="cb14-5" title="5">    <span class="dt">user =</span> york_crime,</a>
<a class="sourceLine" id="cb14-6" title="6">    <span class="dt">distance_cutoff =</span> <span class="dv">100</span>,</a>
<a class="sourceLine" id="cb14-7" title="7">    <span class="dt">cost_install =</span> <span class="dv">500</span>,</a>
<a class="sourceLine" id="cb14-8" title="8">    <span class="dt">cost_removal =</span> <span class="dv">100</span>,</a>
<a class="sourceLine" id="cb14-9" title="9">    <span class="dt">cost_total =</span> <span class="dv">1000</span>)</a>
<a class="sourceLine" id="cb14-10" title="10">)</a></code></pre></div>
<pre><code>##    user  system elapsed 
##   0.572   0.115   0.713</code></pre>
<div class="sourceCode" id="cb16"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb16-1" title="1">mc_relocate_worst</a></code></pre></div>
<pre><code>## 
## ----------------------------------------- 
## Model Fit: maxcovr relocation model 
## ----------------------------------------- 
## model_used:        max_coverage_relocation 
## existing_facility: york_existing_worst 
## proposed_facility: york_proposed_best 
## user:              york_crime 
## distance_cutoff:   100 
## cost_install:      500 
## cost_removal:     100 
## cost_total:        1000 
## solver:            lpSolve 
## -----------------------------------------</code></pre>
<div class="sourceCode" id="cb18"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb18-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(mc_relocate_worst)</a></code></pre></div>
<pre><code>## 
## --------------------------------------- 
## Model Fit: maxcovr relocation model 
## --------------------------------------- 
## Distance Cutoff: 100m 
## Facilities: 
##     Added:       10 
##     Removed:     10L 
## Coverage (Previous): 
##     # Users:     260   (0) 
##     Proportion:  0.1433 (0) 
## Distance (m) to Facility (Previous): 
##        Avg:      1720 (5674) 
##        SD:       1542 (1040) 
## Costs: 
##     Total:       1000 
##     Install:     500 
##     Removal:  100 
## ---------------------------------------</code></pre>
<div class="sourceCode" id="cb20"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb20-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/dim">dim</a></span>(york_existing_worst)</a></code></pre></div>
<pre><code>## [1] 21  7</code></pre>
<div class="sourceCode" id="cb22"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb22-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/dim">dim</a></span>(york_proposed_best)</a></code></pre></div>
<pre><code>## [1] 101   7</code></pre>
<div class="sourceCode" id="cb24"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb24-1" title="1">mc_relocate_worst<span class="op">$</span>existing_facility[[<span class="dv">1</span>]]</a></code></pre></div>
<pre><code>## # A tibble: 21 x 8
##    desig_id   long   lat object_id pref_ref name         grade is_relocated
##    &lt;chr&gt;     &lt;dbl&gt; &lt;dbl&gt;     &lt;int&gt;    &lt;int&gt; &lt;chr&gt;        &lt;chr&gt; &lt;lgl&gt;       
##  1 DYO91    -0.980  54.0      3545   328688 SANDBURN CR… II    FALSE       
##  2 DYO91    -0.980  54.0      4882   328688 SANDBURN CR… II    FALSE       
##  3 DYO222   -1.20   54.0      3720   331644 PEAR TREE F… II    FALSE       
##  4 DYO222   -1.20   54.0      5057   331644 PEAR TREE F… II    FALSE       
##  5 DYO1477  -0.983  54.0      6043   328687 MILEPOST AP… II    FALSE       
##  6 DYO1477  -0.983  54.0      4707   328687 MILEPOST AP… II    FALSE       
##  7 DYO138   -1.21   54.0      3591   331645 CROFT FARMH… II    FALSE       
##  8 DYO138   -1.21   54.0      4928   331645 CROFT FARMH… II    FALSE       
##  9 DYO137   -1.19   54.0      3590   331701 BOUNDARY PO… II    FALSE       
## 10 DYO137   -1.19   54.0      4927   331701 BOUNDARY PO… II    FALSE       
## # … with 11 more rows</code></pre>
<div class="sourceCode" id="cb26"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb26-1" title="1">mc_relocate_worst<span class="op">$</span>proposed_facility[[<span class="dv">1</span>]]</a></code></pre></div>
<pre><code>## # A tibble: 101 x 8
##    desig_id  long   lat object_id pref_ref name          grade is_installed
##    &lt;chr&gt;    &lt;dbl&gt; &lt;dbl&gt;     &lt;int&gt;    &lt;int&gt; &lt;chr&gt;         &lt;chr&gt;        &lt;dbl&gt;
##  1 DYO788   -1.09  54.0      3362   463995 &lt;NA&gt;          II*              0
##  2 DYO857   -1.08  54.0      5549   463864 UNIVERSITY C… II               0
##  3 DYO857   -1.08  54.0      4212   463864 UNIVERSITY C… II               0
##  4 DYO1212  -1.08  54.0      5843   463237 &lt;NA&gt;          II               1
##  5 DYO1212  -1.08  54.0      4506   463237 &lt;NA&gt;          II               0
##  6 DYO862   -1.08  54.0      5554   463874 &lt;NA&gt;          II               0
##  7 DYO862   -1.08  54.0      4217   463874 &lt;NA&gt;          II               0
##  8 DYO1146  -1.08  54.0      5793   463399 &lt;NA&gt;          II               1
##  9 DYO1146  -1.08  54.0      4456   463399 &lt;NA&gt;          II               0
## 10 DYO1078  -1.09  54.0      5730   463443 THE ADELPHI … II               0
## # … with 91 more rows</code></pre>
<div class="sourceCode" id="cb28"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb28-1" title="1">mc_relocate_worst<span class="op">$</span>facilities_selected[[<span class="dv">1</span>]]</a></code></pre></div>
<pre><code>## # A tibble: 21 x 7
##    desig_id   long   lat object_id pref_ref name                      grade
##    &lt;chr&gt;     &lt;dbl&gt; &lt;dbl&gt;     &lt;int&gt;    &lt;int&gt; &lt;chr&gt;                     &lt;chr&gt;
##  1 DYO91    -0.980  54.0      3545   328688 SANDBURN CROSS IN GROUND… II   
##  2 DYO91    -0.980  54.0      4882   328688 SANDBURN CROSS IN GROUND… II   
##  3 DYO222   -1.20   54.0      3720   331644 PEAR TREE FARMHOUSE       II   
##  4 DYO222   -1.20   54.0      5057   331644 PEAR TREE FARMHOUSE       II   
##  5 DYO1477  -0.983  54.0      6043   328687 MILEPOST APPROXIMATELY 7… II   
##  6 DYO1477  -0.983  54.0      4707   328687 MILEPOST APPROXIMATELY 7… II   
##  7 DYO138   -1.21   54.0      3591   331645 CROFT FARMHOUSE           II   
##  8 DYO138   -1.21   54.0      4928   331645 CROFT FARMHOUSE           II   
##  9 DYO137   -1.19   54.0      3590   331701 BOUNDARY POST AT SE 5303… II   
## 10 DYO137   -1.19   54.0      4927   331701 BOUNDARY POST AT SE 5303… II   
## # … with 11 more rows</code></pre>
<p>You can then start to toy with the different pricings if you like.</p>
<div class="sourceCode" id="cb30"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb30-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/system.time">system.time</a></span>(</a>
<a class="sourceLine" id="cb30-2" title="2">mc_relocate_worst_eq &lt;-<span class="st">  </span><span class="kw"><a href="../reference/max_coverage_relocation.html">max_coverage_relocation</a></span>(</a>
<a class="sourceLine" id="cb30-3" title="3">    <span class="dt">existing_facility =</span> york_existing_worst,</a>
<a class="sourceLine" id="cb30-4" title="4">    <span class="dt">proposed_facility =</span> york_proposed_best,</a>
<a class="sourceLine" id="cb30-5" title="5">    <span class="dt">user =</span> york_crime,</a>
<a class="sourceLine" id="cb30-6" title="6">    <span class="dt">distance_cutoff =</span> <span class="dv">100</span>,</a>
<a class="sourceLine" id="cb30-7" title="7">    <span class="dt">cost_install =</span> <span class="dv">10</span>,</a>
<a class="sourceLine" id="cb30-8" title="8">    <span class="dt">cost_removal =</span> <span class="dv">100</span>,</a>
<a class="sourceLine" id="cb30-9" title="9">    <span class="dt">cost_total =</span> <span class="dv">10</span>)</a>
<a class="sourceLine" id="cb30-10" title="10">)</a></code></pre></div>
<pre><code>##    user  system elapsed 
##   0.521   0.099   0.624</code></pre>
<div class="sourceCode" id="cb32"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb32-1" title="1">mc_relocate_worst_eq</a></code></pre></div>
<pre><code>## 
## ----------------------------------------- 
## Model Fit: maxcovr relocation model 
## ----------------------------------------- 
## model_used:        max_coverage_relocation 
## existing_facility: york_existing_worst 
## proposed_facility: york_proposed_best 
## user:              york_crime 
## distance_cutoff:   100 
## cost_install:      10 
## cost_removal:     100 
## cost_total:        10 
## solver:            lpSolve 
## -----------------------------------------</code></pre>
<div class="sourceCode" id="cb34"><pre class="sourceCode r"><code class="sourceCode r"><a class="sourceLine" id="cb34-1" title="1"><span class="kw"><a href="https://www.rdocumentation.org/packages/base/topics/summary">summary</a></span>(mc_relocate_worst_eq)</a></code></pre></div>
<pre><code>## 
## --------------------------------------- 
## Model Fit: maxcovr relocation model 
## --------------------------------------- 
## Distance Cutoff: 100m 
## Facilities: 
##     Added:       1 
##     Removed:     0L 
## Coverage (Previous): 
##     # Users:     44   (0) 
##     Proportion:  0.0243 (0) 
## Distance (m) to Facility (Previous): 
##        Avg:      2071 (5674) 
##        SD:       1521 (1040) 
## Costs: 
##     Total:       10 
##     Install:     10 
##     Removal:  100 
## ---------------------------------------</code></pre>
  </div>

  <div class="col-md-3 hidden-xs hidden-sm" id="sidebar">
      </div>

</div>


      <footer><div class="copyright">
  <p>Developed by Nicholas Tierney.</p>
</div>

<div class="pkgdown">
  <p>Site built with <a href="https://pkgdown.r-lib.org/">pkgdown</a> 1.3.0.</p>
</div>
      </footer>
</div>

  

  </body>
</html>
