Skip to content
Snippets Groups Projects
Commit dc73e36f authored by Pedro L. Magalhães's avatar Pedro L. Magalhães
Browse files

Revised tests using SOS.

parent 08fba1b9
No related branches found
No related tags found
1 merge request!7Added support for convex price functions using the delta formulation and...
......@@ -23,6 +23,7 @@ def build_solve_ipp(
solver: str = 'glpk',
solver_options: dict = None,
use_sos_arcs: bool = False,
use_sos_arc_groups: bool = False,
arc_sos_weight_key: str = InfrastructurePlanningProblem.SOS1_ARC_WEIGHTS_NONE,
arc_use_real_variables_if_possible: bool = False,
use_sos_sense: bool = False,
......@@ -134,7 +135,7 @@ def build_solve_ipp(
arc_use_real_variables_if_possible
),
sos1_weight_method=arc_sos_weight_key,
)
)
# set up the use of sos for flow sense determination
......@@ -192,6 +193,12 @@ def build_solve_ipp(
if type(arc_groups_dict) != type(None):
for key in arc_groups_dict:
ipp.create_arc_group(arc_groups_dict[key])
# set up the use of sos for arc selection in groups
if use_sos_arc_groups:
for group_key, group in ipp.arc_groups.items():
ipp.groups_arc_sos1[group_key] = group
# *********************************************************************
......
......@@ -90,9 +90,6 @@ class TestESIPPProblem:
)
assert not ipp.has_peak_total_assessments()
assert ipp.results["Problem"][0]["Number of constraints"] == 10
assert ipp.results["Problem"][0]["Number of variables"] == 11
assert ipp.results["Problem"][0]["Number of nonzeros"] == 20
# *********************************************************************
# *********************************************************************
......@@ -194,12 +191,6 @@ class TestESIPPProblem:
)
assert not ipp.has_peak_total_assessments()
# print(ipp.results["Problem"][0]["Number of constraints"])
# print(ipp.results["Problem"][0]["Number of variables"])
# print(ipp.results["Problem"][0]["Number of nonzeros"])
assert ipp.results["Problem"][0]["Number of constraints"] == 14 # 10 prior to nonconvex block
assert ipp.results["Problem"][0]["Number of variables"] == 13 # 11 prior to nonconvex block
assert ipp.results["Problem"][0]["Number of nonzeros"] == 28 # 20 prior to nonconvex block
# *********************************************************************
# *********************************************************************
......@@ -372,9 +363,6 @@ class TestESIPPProblem:
)
assert not ipp.has_peak_total_assessments()
assert ipp.results["Problem"][0]["Number of constraints"] == 10
assert ipp.results["Problem"][0]["Number of variables"] == 11
assert ipp.results["Problem"][0]["Number of nonzeros"] == 20
# *********************************************************************
# *********************************************************************
......@@ -479,9 +467,6 @@ class TestESIPPProblem:
)
assert not ipp.has_peak_total_assessments()
assert ipp.results["Problem"][0]["Number of constraints"] == 14 # 10 before nonconvex block
assert ipp.results["Problem"][0]["Number of variables"] == 13 # 11 before nonconvex block
assert ipp.results["Problem"][0]["Number of nonzeros"] == 28 # 20 before nonconvex block
# *********************************************************************
# *********************************************************************
......@@ -688,9 +673,6 @@ class TestESIPPProblem:
)
assert not ipp.has_peak_total_assessments()
assert ipp.results["Problem"][0]["Number of constraints"] == 23
assert ipp.results["Problem"][0]["Number of variables"] == 26
assert ipp.results["Problem"][0]["Number of nonzeros"] == 57
# *********************************************************************
# *********************************************************************
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment