Skip to content

Commit 7e79e19

Browse files
committed
adding Robby's test code for no scaling
1 parent ff67817 commit 7e79e19

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

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

+17
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,23 @@ def test_subblock_scaling(self):
718718
assert nlp.get_primals_scaling()[0] == 1e16
719719
assert nlp.get_constraints_scaling()[0] == 1e16
720720

721+
def test_subblock_no_scaling(self):
722+
m = pyo.ConcreteModel()
723+
m.b = pyo.Block()
724+
m.b.x = pyo.Var([1, 2], initialize={1: 100, 2: 20})
725+
726+
# Components so we don't have an empty NLP
727+
m.b.eq = pyo.Constraint(expr=m.b.x[1] * m.b.x[2] == 2000)
728+
m.b.obj = pyo.Objective(expr=m.b.x[1] ** 2 + m.b.x[2] ** 2)
729+
730+
m.scaling_factor = pyo.Suffix(direction=pyo.Suffix.EXPORT)
731+
m.scaling_factor[m.b.x[1]] = 1e-2
732+
m.scaling_factor[m.b.x[2]] = 1e-1
733+
734+
nlp = PyomoNLP(m.b)
735+
scaling = nlp.get_primals_scaling()
736+
assert scaling is None
737+
721738
def test_no_objective(self):
722739
m = pyo.ConcreteModel()
723740
m.x = pyo.Var()

0 commit comments

Comments
 (0)