Open
Description
Summary
I ran an old pyomo model from gdplib that failed to run because of an error when running the Suffix command. It took issue with the line m.bigM = Suffix(direction=Suffix.LOCAL, initialize = 7000)
, but ran when this was changed to
m.bigM = Suffix(direction=Suffix.LOCAL)
m.bigM[None] = 7000
Steps to reproduce the issue
>>> from pyomo.environ import *
>>> m = ConcreteModel()
>>> m.bigM = Suffix(direction=Suffix.LOCAL, initialize = 1000)
...
Error Message
ERROR: Constructing component 'bigM' from data=None failed:
TypeError: 'int' object is not iterable
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\anapere\src\pyomo\build\__editable__.Pyomo-6.7.4.dev0-py2.py3-none-any\pyomo\core\base\block.py", line 571, in __setattr__
self.add_component(name, val)
File "C:\Users\anapere\src\pyomo\build\__editable__.Pyomo-6.7.4.dev0-py2.py3-none-any\pyomo\core\base\block.py", line 1116, in add_component
val.construct(data)
File "C:\Users\anapere\src\pyomo\build\__editable__.Pyomo-6.7.4.dev0-py2.py3-none-any\pyomo\core\base\disable_methods.py", line 124, in construct
return base.construct(self, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\anapere\src\pyomo\build\__editable__.Pyomo-6.7.4.dev0-py2.py3-none-any\pyomo\core\base\suffix.py", line 244, in construct
self.update_values(rule(self.parent_block(), None), expand=True)
File "C:\Users\anapere\src\pyomo\build\__editable__.Pyomo-6.7.4.dev0-py2.py3-none-any\pyomo\core\base\suffix.py", line 295, in update_values
for component, value in items:
TypeError: 'int' object is not iterable
Information on your system
Pyomo version: 6.7.3
Python version: 3.12
Operating system: Windows
How Pyomo was installed (PyPI, conda, source): Source, dev version
Solver (if applicable):
Additional information
This issue doesn't exist when using Pyomo version 6.7.0, so @emma58 suspects there was backwards compatibility that was lost in the following PR: https://github.com/Pyomo/pyomo/pull/3072/commits