Pyomo / pyomo

An object-oriented algebraic modeling language in Python for structured optimization problems.
https://www.pyomo.org
Other
2.01k stars 518 forks source link

cyipopt fails with load_solutions=False #2958

Open ZedongPeng opened 1 year ago

ZedongPeng commented 1 year ago

Summary

cyipopt solver will fail when we set load_solution=False.

Steps to reproduce the issue

https://github.com/Pyomo/pyomo/blob/99dc0f17159ef94a0599096a116b04089d25d7d4/pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_block.py#L199-L223

Change line 223 to solver.solve(m,load_solutions=False)

Error Message

$ # Output message here, including entire stack trace, if available
======================================================================
ERROR: test_solve_square (__main__.TestExternalGreyBoxBlock)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/zedongpeng/Github/pyomo/pyomo/contrib/pynumero/interfaces/tests/test_external_pyomo_block.py", line 223, in test_solve_square
    solver.solve(m,load_solutions=False)
  File "/Users/zedongpeng/Github/pyomo/pyomo/contrib/pynumero/algorithms/solvers/cyipopt_solver.py", line 405, in solve
    sm = nlp.symbol_map
AttributeError: 'PyomoNLPWithGreyBoxBlocks' object has no attribute 'symbol_map'

Information on your system

Pyomo version: 6.6.2.dev0 Python version: 3.10.12 Operating system: macOS How Pyomo was installed (PyPI, conda, source): source Solver (if applicable): cyipopt

Additional information

ZedongPeng commented 1 year ago

Any suggestions or thoughts about this? @jsiirola