Skip to content

Commit

Permalink
NLv2: only locate / process Suffixes in the context of the model bein…
Browse files Browse the repository at this point in the history
…g written
  • Loading branch information
jsiirola committed Aug 13, 2024
1 parent 89994ae commit bc18546
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pyomo/repn/plugins/nl_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ def compile(self, column_order, row_order, obj_order, model_id):
class CachingNumericSuffixFinder(SuffixFinder):
scale = True

def __init__(self, name, default=None):
super().__init__(name, default)
def __init__(self, name, default=None, context=None):
super().__init__(name, default, context)
self.suffix_cache = {}

def __call__(self, obj):
Expand Down Expand Up @@ -646,7 +646,7 @@ def write(self, model):
# Data structures to support variable/constraint scaling
#
if self.config.scale_model and 'scaling_factor' in suffix_data:
scaling_factor = CachingNumericSuffixFinder('scaling_factor', 1)
scaling_factor = CachingNumericSuffixFinder('scaling_factor', 1, model)
scaling_cache = scaling_factor.suffix_cache
del suffix_data['scaling_factor']
else:
Expand Down

0 comments on commit bc18546

Please sign in to comment.