File tree 1 file changed +19
-0
lines changed
pyomo/contrib/pynumero/interfaces/tests
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -699,6 +699,25 @@ def test_indices_methods(self):
699
699
dense_hess = hess .todense ()
700
700
self .assertTrue (np .array_equal (dense_hess , expected_hess ))
701
701
702
+ def test_subblock_scaling (self ):
703
+ m = pyo .ConcreteModel ()
704
+ m .b = b = pyo .Block ()
705
+ b .x = pyo .Var (bounds = (5e-17 , 5e-16 ), initialize = 1e-16 )
706
+ b .scaling_factor = pyo .Suffix (direction = pyo .Suffix .EXPORT )
707
+ b .scaling_factor [b .x ] = 1e16
708
+
709
+ b .c = pyo .Constraint (rule = b .x == 1e-16 )
710
+ b .scaling_factor [b .c ] = 1e16
711
+
712
+ b .o = pyo .Objective (expr = b .x )
713
+ b .scaling_factor [b .o ] = 1e16
714
+
715
+ nlp = PyomoNLP (m )
716
+
717
+ assert nlp .get_obj_scaling () == 1e16
718
+ assert nlp .get_primals_scaling ()[0 ] == 1e16
719
+ assert nlp .get_constraints_scaling ()[0 ] == 1e16
720
+
702
721
def test_no_objective (self ):
703
722
m = pyo .ConcreteModel ()
704
723
m .x = pyo .Var ()
You can’t perform that action at this time.
0 commit comments