数值求解非线性方程 [英] Solving nonlinear equations numerically

查看:84
本文介绍了数值求解非线性方程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在我的Java程序中解决非线性最小化(N个未知数的最小剩余平方)问题.解决这些问题的常用方法是 Levenberg-Marquardt 算法.我有几个问题

I need to solve nonlinear minimization (least residual squares of N unknowns) problems in my Java program. The usual way to solve these is the Levenberg-Marquardt algorithm. I have a couple of questions

  • 有人对各种可用的LM实现有经验吗? LM的风格略有不同,我听说算法的确切实现对其数值稳定性有重大影响.我的功能表现良好,因此这可能不会成为问题,但是我当然想选择一种更好的选择.这是我找到的一些替代方法:

  • Does anybody have experience on the different LM implementations available? There exist slightly different flavors of LM, and I've heard that the exact implementation of the algorithm has a major effect on the its numerical stability. My functions are pretty well-behaved so this will probably not be a problem, but of course I'd like to choose one of the better alternatives. Here are some alternatives I've found:

  • FPL Statistics Group's Nonlinear Optimization Java Package. This includes a Java translation of the classic Fortran MINPACK routines.

JLAPACK ,另一个Fortran翻译.

JLAPACK, another Fortran translation.

优化算法工具包.

Java数字.

某些Python实现.纯Python会很好,因为可以使用jythonc将其编译为Java.

Some Python implementation. Pure Python would be fine, since it can be compiled to Java with jythonc.

是否有常用的启发式方法来进行LM所需的初始猜测?

Are there any commonly used heuristics to do the initial guess that LM requires?

在我的应用程序中,我需要对解决方案设置一些约束,但是幸运的是它们很简单:我只要求解决方案(以成为物理解决方案)为非负数.略有负的解决方案是数据中测量不准确的结果,并且显然应该为零.我当时在考虑使用常规" LM,但要进行迭代,以便在某些未知数变为负数时,将其设置为零,然后从中解决其余问题.真正的数学家可能会嘲笑我,但是您认为这可行吗?

In my application I need to set some constraints on the solution, but luckily they are simple: I just require that the solutions (in order to be physical solutions) are nonnegative. Slightly negative solutions are result of measurement inaccuracies in the data, and should obviously be zero. I was thinking to use "regular" LM but iterate so that if some of the unknowns becomes negative, I set it to zero and resolve the rest from that. Real mathematicians will probably laugh at me, but do you think that this could work?

感谢您的任何意见!

更新:这不是火箭科学,要求解的参数数量(N)最多为5,并且数据集不足以使求解成为可能,因此我相信Java相当足以解决这个问题.我相信这个问题已经被聪明的应用数学家解决了很多次,所以我只是在寻找一些现成的解决方案,而不是自己动手做.例如.如果它是纯Python,则Scipy.optimize.minpack.leastsq可能会很好.

Update: This is not rocket science, the number of parameters to solve (N) is at most 5 and the data sets are barely big enough to make solving possible, so I believe Java is quite efficient enough to solve this. And I believe that this problem has been solved numerous times by clever applied mathematicians, so I'm just looking for some ready solution rather than cooking my own. E.g. Scipy.optimize.minpack.leastsq would probably be fine if it was pure Python..

推荐答案

我同意codehippo;我认为解决约束问题的最佳方法是使用专门设计用于处理约束的算法.在这种情况下,L-BFGS-B算法可能是一个很好的解决方案.

I agree with codehippo; I think that the best way to solve problems with constraints is to use algorithms which are specifically designed to deal with them. The L-BFGS-B algorithm should probably be a good solution in this case.

但是,如果在您的情况下,使用python的scipy.optimize.fmin_l_bfgs_b模块不是一个可行的选择(因为您使用的是Java),则可以尝试使用我编写的库:Java封装的原始Fortran代码L-BFGS-B算法.您可以从 http://www.mini.pw.edu.pl下载/〜mkobos/programs/lbfgsb_wrapper ,看看它是否符合您的需求.

However, if using python's scipy.optimize.fmin_l_bfgs_b module is not a viable option in your case (because you are using Java), you can try using a library I have written: a Java wrapper for the original Fortran code of the L-BFGS-B algorithm. You can download it from http://www.mini.pw.edu.pl/~mkobos/programs/lbfgsb_wrapper and see if it matches your needs.

这篇关于数值求解非线性方程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