I am new to pyomo, so this is a basic question about the capabilities/restrictions of pyomo as a whole. I have read most of the "Optimization Modeling in Python" textbook about using pyomo, and I believe that pyomo would be a great tool for me to use for a modeling project I am currently working on. However, I do have one concern. In many equations in my model, I need to access a Fortran library linked through a DLL (it's a commercial equation of state). The functions in this Fortran library are very non-linear. From what I understand, non-linear pyomo equations must be represented through the non-linear functions provided from the pyomo library. Is there any way to use pyomo while using this DLL, or would I need to rebuild all of the functions in the Fortran library in python with pyomo functions?
Pyomo can support models that have external function calls through two mechanisms (but both come with a long list of caveats):
ExternalFunction
Component
ExternalGreyBox
Component (in pyomo.contrib.pynumero
).
pyomo.contrib
). The API may change with little notice as pynumero
is further developed.ExternalGreyBox
components is cyipopt
.In addition to these options, @AirSquid is correct that other options exist (and can frequently provide good results), including approximations (surrogate models), or translating the underlying mathematics into Pyomo.
Finally, you might consider looking at the IDAES library (https://github.com/IDAES/idaes-pse), which has implemented equations of state in Pyomo (including the direct implementation route, custom external functions, and calls out to third-party packages [like CoolProp]).