Skip to content

Updated IPOPT wrapper fails when call_counter_1 is None #469

@eirikurj

Description

@eirikurj

Description

Nightly integration tests are failing after a recent change (#459) in the pyIPOPT wrapper. The following is a snippet from the MACH-Aero tests.

Traceback (most recent call last):
  File "/home/mdolabuser/repos/MACH-Aero/tutorial/wingopt/aero/aero_opt.py", line 248, in <module>
    sol = opt(optProb, MP.sens, storeHistory=os.path.join(args.output, "opt.hst"))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/mdolabuser/.pyenv/versions/3.11.11/lib/python3.11/site-packages/pyoptsparse/pyIPOPT/pyIPOPT.py", line 308, in __call__
    x, info = nlp.solve(xs)
              ^^^^^^^^^^^^^
  File "cyipopt/cython/ipopt_wrapper.pyx", line 658, in ipopt_wrapper.Problem.solve
  File "cyipopt/cython/ipopt_wrapper.pyx", line 1262, in ipopt_wrapper.intermediate_cb
  File "/home/mdolabuser/.pyenv/versions/3.11.11/lib/python3.11/site-packages/pyoptsparse/pyIPOPT/pyIPOPT.py", line 285, in intermediate
    call_counter_2 = self.hist._searchCallCounter(self.cache["x"], last=call_counter_1 - 1)
                                                                        ~~~~~~~~~~~~~~~^~~
TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'

Based on the error it seems that call_counter_1 is None, meaning that the previous line

call_counter_1 = self.hist._searchCallCounter(self.cache["x"])

is returning None. The search function does initialize the return value to None but is not updated before returning indicating no match was found. There is no check on this output in this case call_counter_1, hence the error.

Steps to reproduce issue

Run the MACH-Aero opt test specifically test_analysis.py:TestWingOpt with only IPOPT.

Current behavior

call_counter_1 is None

Expected behavior

Should not break

Code versions

The current mdolab/public:u24-gcc-ompi-latest-amd64 image (hash: 92494833a6e2).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions