diff --git a/pyomo/contrib/pynumero/interfaces/pyomo_grey_box_nlp.py b/pyomo/contrib/pynumero/interfaces/pyomo_grey_box_nlp.py index 3cc23260f56..8b320c091e4 100644 --- a/pyomo/contrib/pynumero/interfaces/pyomo_grey_box_nlp.py +++ b/pyomo/contrib/pynumero/interfaces/pyomo_grey_box_nlp.py @@ -228,7 +228,9 @@ def __init__(self, pyomo_model): need_scaling = True self._primals_scaling = np.ones(self.n_primals()) - scaling_suffix_finder = SuffixFinder('scaling_factor') + scaling_suffix_finder = SuffixFinder( + 'scaling_factor', context=self._pyomo_model + ) for i, v in enumerate(self._pyomo_model_var_datas): v_scaling = scaling_suffix_finder.find(v) if v_scaling is not None: diff --git a/pyomo/contrib/pynumero/interfaces/pyomo_nlp.py b/pyomo/contrib/pynumero/interfaces/pyomo_nlp.py index 4b955b0176a..8790e29cf37 100644 --- a/pyomo/contrib/pynumero/interfaces/pyomo_nlp.py +++ b/pyomo/contrib/pynumero/interfaces/pyomo_nlp.py @@ -299,7 +299,7 @@ def get_inequality_constraint_indices(self, constraints): # overloaded from NLP def get_obj_scaling(self): obj = self.get_pyomo_objective() - val = SuffixFinder('scaling_factor').find(obj) + val = SuffixFinder('scaling_factor', context=self._pyomo_model).find(obj) # maintain backwards compatibility scaling_suffix = self._pyomo_model.component('scaling_factor') if scaling_suffix and scaling_suffix.ctype is pyo.Suffix: @@ -309,7 +309,9 @@ def get_obj_scaling(self): # overloaded from NLP def get_primals_scaling(self): - scaling_suffix_finder = SuffixFinder('scaling_factor') + scaling_suffix_finder = SuffixFinder( + 'scaling_factor', context=self._pyomo_model + ) primals_scaling = np.ones(self.n_primals()) ret = None for i, v in enumerate(self.get_pyomo_variables()): @@ -326,7 +328,9 @@ def get_primals_scaling(self): # overloaded from NLP def get_constraints_scaling(self): - scaling_suffix_finder = SuffixFinder('scaling_factor') + scaling_suffix_finder = SuffixFinder( + 'scaling_factor', context=self._pyomo_model + ) constraints_scaling = np.ones(self.n_constraints()) ret = None for i, c in enumerate(self.get_pyomo_constraints()): @@ -621,7 +625,9 @@ def __init__(self, pyomo_model): need_scaling = True self._primals_scaling = np.ones(self.n_primals()) - scaling_suffix_finder = SuffixFinder('scaling_factor') + scaling_suffix_finder = SuffixFinder( + 'scaling_factor', context=self._pyomo_model + ) for i, v in enumerate(self.get_pyomo_variables()): v_scaling = scaling_suffix_finder.find(v) if v_scaling is not None: