Pyomo / PyomoGallery

A collection of Pyomo examples
Other
282 stars 158 forks source link

Error with symbol_map creation in asl_io.write.write_nl #24

Open vvvol opened 1 month ago

vvvol commented 1 month ago

On attempt to run simplest example in asl_io.write I have an error AttributeError: 'float' object has no attribute 'model' The error occurs in line #28 of write.py in preparing symbol_cuid_pairs . I use Python 3.11.4 (miniconda) and Pyomo 6.7.1 It is the first time when I see this error on using Pyomo and your excellent asl_io functions. Bad news is that I have got the same error and with other Pyomo models...

vvvol commented 1 month ago

FYI, this error appears with various Python 3.* interpreters but for Pyomo version younger than 6.5.0 only ! For Pyomo v. 6.5.0 and older the function write.write_nl() works normally.

Engberg-Jacob commented 12 hours ago

Thank you for this issue - I couldn't figure the problem either, so I've downgraded my Pyomo version. I haven't been able to figure out which part of the 6.6.0 update broke this functionality. In 6.7.3, I got an error of AttributeError: 'NoneType' object has no attribute 'model' The error specifically calls to

  File "**\Python312\Lib\site-packages\pyomo\core\base\componentuid.py", line 414, in _generate_cuid
    model = component.model()
            ^^^^^^^^^^^^^^^

but I simply can't figure out what the update changed. Thank you for the functions, and if anyone can see a fix, I'd love to see it