OMPython icon indicating copy to clipboard operation
OMPython copied to clipboard

Fetch information from IPOPT solver

Open LukasKoenemann opened this issue 2 years ago • 1 comments

I'm currently using ModelicaSystem via OMPython to optimize my modelica model using "Built-in Dynamic Optimization using Annotations". After calling the simulate function I get the simulation results correctly (via mat.file). In addition to that, is it possible to fetch the information of the IPOPT solver (e.g. "No optimal solution found")? Afterwards I want to use the information in the postprocessing of the simulation. If I set the verbosity of the IPOPT-LOG on (-lv=LOG_IPOPT), I can see the output of the IPOPT solver in the prompt. But I want to fetch the information via OMPython.

Steps to Reproduce:

from OMPython import ModelicaSystem
model = ModelicaSystem(...)
model.setSimulationOptions('solver=optimization')
results = {}
for i in range(10):
    resultfile=f"{i}.mat"
    model.setParameters(f'p={i}')
    model.simulate(resultfile=resultfile, simflags='-optimizerNP=1')

LukasKoenemann avatar Dec 02 '23 08:12 LukasKoenemann