Skip to content

Commit

Permalink
Merge pull request #250 from jGaboardi/more_cleanup_3
Browse files Browse the repository at this point in the history
clean out code block and add preexisting facility text
  • Loading branch information
jGaboardi authored Jun 13, 2022
2 parents 459a72c + a58d7b0 commit 2351de9
Showing 1 changed file with 4 additions and 37 deletions.
41 changes: 4 additions & 37 deletions paper/paper.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ authors:
affiliation: 1
- name: Ran Wei
affiliation: 1
- name: Levi Wolf
- name: Levi J. Wolf
orcid: 0000-0003-0274-599X
affiliation: 6
- name: Qunshan Zhao
orcid: 0000-0002-5549-9457
affiliation: 7
- name: Sergio Rey
- name: Sergio J. Rey
orcid: 0000-0001-5857-9762
affiliation: 1
affiliations:
Expand Down Expand Up @@ -108,48 +108,15 @@ For facility-location, four models, including two coverage models and two locati
3. P-Median Problem: Locating \textit{p} facilities and allocating the demand served by these facilities so that the total weighted assignment distance or time is minimized [@ReVelle1970].
4. P-Center Problem: Locating \textit{p} facilities and allocating the demand served by these facilities to minimize the maximum assignment distance or time between demands and their allocated facilities [@Hakimi1964].

For example, Maximal Covering Location Model functionality is used to select 4 out of 16 store sites in the San Francisco area to maximize demand coverage, as shown in \autoref{fig: mclp}. Other facility-location methods can be applied in a similar way.

```python
from spopt.locate.coverage import MCLP
import geopandas, numpy, pandas, pulp
# read in the datasets
f1 = "SF_network_distance_candidateStore_16_censusTract_205_new.csv"
ntw_dist = pandas.read_csv(f1)
f2 = "SF_demand_205_centroid_uniform_weight.csv"
demand_points = pandas.read_csv(f2, index_col=0)
f3 = "SF_store_site_16_longlat.csv"
facility_points = pandas.read_csv(f3, index_col=0)
study_area = geopandas.read_file("ServiceAreas_4.shp").dissolve()
# create a store site to tract centroid distance matrix
ntw_piv = ntw_dist.pivot_table(
values="distance", index="DestinationName", columns="name"
)
cost_matrix, ai, p = ntw_piv.to_numpy(), demand_points["POP2000"].to_numpy(), 4
mclp = MCLP.from_cost_matrix(cost_matrix, ai, max_coverage=5000, p_facilities=p)
mclp = mclp.solve(pulp.GLPK(msg=False))
# build a facility-demand array for demand covered by each facility
mclp.facility_client_array()
fgeom = geopandas.points_from_xy(facility_points.long, facility_points.lat)
facility_points_gdf = geopandas.GeoDataFrame(
facility_points, geometry=fgeom,
).sort_values(by=["NAME"]).reset_index()
dgeom = geopandas.points_from_xy(demand_points.long, demand_points.lat)
demand_points_gdf = geopandas.GeoDataFrame(
demand_points, geometry=dgeom,
).sort_values(by=["NAME"]).reset_index()
# plot results
n_facilities, title = facility_points_gdf.shape[0], f"MCLP ($p$={p})"
plot_results(mclp, facility_points_gdf, demand_points_gdf, n_facilities, title);
```
For example, Maximal Covering Location Model functionality is used to select 4 out of 16 store sites in the San Francisco area to maximize demand coverage, as shown in \autoref{fig: mclp}. Other facility-location methods can be applied in a similar way. Moreover, we have included functionality to place pre-determined site locations within the facility selection pool, allowing for realistic scenarios whereby 1 or more *new* facilities can be added to an *existing* set of locations. We believe this feature of intermingled new and exisitng facility location siting to be the first implementation in open-source optmization software.

![The solution of MCLP while siting 4 facilities using 5 kilometers as the maximum service distance between facilities and demand locations. See the "Real World Facility Location" tutorial ([https://pysal.org/spopt/notebooks/facloc-real-world.html](https://pysal.org/spopt/notebooks/facloc-real-world.html)) for more details.\label{fig: mclp}](figs/mclp.png)

# Planned Enhancements

**Spopt** is under active development and the developers look forward to your extensive attention and participation. In the near future, there are three major enhancements we plan to pursue for **spopt**:

1. The first stream will be on the enhancement of regionalization algorithms by including several novel extensions of the classical regionalization models, such as the integration of spatial data uncertainty and the shape of identified regions in the max-p-regions problem.
1. The first stream will be on the enhancement of regionalization algorithms by including several novel extensions of the classical regionalization models, such as the integration of spatial data uncertainty and the shape of identified regions in the Max-p-regions problem.
2. The second direction involves adding capacity constraints and includes a polygon partial coverage on facility location models. No commercial and open-source software has provided these features before.
3. We anticipate adding functionality for solving traditional routing and transportation-oriented optimization problems. Initially, this will come in the form of integer programming formulations of the Travelling Salesperson Problem [@miller1960integer] and the Transportation Problem [@koopmans1949optimum].

Expand Down

0 comments on commit 2351de9

Please sign in to comment.