Skip to content

Commit 0b4d16b

Browse files
Bernard KnuevenBernard Knueven
authored andcommitted
modify tests so the fail on main
1 parent c7b1bca commit 0b4d16b

File tree

2 files changed

+56
-49
lines changed

2 files changed

+56
-49
lines changed

pyomo/contrib/pynumero/interfaces/tests/test_external_grey_box_model.py

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1846,14 +1846,15 @@ def test_scaling_pyomo_model_only(self):
18461846
)
18471847
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
18481848
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
1849+
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
18491850
# m.scaling_factor[m.obj] = 0.1 # scale the objective
1850-
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
1851-
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
1852-
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
1853-
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
1854-
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
1855-
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
1856-
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
1851+
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
1852+
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
1853+
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
1854+
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
1855+
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
1856+
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
1857+
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
18571858
# m.scaling_factor[m.hin] = 1.8
18581859
m.scaling_factor[m.hout] = 1.9
18591860
# m.scaling_factor[m.incon] = 2.1
@@ -1971,14 +1972,15 @@ def test_scaling_pyomo_model_and_greybox(self):
19711972
)
19721973
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
19731974
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
1975+
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
19741976
# m.scaling_factor[m.obj] = 0.1 # scale the objective
1975-
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
1976-
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
1977-
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
1978-
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
1979-
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
1980-
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
1981-
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
1977+
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
1978+
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
1979+
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
1980+
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
1981+
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
1982+
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
1983+
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
19821984
# m.scaling_factor[m.hin] = 1.8
19831985
m.scaling_factor[m.hout] = 1.9
19841986
# m.scaling_factor[m.incon] = 2.1
@@ -2063,14 +2065,15 @@ def test_external_greybox_solve_scaling(self):
20632065
)
20642066

20652067
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
2068+
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
20662069
m.scaling_factor[m.obj] = 0.1 # scale the objective
2067-
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
2068-
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
2069-
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
2070-
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
2071-
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
2072-
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
2073-
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
2070+
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
2071+
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
2072+
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
2073+
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
2074+
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
2075+
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
2076+
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
20742077
m.scaling_factor[m.mu] = 1.9
20752078
m.scaling_factor[m.pincon] = 2.2
20762079

pyomo/contrib/pynumero/interfaces/tests/test_pyomo_grey_box_nlp.py

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -956,14 +956,15 @@ def test_scaling_pyomo_model_only(self):
956956
)
957957
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
958958
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
959+
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
959960
# m.scaling_factor[m.obj] = 0.1 # scale the objective
960-
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
961-
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
962-
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
963-
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
964-
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
965-
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
966-
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
961+
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
962+
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
963+
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
964+
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
965+
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
966+
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
967+
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
967968
# m.scaling_factor[m.hin] = 1.8
968969
m.scaling_factor[m.hout] = 1.9
969970
# m.scaling_factor[m.incon] = 2.1
@@ -2267,14 +2268,15 @@ def test_scaling_pyomo_model_only(self):
22672268
)
22682269
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
22692270
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
2271+
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
22702272
# m.scaling_factor[m.obj] = 0.1 # scale the objective
2271-
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
2272-
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
2273-
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
2274-
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
2275-
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
2276-
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
2277-
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
2273+
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
2274+
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
2275+
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
2276+
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
2277+
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
2278+
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
2279+
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
22782280
# m.scaling_factor[m.hin] = 1.8
22792281
m.scaling_factor[m.hout] = 1.9
22802282
# m.scaling_factor[m.incon] = 2.1
@@ -2392,14 +2394,15 @@ def test_scaling_pyomo_model_and_greybox(self):
23922394
)
23932395
m.obj = pyo.Objective(expr=(m.egb.outputs['Pout'] - 20) ** 2)
23942396
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
2397+
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
23952398
# m.scaling_factor[m.obj] = 0.1 # scale the objective
2396-
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
2397-
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
2398-
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
2399-
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
2400-
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
2401-
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
2402-
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
2399+
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
2400+
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
2401+
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
2402+
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
2403+
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
2404+
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
2405+
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
24032406
# m.scaling_factor[m.hin] = 1.8
24042407
m.scaling_factor[m.hout] = 1.9
24052408
# m.scaling_factor[m.incon] = 2.1
@@ -2484,14 +2487,15 @@ def test_external_greybox_solve_scaling(self):
24842487
)
24852488

24862489
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
2490+
m.egb.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
24872491
m.scaling_factor[m.obj] = 0.1 # scale the objective
2488-
m.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
2489-
m.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
2490-
m.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
2491-
# m.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
2492-
m.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
2493-
m.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
2494-
m.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
2492+
m.egb.scaling_factor[m.egb.inputs['Pin']] = 1.1 # scale the variable
2493+
m.egb.scaling_factor[m.egb.inputs['c']] = 1.2 # scale the variable
2494+
m.egb.scaling_factor[m.egb.inputs['F']] = 1.3 # scale the variable
2495+
# m.egb.scaling_factor[m.egb.inputs['P1']] = 1.4 # scale the variable
2496+
m.egb.scaling_factor[m.egb.inputs['P3']] = 1.5 # scale the variable
2497+
m.egb.scaling_factor[m.egb.outputs['P2']] = 1.6 # scale the variable
2498+
m.egb.scaling_factor[m.egb.outputs['Pout']] = 1.7 # scale the variable
24952499
m.scaling_factor[m.mu] = 1.9
24962500
m.scaling_factor[m.pincon] = 2.2
24972501

0 commit comments

Comments
 (0)