Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
pytest spopt \
-v \
-r a \
-n logical \
-n 1 \
--color yes \
--cov spopt \
--cov-append \
Expand Down
9 changes: 3 additions & 6 deletions ci/py311_spopt-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.11
- coin-or-cbc
- fast_hdbscan # for sa3
- geopandas
- libpysal
Expand All @@ -12,6 +13,7 @@ dependencies:
- numpy
- pandas
- pointpats
- pulp
- scikit-learn
- scipy
- shapely
Expand All @@ -23,9 +25,4 @@ dependencies:
- coverage
- pytest
- pytest-cov
- pytest-xdist

# with pip
- pip
- pip:
- pulp
- pytest-xdist
7 changes: 2 additions & 5 deletions ci/py311_spopt-oldest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.11
- coin-or-cbc
- fast_hdbscan=0.2.2 # for sa3
- fiona<1.10 # see gh#492
- geopandas=0.14.0
Expand All @@ -13,6 +14,7 @@ dependencies:
- numpy=1.26.0
- pandas=2.1.0
- pointpats=2.4.0
- pulp=2.8
- scikit-learn=1.4.0
- scipy=1.12.0
- shapely=2.1.0
Expand All @@ -25,8 +27,3 @@ dependencies:
- pytest
- pytest-cov
- pytest-xdist

# with pip
- pip
- pip:
- pulp==2.8
7 changes: 2 additions & 5 deletions ci/py312_spopt-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.12
- coin-or-cbc
- fast_hdbscan # for sa3
- geopandas
- libpysal
Expand All @@ -12,6 +13,7 @@ dependencies:
- numpy
- pandas
- pointpats
- pulp
- scikit-learn
- scipy
- shapely
Expand All @@ -24,8 +26,3 @@ dependencies:
- pytest
- pytest-cov
- pytest-xdist

# with pip
- pip
- pip:
- pulp
3 changes: 2 additions & 1 deletion ci/py313_spopt-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ channels:
- conda-forge
dependencies:
- python=3.13
- coin-or-cbc
- fast_hdbscan # for sa3
- folium # for geopandas.explore()
- matplotlib # for geopandas.explore()
- pulp
- numba # for sa3
- tqdm

Expand All @@ -26,7 +28,6 @@ dependencies:
- networkx
- numpy
- pandas
- pulp
- scikit-learn
- scipy
- shapely
Expand Down
7 changes: 2 additions & 5 deletions ci/py313_spopt-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.13
- coin-or-cbc
- fast_hdbscan # for sa3
- geopandas
- libpysal
Expand All @@ -12,6 +13,7 @@ dependencies:
- numpy
- pandas
- pointpats
- pulp
- scikit-learn
- scipy
- shapely
Expand All @@ -32,8 +34,3 @@ dependencies:
- sphinxcontrib-bibtex
- sphinx_bootstrap_theme

# with pip
- pip
- pip:
- pulp

4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ channels:
- conda-forge
dependencies:
- python=3.13
- coin-or-cbc
- fast_hdbscan
- geopandas
- jupyterlab
Expand Down Expand Up @@ -35,5 +36,4 @@ dependencies:
- pip:
- git+https://github.com/pysal/spopt.git@main
# (notebook/binder specific) having trouble resolving routingpy via conda-forge
- routingpy
- pulp
- routingpy
12 changes: 6 additions & 6 deletions spopt/tests/test_locate/test_c_p_median.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_c_p_median_from_cost_matrix(self):
p_facilities=2,
facility_capacities=facility_capacity,
)
result = p_median.solve(pulp.PULP_CBC_CMD(msg=False))
result = p_median.solve(pulp.COIN_CMD(msg=False))
assert isinstance(result, PMedian)

known = [[1], [2]]
Expand All @@ -48,7 +48,7 @@ def test_c_p_median_with_predefined_facilities_from_cost_matrix(self):
predefined_facilities_arr=predefine,
fulfill_predefined_fac=True,
)
result = p_median.solve(pulp.PULP_CBC_CMD(msg=False))
result = p_median.solve(pulp.COIN_CMD(msg=False))
assert isinstance(result, PMedian)

