coin-or / Ipopt

COIN-OR Interior Point Optimizer IPOPT
https://coin-or.github.io/Ipopt
Other
1.36k stars 272 forks source link

Auto computing jacobian and gradient #753

Closed bharswami closed 3 months ago

bharswami commented 4 months ago

Is there a provision in ipopt for auto-computing jacobian and gradient? i.e. we don't have to specify those functions explicitly. Or do we have to use dependencies like mklJac etc? Thanks in advance Bharath

svigerske commented 4 months ago

Ipopt itself only includes an AMPL interface, so that if you use AMPL (or something else that generates .nl files, e.g., Pyomo), you will get AMPL's automatic differentiation.

But then there are a number of automatic differentiation packages and modeling systems that have interfaces to Ipopt: https://coin-or.github.io/Ipopt/#HOWTOUSE

bharswami commented 4 months ago

Thanks Stefan. Also, in the cpp_example, there is a call to the function IpoptApplicationFactory(). SmartPtr app = IpoptApplicationFactory(); Is this defined in a pre-built library? P.S.: I am trying to run ipopt problems in visual studio

svigerske commented 4 months ago

Yes, IpoptApplicationFactory() should be available in DLLs. It doesn't do much, you should also be able to do a new Ipopt::IpoptApplication from your code.

https://github.com/coin-or/Ipopt/blob/5fd746337021543e78dc2d167cb1c15db81f68e1/src/Interfaces/IpIpoptApplication.cpp#L33-L38

bharswami commented 4 months ago

I was able to fix that by adding the path to the DLLs. Visual Studio is now telling me that Ipopt-vc8.dll cannot be opened

bharswami commented 4 months ago

I guess the libraries were built with mingw or something - not suited for MSVS2022. Any suggestions/workarounds?

svigerske commented 4 months ago

Ipopt-vc8.dll sounds like a very old version of Ipopt. Binaries for current Ipopt are available at different places: https://github.com/coin-or/Ipopt?tab=readme-ov-file#precompiled-binaries

bharswami commented 4 months ago

Thanks Stefan. I am getting the error "ipopt-3.dll not found". Could this be a version incompatibility issue since I am using VS2022?

svigerske commented 4 months ago

It looks more of a problem of making sure that the library can be found. Check your library search paths, e.g., environment variable PATH.

bharswami commented 3 months ago

It is building fine. But not able to execute/debug. I strongly feel its a version compatibility issue since I tried with VS2019 as well. Was ipopt-3.dll built using mingW or something? image

bharswami commented 3 months ago

Also have a look at the dependencies I have. image image

bharswami commented 3 months ago

I tried adding these to the PATH environment variable as well

bharswami commented 3 months ago

Hi Stefan, The issue was fixed by renaming the "ipopt.dll.lib" to "ipopt-3.lib"