NETLink vs LibraryLink for calling an external program
- To: mathgroup at smc.vnet.net
- Subject: [mg122733] NETLink vs LibraryLink for calling an external program
- From: Frank K <fkampas at gmail.com>
- Date: Tue, 8 Nov 2011 07:15:33 -0500 (EST)
- Delivered-to: email@example.com
I'm calling IpOpt, a COIN-OR interior point nonlinear optimizer written in C++, from Mathematica, using some C# code and NETLink. IpOpt requires calculating the objective function, the constraints, the gradient of the objective function, the gradient of the constraints and the mixed second order derivatives of the Lagrangian. The gradients of the constraints and the Lagrangian derivatives are passed in sparse form. I do all that in Mathematica and then do callbacks in the C# code (modified from csipopt) using StdLink. The C# code is called using NETLink. It's working well but I'm wondering if I could speed up the calculation significantly using LibraryLink, since I understand NETLink and C# both have overhead, especially for passing arrays. The C# code is using unsafe code talking to the IpOpt dll. For those of you wondering why I'm doing all this, rather than using FindMinimum, there are some optimization problems I'm interested in that blow up in FindMinimum.