known = [[1], [2]]
Expand All @@ -74,7 +74,7 @@ def test_c_p_median_with_predefined_facilities_infeasible(
fulfill_predefined_fac=True,
)
with loc_raises_infeasible:
p_median.solve(pulp.PULP_CBC_CMD(msg=False))
p_median.solve(pulp.COIN_CMD(msg=False))


class TestRealWorldLocate:
Expand Down Expand Up @@ -116,15 +116,15 @@ def test_optimality_capacitated_pmedian_with_predefined_facilities(self):
facility_capacities=self.capacities_arr,
fulfill_predefined_fac=True,
)
pmedian = pmedian.solve(pulp.PULP_CBC_CMD(msg=False))
pmedian = pmedian.solve(pulp.COIN_CMD(msg=False))
assert pmedian.problem.status == pulp.LpStatusOptimal

def test_infeasibility_capacitated_pmedian(self, loc_raises_infeasible):
pmedian = PMedian.from_cost_matrix(
self.cost_matrix, self.demand, 0, facility_capacities=self.capacities_arr
)
with loc_raises_infeasible:
pmedian.solve(pulp.PULP_CBC_CMD(msg=False))
pmedian.solve(pulp.COIN_CMD(msg=False))

def test_mixin_mean_time(self):
mean_time_expected = 87.2
Expand All @@ -136,7 +136,7 @@ def test_mixin_mean_time(self):
facility_capacities=self.capacities_arr,
fulfill_predefined_fac=True,
)
pmedian = pmedian.solve(pulp.PULP_CBC_CMD(msg=False))
pmedian = pmedian.solve(pulp.COIN_CMD(msg=False))
assert pmedian.mean_dist == mean_time_expected

def test_infeasibility_predefined_facilities_fulfillment_error(self):
Expand Down
8 changes: 4 additions & 4 deletions spopt/tests/test_locate/test_clscp-so.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_clscpso_y1_lt_y2(self):
facility_capacity_arr=facility_capacity,
demand_quantity_arr=demand_quantity,
)
result = clscpso.solve(pulp.PULP_CBC_CMD(msg=False))
result = clscpso.solve(pulp.COIN_CMD(msg=False))
assert isinstance(result, LSCP)

known = [[1], [1], [1], [1], [1]]
Expand All @@ -47,7 +47,7 @@ def test_clscpso_y1_gt_y2(self):
facility_capacity_arr=facility_capacity,
demand_quantity_arr=demand_quantity,
)
result = clscpso.solve(pulp.PULP_CBC_CMD(msg=False))
result = clscpso.solve(pulp.COIN_CMD(msg=False))
assert isinstance(result, LSCP)

known = [[1], [1], [0, 1], [0, 1], [0, 1]]
Expand All @@ -68,7 +68,7 @@ def test_clscpso_y1_eq_y2(self):
facility_capacity_arr=facility_capacity,
demand_quantity_arr=demand_quantity,
)
result = clscpso.solve(pulp.PULP_CBC_CMD(msg=False))
result = clscpso.solve(pulp.COIN_CMD(msg=False))
assert isinstance(result, LSCP)

known = [[1], [1], [0, 1], [0], [1]]
Expand Down Expand Up @@ -104,4 +104,4 @@ def test_clscpso_infease_error(self, loc_raises_infeasible):
demand_quantity_arr=demand_quantity,
)
with loc_raises_infeasible:
clscpso.solve(pulp.PULP_CBC_CMD(msg=False))
clscpso.solve(pulp.COIN_CMD(msg=False))
20 changes: 10 additions & 10 deletions spopt/tests/test_locate/test_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def test_vehicle_range_percentage(self, setup_simple_network):
)

assert model.vehicle_range == 30
result = model.solve(solver=pulp.PULP_CBC_CMD(msg=0))
result = model.solve(solver=pulp.COIN_CMD(msg=0))
assert result["status"] == "Optimal"
assert len(model.selected_facilities) == 3
coverage = model.get_flow_coverage()
Expand All @@ -66,7 +66,7 @@ def test_ac_pc_approach(self, setup_grid_network):
assert model.k is not None
assert model.a is not None

