Skip to content

Commit

Permalink
modify tests so the fail on main
Browse files Browse the repository at this point in the history
  • Loading branch information
bknueven committed Jun 21, 2024
1 parent c7b1bca commit 0b4d16b
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1846,14 +1846,15 @@ def test_scaling_pyomo_model_only(self):
)
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
# m.scaling_factor[m.obj] = 0.1 # scale the objective
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
# m.scaling_factor[m.hin] = 1.8
m.scaling_factor[m.hout] = 1.9
# m.scaling_factor[m.incon] = 2.1
Expand Down Expand Up @@ -1971,14 +1972,15 @@ def test_scaling_pyomo_model_and_greybox(self):
)
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
# m.scaling_factor[m.obj] = 0.1 # scale the objective
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
# m.scaling_factor[m.hin] = 1.8
m.scaling_factor[m.hout] = 1.9
# m.scaling_factor[m.incon] = 2.1
Expand Down Expand Up @@ -2063,14 +2065,15 @@ def test_external_greybox_solve_scaling(self):
)

m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
m.scaling_factor[m.obj] = 0.1 # scale the objective
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
m.scaling_factor[m.mu] = 1.9
m.scaling_factor[m.pincon] = 2.2

Expand Down
60 changes: 32 additions & 28 deletions pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -956,14 +956,15 @@ def test_scaling_pyomo_model_only(self):
)
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
# m.scaling_factor[m.obj] = 0.1 # scale the objective
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
# m.scaling_factor[m.hin] = 1.8
m.scaling_factor[m.hout] = 1.9
# m.scaling_factor[m.incon] = 2.1
Expand Down Expand Up @@ -2267,14 +2268,15 @@ def test_scaling_pyomo_model_only(self):
)
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
# m.scaling_factor[m.obj] = 0.1 # scale the objective
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
# m.scaling_factor[m.hin] = 1.8
m.scaling_factor[m.hout] = 1.9
# m.scaling_factor[m.incon] = 2.1
Expand Down Expand Up @@ -2392,14 +2394,15 @@ def test_scaling_pyomo_model_and_greybox(self):
)
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
# m.scaling_factor[m.obj] = 0.1 # scale the objective
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
# m.scaling_factor[m.hin] = 1.8
m.scaling_factor[m.hout] = 1.9
# m.scaling_factor[m.incon] = 2.1
Expand Down Expand Up @@ -2484,14 +2487,15 @@ def test_external_greybox_solve_scaling(self):
)

m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
m.scaling_factor[m.obj] = 0.1 # scale the objective
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
m.scaling_factor[m.mu] = 1.9
m.scaling_factor[m.pincon] = 2.2

Expand Down

0 comments on commit 0b4d16b

Please sign in to comment.