Skip to content

Commit

Permalink
adding SuffixFinder to PyomoGreyBoxNLP
Browse files Browse the repository at this point in the history
  • Loading branch information
bknueven committed Jun 20, 2024
1 parent e7bfad9 commit 8215ef8
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pyomo/contrib/pynumero/interfaces/pyomo_nlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,12 +598,12 @@ def __init__(self, pyomo_model):
need_scaling = True

self._primals_scaling = np.ones(self.n_primals())
scaling_suffix = self._pyomo_nlp._pyomo_model.component('scaling_factor')
if scaling_suffix and scaling_suffix.ctype is pyo.Suffix:
need_scaling = True
for i, v in enumerate(self.get_pyomo_variables()):
if v in scaling_suffix:
self._primals_scaling[i] = scaling_suffix[v]
scaling_suffix_finder = SuffixFinder('scaling_factor')
for i, v in enumerate(self.get_pyomo_variables()):
v_scaling = scaling_suffix_finder.find(v)
if v_scaling is not None:
need_scaling = True
self._primals_scaling[i] = v_scaling

self._constraints_scaling = []
pyomo_nlp_scaling = self._pyomo_nlp.get_constraints_scaling()
Expand Down

0 comments on commit 8215ef8

Please sign in to comment.