@@ -300,7 +300,11 @@ def get_inequality_constraint_indices(self, constraints):
300
300
def get_obj_scaling (self ):
301
301
obj = self .get_pyomo_objective ()
302
302
val = SuffixFinder ('scaling_factor' ).find (obj )
303
- return val
303
+ # maintain backwards compatability
304
+ if self ._pyomo_model .component ('scaling_factor' ) is None :
305
+ return val
306
+ else :
307
+ return 1.0 if val is None else val
304
308
305
309
# overloaded from NLP
306
310
def get_primals_scaling (self ):
@@ -312,7 +316,11 @@ def get_primals_scaling(self):
312
316
if val is not None :
313
317
primals_scaling [i ] = val
314
318
ret = primals_scaling
315
- return ret
319
+ # maintain backwards compatability
320
+ if self ._pyomo_model .component ('scaling_factor' ) is None :
321
+ return ret
322
+ else :
323
+ return primals_scaling
316
324
317
325
# overloaded from NLP
318
326
def get_constraints_scaling (self ):
@@ -324,7 +332,11 @@ def get_constraints_scaling(self):
324
332
if val is not None :
325
333
constraints_scaling [i ] = val
326
334
ret = constraints_scaling
327
- return ret
335
+ # maintain backwards compatability
336
+ if self ._pyomo_model .component ('scaling_factor' ) is None :
337
+ return ret
338
+ else :
339
+ return constraints_scaling
328
340
329
341
def extract_subvector_grad_objective (self , pyomo_variables ):
330
342
"""Compute the gradient of the objective and return the entries
@@ -612,6 +624,9 @@ def __init__(self, pyomo_model):
612
624
if v_scaling is not None :
613
625
need_scaling = True
614
626
self ._primals_scaling [i ] = v_scaling
627
+ # maintain backwards compatability
628
+ if self ._pyomo_model .component ('scaling_factor' ) is not None :
629
+ need_scaling = True
615
630
616
631
self ._constraints_scaling = []
617
632
pyomo_nlp_scaling = self ._pyomo_nlp .get_constraints_scaling ()
0 commit comments