File tree 1 file changed +17
-0
lines changed
pyomo/contrib/pynumero/interfaces/tests
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -718,6 +718,23 @@ def test_subblock_scaling(self):
718
718
assert nlp .get_primals_scaling ()[0 ] == 1e16
719
719
assert nlp .get_constraints_scaling ()[0 ] == 1e16
720
720
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
+
721
738
def test_no_objective (self ):
722
739
m = pyo .ConcreteModel ()
723
740
m .x = pyo .Var ()
You can’t perform that action at this time.
0 commit comments