ahala - 2 months ago 68

C# Question

can anyone show me examples or reviews for constrained nonlinear optimization in Microsoft Solver foundation 3.0? How's it compared to Matlab's fmincon? Or is there any better .net library for constrained nonlinear optimization? thanks,

Answer

**IMPORTANT UPDATE** on Feb 25, 2012:

MSF 3.1 now supports nonlinear optimization with bounded variables via its NelderMeadSolver solver: http://msdn.microsoft.com/en-us/library/hh404037(v=vs.93).aspx

For general linear constraints, Microsoft solver foundation only support linear programming and quadratic programming via its interior point solver. For this solver, please see the SVM post mentioned by Tomas.

MSF has a general nonlinear programming solver, Limited-Memory-BFGS, however which does not support any constraint. This solver also requires an explicit gradient function. For this solver, please see:

Logistic regression in F# using MSF

F# ODSL mentioned by Tomas only supports linear programming. I have a QP extension for it, available at codexplex.

Back to your question - optimize f(x) with linear constraints (similar to `fmincon`

), I haven't seen any free library which has this ability. NMath.NET (commercial) seems to have one. I tried that for solving a highly nonlinear optimization, but it does not work for me. At last I resorted to B-LBFGS implemented in DotNumerics.

I think you will also be interested in the following SO question:

Open source alternative to MATLAB's fmincon function?

The answers point to `SciPy.optimize.cobyla`

, which seems to be something similar to `fmincon`

. But the main message is that for your specific problem, maybe `fmincon`

is too general. You can use a more specific solver, e.g. LBFGS or QP. Also general solvers sometimes do not work if your initial value is not good.