From 29e0395e97afcdd347fe33c10ce133298eb051a6 Mon Sep 17 00:00:00 2001 From: Bernard Knueven Date: Thu, 27 Jun 2024 12:54:37 -0600 Subject: [PATCH] Revert "modify tests so the fail on main" This reverts commit 0b4d16b6d8bc334949481ff69f8e7370d132a1b6. --- .../tests/test_external_grey_box_model.py | 45 +++++++------- .../tests/test_pyomo_grey_box_nlp.py | 60 +++++++++---------- 2 files changed, 49 insertions(+), 56 deletions(-) diff --git a/pyomo/contrib/pynumero/interfaces/tests/test_external_grey_box_model.py b/pyomo/contrib/pynumero/interfaces/tests/test_external_grey_box_model.py index e592b8ff691..0fc342c4e40 100644 --- a/pyomo/contrib/pynumero/interfaces/tests/test_external_grey_box_model.py +++ b/pyomo/contrib/pynumero/interfaces/tests/test_external_grey_box_model.py @@ -1846,15 +1846,14 @@ 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.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.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.scaling_factor[m.hin] = 1.8 m.scaling_factor[m.hout] = 1.9 # m.scaling_factor[m.incon] = 2.1 @@ -1972,15 +1971,14 @@ 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.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.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.scaling_factor[m.hin] = 1.8 m.scaling_factor[m.hout] = 1.9 # m.scaling_factor[m.incon] = 2.1 @@ -2065,15 +2063,14 @@ 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.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.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.scaling_factor[m.mu] = 1.9 m.scaling_factor[m.pincon] = 2.2 diff --git a/pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py b/pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py index 39cfdf16146..ecadf40e5cf 100644 --- a/pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py +++ b/pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py @@ -956,15 +956,14 @@ 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.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.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.scaling_factor[m.hin] = 1.8 m.scaling_factor[m.hout] = 1.9 # m.scaling_factor[m.incon] = 2.1 @@ -2268,15 +2267,14 @@ 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.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.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.scaling_factor[m.hin] = 1.8 m.scaling_factor[m.hout] = 1.9 # m.scaling_factor[m.incon] = 2.1 @@ -2394,15 +2392,14 @@ 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.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.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.scaling_factor[m.hin] = 1.8 m.scaling_factor[m.hout] = 1.9 # m.scaling_factor[m.incon] = 2.1 @@ -2487,15 +2484,14 @@ 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.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.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.scaling_factor[m.mu] = 1.9 m.scaling_factor[m.pincon] = 2.2