result = model.solve(solver=pulp.PULP_CBC_CMD(msg=0))
result = model.solve(solver=pulp.COIN_CMD(msg=0))
assert result["status"] == "Optimal"

def test_combination_approach(self, setup_grid_network):
Expand All @@ -79,7 +79,7 @@ def test_combination_approach(self, setup_grid_network):

assert model.path_refueling_combinations is not None

result = model.solve(solver=pulp.PULP_CBC_CMD(msg=0))
result = model.solve(solver=pulp.COIN_CMD(msg=0))
assert result["status"] == "Optimal"


Expand All @@ -106,7 +106,7 @@ def test_flow_objective(self, setup_network_with_distances):
vehicle_range=50,
objective="flow",
)
result = model.solve(solver=pulp.PULP_CBC_CMD(msg=0))
result = model.solve(solver=pulp.COIN_CMD(msg=0))
assert result["status"] == "Optimal"
coverage = model.get_flow_coverage()
assert coverage["covered_volume"] == 50
Expand All @@ -122,7 +122,7 @@ def test_vmt_objective(self, setup_network_with_distances):
objective="vmt",
)

result = model.solve(solver=pulp.PULP_CBC_CMD(msg=0))
result = model.solve(solver=pulp.COIN_CMD(msg=0))
assert result["status"] == "Optimal"
vmt_coverage = model.get_vmt_coverage()
assert "total_vmt" in vmt_coverage
Expand All @@ -147,7 +147,7 @@ def test_threshold_basic(self, setup_threshold_network):
threshold=0.8,
weight=0.5,
)
result = model.solve(solver=pulp.PULP_CBC_CMD(msg=0))
result = model.solve(solver=pulp.COIN_CMD(msg=0))
assert result["status"] == "Optimal"
model.calculate_covered_nodes()
for node in model.covered_nodes:
Expand All @@ -173,7 +173,7 @@ def test_threshold_weight_impact(self, setup_threshold_network):
threshold=0.8,
weight=0.99,
)
result_high = model_high_weight.solve(solver=pulp.PULP_CBC_CMD(msg=0))
result_high = model_high_weight.solve(solver=pulp.COIN_CMD(msg=0))

model_low_weight = FRLM.from_flow_dataframe(
network=network,
Expand All @@ -183,7 +183,7 @@ def test_threshold_weight_impact(self, setup_threshold_network):
threshold=0.8,
weight=0.01,
)
result_low = model_low_weight.solve(solver=pulp.PULP_CBC_CMD(msg=0))
result_low = model_low_weight.solve(solver=pulp.COIN_CMD(msg=0))

assert result_high["status"] == "Optimal"
assert result_low["status"] == "Optimal"
Expand Down Expand Up @@ -352,7 +352,7 @@ def setup_solved_model(self):
network=network, flows=simple_flows, p_facilities=2, vehicle_range=25
)

model.solve(solver=pulp.PULP_CBC_CMD(msg=0))
model.solve(solver=pulp.COIN_CMD(msg=0))
return model

def test_summary_output(self, setup_solved_model):
Expand Down Expand Up @@ -458,7 +458,7 @@ def test_custom_paths_basic(self):

assert model.flow_paths[(0, 15)] == [0, 4, 8, 12, 13, 14, 15]

result = model.solve(solver=pulp.PULP_CBC_CMD(msg=0))
result = model.solve(solver=pulp.COIN_CMD(msg=0))
assert result["status"] == "Optimal"

def test_invalid_custom_paths(self):
Expand Down
2 changes: 1 addition & 1 deletion spopt/tests/test_locate/test_knearest_p_median.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def setup_method(self) -> None:
facility_capacity_col="capacity",
k_array=k,
)
self.solver = pulp.PULP_CBC_CMD(msg=False)
self.solver = pulp.COIN_CMD(msg=False)

def test_knearest_p_median_from_geodataframe(self):
result = self.k_nearest_pmedian.solve(self.solver)
Expand Down
Loading
Loading