Skip to content

Commit

Permalink
Merge pull request #422 from jGaboardi/standard_locate_model_names
Browse files Browse the repository at this point in the history
`locate` models – standardized default names
  • Loading branch information
ljwolf authored Dec 10, 2023
2 parents 8800d2f + 9a4f3fe commit e505d5d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
24 changes: 12 additions & 12 deletions spopt/locate/coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def from_cost_matrix(
predefined_facilities_arr: np.array = None,
demand_quantity_arr: np.array = None,
facility_capacity_arr: np.array = None,
name: str = "LSCP",
name: str = "lscp",
):
"""
Create an ``LSCP`` object based on a cost matrix. A capacitated
Expand All @@ -151,7 +151,7 @@ def from_cost_matrix(
Amount of demand at each client location.
facility_capacity_arr : numpy.array (default None)
Capacity for service at each facility location.
name : str, (default 'LSCP')
name : str, (default 'lscp')
The name of the problem.
Returns
Expand Down Expand Up @@ -295,7 +295,7 @@ def from_geodataframe(
demand_quantity_col: str = None,
facility_capacity_col: str = None,
distance_metric: str = "euclidean",
name: str = "LSCP",
name: str = "lscp",
):
"""
Create an ``LSCP`` object from ``geopandas.GeoDataFrame`` objects.
Expand Down Expand Up @@ -330,7 +330,7 @@ def from_geodataframe(
distance_metric : str (default 'euclidean')
A metric used for the distance calculations supported by
`scipy.spatial.distance.cdist <https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cdist.html>`_.
name : str (default 'LSCP')
name : str (default 'lscp')
The name of the problem.
Returns
Expand Down Expand Up @@ -615,7 +615,7 @@ def from_cost_matrix(
service_radius: float,
solver: pulp.LpSolver,
predefined_facilities_arr: np.array = None,
name: str = "LSCP-B",
name: str = "lscp-b",
):
"""
Create an ``LSCPB`` object based on a cost matrix.
Expand All @@ -634,7 +634,7 @@ def from_cost_matrix(
solution. For example, consider 3 facilites ``['A', 'B', 'C']``.
If facility ``'B'`` must be in the model solution, then the passed
in array should be ``[0, 1, 0]``.
name : str (default 'LSCP-B')
name : str (default 'lscp-b')
The problem name.
Returns
Expand Down Expand Up @@ -755,7 +755,7 @@ def from_geodataframe(
solver: pulp.LpSolver,
predefined_facility_col: str = None,
distance_metric: str = "euclidean",
name: str = "LSCP-B",
name: str = "lscp-b",
):
"""
Expand Down Expand Up @@ -786,7 +786,7 @@ def from_geodataframe(
distance_metric : str (default 'euclidean')
A metric used for the distance calculations supported by
`scipy.spatial.distance.cdist <https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cdist.html>`_.
name : str (default 'LSCP')
name : str (default 'lscp-b')
The name of the problem.
Returns
Expand Down Expand Up @@ -1052,7 +1052,7 @@ def from_cost_matrix(
service_radius: float,
p_facilities: int,
predefined_facilities_arr: np.array = None,
name: str = "MCLP",
name: str = "mclp",
):
"""
Create a ``MCLP`` object based on cost matrix.
Expand All @@ -1073,7 +1073,7 @@ def from_cost_matrix(
solution. For example, consider 3 facilites ``['A', 'B', 'C']``.
If facility ``'B'`` must be in the model solution, then the passed
in array should be ``[0, 1, 0]``.
name : str (default 'MCLP')
name : str (default 'mclp')
The problem name.
Returns
Expand Down Expand Up @@ -1196,7 +1196,7 @@ def from_geodataframe(
p_facilities: int,
predefined_facility_col: str = None,
distance_metric: str = "euclidean",
name: str = "MCLP",
name: str = "mclp",
):
"""
Expand Down Expand Up @@ -1229,7 +1229,7 @@ def from_geodataframe(
distance_metric : str (default 'euclidean')
A metric used for the distance calculations supported by
`scipy.spatial.distance.cdist <https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cdist.html>`_.
name : str (default 'MCLP')
name : str (default 'mclp')
The name of the problem.
Returns
Expand Down
8 changes: 4 additions & 4 deletions spopt/locate/p_dispersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def from_cost_matrix(
cost_matrix: np.array,
p_facilities: int,
predefined_facilities_arr: np.array = None,
name: str = "P-Dispersion",
name: str = "p-dispersion",
):
"""
Create a ``PDispersion`` object based on a cost matrix.
Expand All @@ -98,7 +98,7 @@ def from_cost_matrix(
solution. For example, consider 3 facilites ``['A', 'B', 'C']``.
If facility ``'B'`` must be in the model solution, then the passed
in array should be ``[0, 1, 0]``.
name : str (default 'P-Dispersion')
name : str (default 'p-dispersion')
The name of the problem.
Returns
Expand Down Expand Up @@ -199,7 +199,7 @@ def from_geodataframe(
p_facilities: int,
predefined_facility_col: str = None,
distance_metric: str = "euclidean",
name: str = "P-Dispersion",
name: str = "p-dispersion",
):
"""
Create a ``PDispersion`` object based on a geodataframe. Calculate the
Expand All @@ -222,7 +222,7 @@ def from_geodataframe(
distance_metric : str (default 'euclidean')
A metric used for the distance calculations supported by
`scipy.spatial.distance.cdist <https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.cdist.html>`_.
name : str (default 'P-Dispersion')
name : str (default 'p-dispersion')
The name of the problem.
Returns
Expand Down
2 changes: 1 addition & 1 deletion spopt/locate/p_median.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ def __init__(
p_facilities: int,
capacities: np.array = None,
distance_metric: str = "euclidean",
name="k-nearest p median",
name="k-nearest-p-median",
):
self.ai_sum = weights_sum
self.clients = clients
Expand Down

0 comments on commit e505d5d

Please sign in to comment.