def test_scale_one_block(self, model): sc.scale_constraints(model, descend_into=False) # scaled assert model.c1.lower.value == pytest.approx(1) assert model.c1.body() == pytest.approx(model.x.value / 1e3) assert model.c1.upper.value == pytest.approx(1) assert model.c2.lower.value == pytest.approx(1) assert model.c2.body() == pytest.approx(model.y.value / 1e6) assert model.c2.upper.value == pytest.approx(1) # unscaled assert model.b1.c1.upper.value == pytest.approx(1e9) assert model.b1.b2.c1.upper.value == pytest.approx(1e12)
def test_scale_model(self, model): sc.scale_constraints(model) assert model.c1.upper.value == pytest.approx(1) assert model.b1.c1.upper.value == pytest.approx(1) assert model.b1.b2.c1.upper.value == pytest.approx(1)