mirror of
https://github.com/ANL-CEEESA/MIPLearn.git
synced 2025-12-06 09:28:51 -06:00
Use np.ndarray for constraint names
This commit is contained in:
@@ -53,7 +53,7 @@ def run_basic_usage_tests(solver: InternalSolver) -> None:
|
||||
assert_equals(
|
||||
solver.get_constraints(),
|
||||
Constraints(
|
||||
names=["eq_capacity"],
|
||||
names=np.array(["eq_capacity"], dtype="S"),
|
||||
rhs=np.array([0.0]),
|
||||
lhs=[
|
||||
[
|
||||
@@ -110,7 +110,7 @@ def run_basic_usage_tests(solver: InternalSolver) -> None:
|
||||
Constraints(
|
||||
basis_status=["N"],
|
||||
dual_values=np.array([13.538462]),
|
||||
names=["eq_capacity"],
|
||||
names=np.array(["eq_capacity"], dtype="S"),
|
||||
sa_rhs_down=np.array([-24.0]),
|
||||
sa_rhs_up=np.array([2.0]),
|
||||
slacks=np.array([0.0]),
|
||||
@@ -153,7 +153,7 @@ def run_basic_usage_tests(solver: InternalSolver) -> None:
|
||||
_filter_attrs(
|
||||
solver.get_constraint_attrs(),
|
||||
Constraints(
|
||||
names=["eq_capacity"],
|
||||
names=np.array(["eq_capacity"], dtype="S"),
|
||||
slacks=np.array([0.0]),
|
||||
),
|
||||
),
|
||||
@@ -161,7 +161,7 @@ def run_basic_usage_tests(solver: InternalSolver) -> None:
|
||||
|
||||
# Build new constraint and verify that it is violated
|
||||
cf = Constraints(
|
||||
names=["cut"],
|
||||
names=np.array(["cut"], dtype="S"),
|
||||
lhs=[[(b"x[0]", 1.0)]],
|
||||
rhs=np.array([0.0]),
|
||||
senses=["<"],
|
||||
@@ -175,7 +175,7 @@ def run_basic_usage_tests(solver: InternalSolver) -> None:
|
||||
_filter_attrs(
|
||||
solver.get_constraint_attrs(),
|
||||
Constraints(
|
||||
names=["eq_capacity", "cut"],
|
||||
names=np.array(["eq_capacity", "cut"], dtype="S"),
|
||||
rhs=np.array([0.0, 0.0]),
|
||||
lhs=[
|
||||
[
|
||||
@@ -198,7 +198,7 @@ def run_basic_usage_tests(solver: InternalSolver) -> None:
|
||||
assert_equals(solver.are_constraints_satisfied(cf), [True])
|
||||
|
||||
# Remove the new constraint
|
||||
solver.remove_constraints(["cut"])
|
||||
solver.remove_constraints(np.array(["cut"], dtype="S"))
|
||||
|
||||
# New constraint should no longer affect solution
|
||||
stats = solver.solve()
|
||||
|
||||
Reference in New Issue
Block a user