From cfd52958f8229c1e7925942fbe7bd1fc5dc5c88a Mon Sep 17 00:00:00 2001 From: Travis Arnold Date: Tue, 24 Sep 2024 11:21:44 -0600 Subject: [PATCH] Fix tests --- pareto/tests/test_strategic_model.py | 42 ++++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/pareto/tests/test_strategic_model.py b/pareto/tests/test_strategic_model.py index 3ef4dd4e..b2397ba2 100644 --- a/pareto/tests/test_strategic_model.py +++ b/pareto/tests/test_strategic_model.py @@ -100,7 +100,7 @@ def test_basic_build_capex_distance_based_capacity_input(build_strategic_model): "water_quality": WaterQuality.false, } ) - assert degrees_of_freedom(m) == 27833 + assert degrees_of_freedom(m) == 27937 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -123,7 +123,7 @@ def test_basic_build_capex_distance_based_capacity_calculated(build_strategic_mo "water_quality": WaterQuality.false, } ) - assert degrees_of_freedom(m) == 27833 + assert degrees_of_freedom(m) == 27937 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -146,7 +146,7 @@ def test_basic_build_capex_capacity_based_capacity_input(build_strategic_model): "water_quality": WaterQuality.false, } ) - assert degrees_of_freedom(m) == 27833 + assert degrees_of_freedom(m) == 27937 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -169,7 +169,7 @@ def test_basic_build_capex_capacity_based_capacity_calculated(build_strategic_mo "water_quality": WaterQuality.false, } ) - assert degrees_of_freedom(m) == 27833 + assert degrees_of_freedom(m) == 27937 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -271,7 +271,7 @@ def test_run_strategic_model(build_strategic_model): solver = get_solver("cbc") solver.options["seconds"] = 60 results = solver.solve(m, tee=False) - assert degrees_of_freedom(m) == 27833 + assert degrees_of_freedom(m) == 27937 # Test report building [model, results_dict] = generate_report( @@ -568,7 +568,7 @@ def test_basic_reduced_build_capex_capacity_based_capacity_calculated( "water_quality": WaterQuality.false, } ) - assert degrees_of_freedom(m) == 11335 + assert degrees_of_freedom(m) == 12583 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -592,7 +592,7 @@ def test_basic_reduced_build_capex_capacity_based_capacity_input( "water_quality": WaterQuality.false, } ) - assert degrees_of_freedom(m) == 11335 + assert degrees_of_freedom(m) == 12583 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -616,7 +616,7 @@ def test_basic_reduced_build_capex_distance_based_capacity_input( "water_quality": WaterQuality.false, } ) - assert degrees_of_freedom(m) == 11335 + assert degrees_of_freedom(m) == 12583 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -640,7 +640,7 @@ def test_basic_reduced_build_discrete_water_quality_input( "water_quality": WaterQuality.discrete, } ) - assert degrees_of_freedom(m) == 101815 + assert degrees_of_freedom(m) == 103063 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -828,7 +828,7 @@ def test_run_reduced_strategic_model(build_reduced_strategic_model): assert results.solver.termination_condition == pyo.TerminationCondition.optimal assert results.solver.status == pyo.SolverStatus.ok - assert degrees_of_freedom(m) == 10044 + assert degrees_of_freedom(m) == 11292 # solutions obtained from running the reduced generic case study assert pytest.approx(88199.598, abs=1e-1) == pyo.value(m.v_Z) with nostdout(): @@ -993,7 +993,7 @@ def test_solver_option_reduced_strategic_model(build_reduced_strategic_model): assert results.solver.termination_condition == pyo.TerminationCondition.optimal assert results.solver.status == pyo.SolverStatus.ok - assert degrees_of_freedom(m) == 10044 + assert degrees_of_freedom(m) == 11292 assert m.config.objective assert isinstance(m.s_T, pyo.Set) assert isinstance(m.v_F_Piped, pyo.Var) @@ -1127,7 +1127,7 @@ def test_basic_permian_demo_build(build_permian_demo_strategic_model): "water_quality": WaterQuality.false, } ) - assert degrees_of_freedom(m) == 19293 + assert degrees_of_freedom(m) == 19397 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -1151,7 +1151,7 @@ def test_run_permian_demo_strategic_model(build_permian_demo_strategic_model): solver = get_solver("cbc") solver.options["seconds"] = 60 results = solver.solve(m, tee=False) - assert degrees_of_freedom(m) == 19293 + assert degrees_of_freedom(m) == 19397 # Test report building [model, results_dict] = generate_report( @@ -1197,7 +1197,7 @@ def test_basic_treatment_demo_build_with_MD( "infrastructure_timing": InfrastructureTiming.true, } ) - assert degrees_of_freedom(m) == 32837 + assert degrees_of_freedom(m) == 32941 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -1236,7 +1236,7 @@ def test_run_treatment_demo_strategic_model_with_MD( "gap": 0, } results = solve_model(model=m, options=options) - assert degrees_of_freedom(m) == 31686 + assert degrees_of_freedom(m) == 31790 # Test report building [model, results_dict] = generate_report( @@ -1265,7 +1265,7 @@ def test_basic_treatment_demo_build_with_MVC( "infrastructure_timing": InfrastructureTiming.true, } ) - assert degrees_of_freedom(m) == 32837 + assert degrees_of_freedom(m) == 32941 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -1304,7 +1304,7 @@ def test_run_treatment_demo_strategic_model_with_MVC( "gap": 0, } results = solve_model(model=m, options=options) - assert degrees_of_freedom(m) == 31686 + assert degrees_of_freedom(m) == 31790 # Test report building [model, results_dict] = generate_report( @@ -1333,7 +1333,7 @@ def test_run_water_quality_with_MVC( "infrastructure_timing": InfrastructureTiming.true, } ) - assert degrees_of_freedom(m) == 32837 + assert degrees_of_freedom(m) == 32941 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -1478,7 +1478,7 @@ def test_workshop_build(build_workshop_strategic_model): "water_quality": WaterQuality.false, } ) - assert degrees_of_freedom(m) == 4222 + assert degrees_of_freedom(m) == 4232 # Check unit config arguments assert len(m.config) == 10 assert m.config.objective @@ -1514,7 +1514,7 @@ def test_run_workshop_model(build_workshop_strategic_model): assert results.solver.termination_condition == pyo.TerminationCondition.optimal assert results.solver.status == pyo.SolverStatus.ok - assert degrees_of_freedom(m) == 4098 + assert degrees_of_freedom(m) == 4108 assert pytest.approx(5661.39656, abs=1e-1) == pyo.value(m.v_Z) with nostdout(): assert is_feasible(m) @@ -1578,7 +1578,7 @@ def test_run_subsurface_risk_model(build_workshop_strategic_model): assert results.solver.termination_condition == pyo.TerminationCondition.optimal assert results.solver.status == pyo.SolverStatus.ok - assert degrees_of_freedom(m) == 4097 + assert degrees_of_freedom(m) == 4107 assert pytest.approx(0.0, abs=1e-1) == pyo.value(m.v_Z_SubsurfaceRisk) with nostdout(): assert is_feasible(m)