You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assigning decision variables different named labels should not alter the results of an optimization problem, but this seems to be happening. For example, tests fail when the client decision variable is renamed "x[{i}_{j}]" from "z[{i}_{j}]" when building p-center problem.
PCenter failures
[gw3] darwin -- Python 3.10.6 /Users/user/miniconda3/envs/py310_spopt/bin/python
self = <spopt.tests.test_locate.TestSyntheticLocate object at 0x1635b4b50>
def test_pcenter_facility_client_array_from_cost_matrix(self):
with open(self.dirpath + "pcenter_fac2cli.pkl", "rb") as f:
pcenter_objective = pickle.load(f)
pcenter = PCenter.from_cost_matrix(self.cost_matrix, p_facilities=4)
pcenter = pcenter.solve(pulp.PULP_CBC_CMD(msg=False))
> numpy.testing.assert_array_equal(
numpy.array(pcenter.fac2cli, dtype=object),
numpy.array(pcenter_objective, dtype=object),
)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 4 / 5 (80%)
E x: array([list([5, 18, 19, 22, 25, 28, 32, 47, 48, 62, 65, 68, 72]),
E list([0, 1, 9, 10, 12, 13, 15, 17, 20, 21, 29, 43, 44, 46, 50, 57, 59, 60, 69, 73, 74, 75, 79, 81, 84, 86, 91, 92, 94, 95, 99]),
E list([2, 3, 4, 6, 7, 8, 23, 26, 31, 33, 34, 35, 37, 49, 52, 54, 58, 61, 63, 66, 70, 78, 80, 82, 89, 90, 93, 96, 97]),...
E y: array([list([5, 18, 19, 22, 28, 32, 34, 36, 48, 53, 62, 68, 72, 90, 96]),
E list([0, 10, 12, 13, 15, 17, 20, 21, 29, 37, 46, 50, 60, 64, 73, 75, 79, 81, 84, 86, 91, 92, 94, 99]),
E list([2, 3, 4, 6, 7, 8, 23, 25, 26, 31, 33, 35, 43, 44, 47, 49, 52, 54, 57, 58, 59, 65, 66, 69, 70, 74, 78, 80, 82, 89, 93, 95, 97]),...
spopt/tests/test_locate.py:398: AssertionError
___________________________________________ TestSyntheticLocate.test_pcenter_client_facility_array_from_cost_matrix ___________________________________________
[gw0] darwin -- Python 3.10.6 /Users/user/miniconda3/envs/py310_spopt/bin/python
self = <spopt.tests.test_locate.TestSyntheticLocate object at 0x165ac0a90>
def test_pcenter_client_facility_array_from_cost_matrix(self):
with open(self.dirpath + "pcenter_cli2fac.pkl", "rb") as f:
pcenter_objective = pickle.load(f)
pcenter = PCenter.from_cost_matrix(self.cost_matrix, p_facilities=4)
pcenter = pcenter.solve(pulp.PULP_CBC_CMD(msg=False))
> numpy.testing.assert_array_equal(
numpy.array(pcenter.cli2fac, dtype=object),
numpy.array(pcenter_objective, dtype=object),
)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 21 / 100 (21%)
E Max absolute difference: 4
E Max relative difference: 3.0
E x: array([[1],
E [1],
E [2],...
E y: array([[1],
E [4],
E [2],...
spopt/tests/test_locate.py:410: AssertionError
__________________________________________ TestSyntheticLocate.test_pcenter_facility_client_array_from_geodataframe ___________________________________________
[gw2] darwin -- Python 3.10.6 /Users/user/miniconda3/envs/py310_spopt/bin/python
self = <spopt.tests.test_locate.TestSyntheticLocate object at 0x173404f10>
def test_pcenter_facility_client_array_from_geodataframe(self):
with open(self.dirpath + "pcenter_geodataframe_fac2cli.pkl", "rb") as f:
pcenter_objective = pickle.load(f)
pcenter = PCenter.from_geodataframe(
self.clients_snapped,
self.facilities_snapped,
"geometry",
"geometry",
p_facilities=4,
)
pcenter = pcenter.solve(pulp.PULP_CBC_CMD(msg=False))
> numpy.testing.assert_array_equal(
numpy.array(pcenter.fac2cli, dtype=object),
numpy.array(pcenter_objective, dtype=object),
)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 4 / 5 (80%)
E x: array([list([5, 18, 19, 22, 25, 28, 32, 47, 48, 54, 62, 68, 72]),
E list([0, 1, 9, 10, 12, 13, 15, 17, 20, 21, 29, 38, 43, 44, 46, 50, 57, 59, 60, 69, 73, 74, 75, 79, 81, 84, 86, 91, 92, 94, 95, 99]),
E list([2, 3, 4, 6, 7, 8, 23, 26, 31, 33, 34, 35, 37, 40, 49, 52, 58, 61, 63, 65, 66, 70, 78, 80, 82, 89, 90, 93, 96, 97]),...
E y: array([list([5, 18, 19, 22, 28, 32, 34, 36, 48, 53, 62, 72, 90, 96]),
E list([0, 9, 10, 12, 13, 15, 17, 20, 21, 29, 37, 46, 50, 60, 64, 73, 75, 79, 81, 84, 86, 91, 92, 94, 95, 99]),
E list([2, 3, 4, 6, 7, 8, 23, 25, 26, 31, 33, 35, 43, 44, 47, 49, 52, 54, 57, 58, 59, 61, 63, 65, 66, 69, 70, 74, 78, 80, 82, 89, 93, 97]),...
spopt/tests/test_locate.py:439: AssertionError
__________________________________________ TestSyntheticLocate.test_pcenter_client_facility_array_from_geodataframe ___________________________________________
[gw3] darwin -- Python 3.10.6 /Users/user/miniconda3/envs/py310_spopt/bin/python
self = <spopt.tests.test_locate.TestSyntheticLocate object at 0x1635b5090>
def test_pcenter_client_facility_array_from_geodataframe(self):
with open(self.dirpath + "pcenter_geodataframe_cli2fac.pkl", "rb") as f:
pcenter_objective = pickle.load(f)
pcenter = PCenter.from_geodataframe(
self.clients_snapped,
self.facilities_snapped,
"geometry",
"geometry",
p_facilities=4,
)
pcenter = pcenter.solve(pulp.PULP_CBC_CMD(msg=False))
> numpy.testing.assert_array_equal(
numpy.array(pcenter.cli2fac, dtype=object),
numpy.array(pcenter_objective, dtype=object),
)
E AssertionError:
E Arrays are not equal
E
E Mismatched elements: 20 / 100 (20%)
E Max absolute difference: 4
E Max relative difference: 3.0
E x: array([[1],
E [1],
E [2],...
E y: array([[1],
E [4],
E [2],...
spopt/tests/test_locate.py:457: AssertionError
Assigning decision variables different named labels should not alter the results of an optimization problem, but this seems to be happening. For example, tests fail when the client decision variable is renamed
"x[{i}_{j}]"
from"z[{i}_{j}]"
when building p-center problem.PCenter failures
Same to true for the MCLP (see here).
MCLP failures
The text was updated successfully, but these errors were encountered: