Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tarnold17 committed Sep 24, 2024
1 parent 937a71e commit cfd5295
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions pareto/tests/test_strategic_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit cfd5295

Please sign in to comment.