Skip to content

Commit

Permalink
Merge remote-tracking branch 'lbianchi-lbl/multi-scip-testing' into m…
Browse files Browse the repository at this point in the history
…ulti-scip-testing
  • Loading branch information
lbianchi-lbl committed Feb 29, 2024
2 parents 30f5e09 + edb038b commit 9b428e7
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions idaes/core/util/tests/test_model_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -2002,23 +2002,32 @@ def test_solve_candidates_milp(self, model, scip_solver):
dh._prepare_candidates_milp()
dh._solve_candidates_milp()

assert dh.degenerate_set == {
model.con2: value(dh.candidates_milp.nu[0]),
model.con5: value(dh.candidates_milp.nu[1]),
}

assert abs(value(dh.candidates_milp.nu[0])) == pytest.approx(1e-05, rel=1e-5)
assert abs(value(dh.candidates_milp.nu[1])) == pytest.approx(1e-05, rel=1e-5)

assert value(dh.candidates_milp.y_pos[0]) == pytest.approx(0, abs=1e-5)
assert value(dh.candidates_milp.y_pos[1]) == pytest.approx(0, rel=1e-5)
# One must be positive and one must be negative, so produce will be negative
assert value(
dh.candidates_milp.nu[0] * dh.candidates_milp.nu[1]
) == pytest.approx(-1e-10, rel=1e-5)

assert value(dh.candidates_milp.y_neg[0]) == pytest.approx(0, abs=1e-5)
assert value(dh.candidates_milp.y_neg[1]) == pytest.approx(1, abs=1e-5)
assert (
value(
dh.candidates_milp.y_pos[0]
+ dh.candidates_milp.y_pos[1]
+ dh.candidates_milp.y_neg[0]
+ dh.candidates_milp.y_neg[1]
)
>= 1
)

assert value(dh.candidates_milp.abs_nu[0]) == pytest.approx(1e-05, rel=1e-5)
assert value(dh.candidates_milp.abs_nu[1]) == pytest.approx(1e-05, rel=1e-5)

assert dh.degenerate_set == {
model.con2: value(dh.candidates_milp.nu[0]),
model.con5: value(dh.candidates_milp.nu[1]),
}

@pytest.mark.unit
def test_prepare_ids_milp(self, model):
dh = DegeneracyHunter2(model)
Expand Down

0 comments on commit 9b428e7

Please sign in to comment.