File tree 2 files changed +8
-7
lines changed
pyomo/contrib/pynumero/interfaces
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change 31
31
)
32
32
from pyomo .contrib .pynumero .interfaces .external_grey_box import ExternalGreyBoxBlock
33
33
from pyomo .contrib .pynumero .interfaces .nlp_projections import ProjectedNLP
34
+ from pyomo .core .base .suffix import SuffixFinder
34
35
35
36
36
37
# Todo: make some of the numpy arrays not writable from __init__
@@ -227,12 +228,12 @@ def __init__(self, pyomo_model):
227
228
need_scaling = True
228
229
229
230
self ._primals_scaling = np .ones (self .n_primals ())
230
- scaling_suffix = pyomo_model . component ('scaling_factor' )
231
- if scaling_suffix and scaling_suffix . ctype is pyo . Suffix :
232
- need_scaling = True
233
- for i , v in enumerate ( self . _pyomo_model_var_datas ) :
234
- if v in scaling_suffix :
235
- self ._primals_scaling [i ] = scaling_suffix [ v ]
231
+ scaling_suffix_finder = SuffixFinder ('scaling_factor' )
232
+ for i , v in enumerate ( self . _pyomo_model_var_datas ) :
233
+ v_scaling = scaling_suffix_finder . find ( v )
234
+ if v_scaling is not None :
235
+ need_scaling = True
236
+ self ._primals_scaling [i ] = v_scaling
236
237
237
238
self ._constraints_scaling = BlockVector (len (nlps ))
238
239
for i , nlp in enumerate (nlps ):
Original file line number Diff line number Diff line change 20
20
from pyomo .common .tempfiles import TempfileManager
21
21
from pyomo .opt import WriterFactory
22
22
import pyomo .core .base as pyo
23
- from pyomo .core .base .suffix import SuffixFinder
24
23
from pyomo .common .collections import ComponentMap
25
24
from pyomo .common .env import CtypesEnviron
26
25
from pyomo .solvers .amplfunc_merge import amplfunc_merge
27
26
from ..sparse .block_matrix import BlockMatrix
28
27
from pyomo .contrib .pynumero .interfaces .ampl_nlp import AslNLP
29
28
from pyomo .contrib .pynumero .interfaces .nlp import NLP
29
+ from pyomo .core .base .suffix import SuffixFinder
30
30
from .external_grey_box import ExternalGreyBoxBlock
31
31
32
32
You can’t perform that action at this time.
0 commit comments