非线性最小二乘优化库对于C [英] Non-linear Least Squares Optimization Library for C
问题描述
我在寻找一个在C库,将做一个目标函数的优化(preferrably Levenberg-Marquardt算法),并支持框约束,线性不等式约束和非线性不等式约束。
I'm looking for a library in C that will do optimization of an objective function (preferrably Levenberg-Marquardt algorithm) and will support box constraints, linear inequality constraints and non-linear inequality constraints.
我试过几个库了,但他们没有做聘用必要的约束类型为我的应用程序:
I've tried several libraries already, but none of them do employ the necessary constraint types for my application:
- GNU GSL (does not support constraints at all)
- cMPFIT (only supports box constraints)
- levmar (does not support non-linear constraints at all)
我目前正在探索 NLopt ,但我不知道如果我能实现最小二乘与任何提供的算法接近。
I am currently exploring NLopt, but I'm not sure if I can achieve a least-squares approach with any of the supplied algorithms.
我觉得很难相信,有没有一个单一的库配套齐全在这个问题上的限制,所以我想我做了一个错误的地方,而谷歌搜索。
I find it hard to believe that there's not a single library supporting the full range of constraints in this problem, so I guess I did a mistake somewhere while googling.
我最近发现我可以从C调用Matlab的功能,而这将很容易解决这个问题,我不希望有从C调用Matlab的功能,这还不算快在我的经验。
I recently discovered I can call Matlab functions from C. While that would solve the problem quite easily, I don't want to have to call Matlab functions from C. It's not fast in my experience.
任何帮助将大大AP preciated。
Any help will be greatly appreciated.
推荐答案
我终于遵循的方法如下:
The approach I finally followed is the following:
-
我用 NLopt ,在优化和目标功能的构建计算问题的误差平方和
I used NLopt for the optimization and the objective function was constructed to compute the squared error of the problem.
这显示出最有前途的结果对算法进行了 COBYLA (本地免费导数的优化)。它支持框约束和非线性约束。线性不平等的限制被介绍为非线性的限制,这应该是一般可行的。
The algorithm that showed the most promising results was COBYLA (Local derivative-free optimization). It supports box constraints and non-linear constraints. The linear inequity constraints were introduced as non-linear constraints, which should be generally feasible.
简单的基准测试表明,它确实收敛比列弗-MAR做法有点慢,但速度由于牺牲了需要进行限制。
Simple benchmarking shows that it does converge a little slower than a Lev-Mar approach, but speed is sacrificed due to the need for constraints.
这篇关于非线性最小二乘优化库对于C的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!