This patch enables the fit
command to use alternative minimization algorithms. The active fitting code can be changed using
set fit backend [internal | cminpack | lmfit | minuit | mpfit | pmfit].
show fit
will report the active choice and available backends (depending on the available libraries). Currently 5 alternatives are implemented:
cminpack
uses F. Devernay's C/C++ implementation of MINPACK (version 1.3.x),lmfit
uses J. Wuttke's variant of MINPACK (version 3.x only!),mpfit
uses C. Markwardt's MINPACK code (version 1.2),minuit
uses the CERN Minuit2 package,pmfit
uses Petr Mikulik's marqfitp.The marqfitp
code is included in the patch in a slightly modified form. All other backends require the respective library to be installed. The Minuit code in this patch is not derived from patch 202 in any way.
The patch is meant as a proof-of-principle and support of some of the backends is incomplete. The idea is to compare the performance of gnuplot's fitting code with other (well-known) minimization packages. Some of the backends might eventually be included in gnuplot. The licenses of all of the libraries used seem to be compatible with gnuplot's.
Would it be possible to make these available via a plugin mechanism rather than as configuration options? That would allow people to use a standard gnuplot package for Windows/linux/OSX and only have to struggle with getting the appropriate external library built.
Certainly, but this would require to expose a lot of gnuplot internals including function evaluation, user variables, error handling etc. Building
cminpack
orminuit
e.g. on Windows with MSYS/MinGW is rather trouble free. So I am doubtful about the benefits.Of the three MINPACK variants I will only choose
cminpack
because it is most widely available and has a full fledged (albeit Fortran'ish) interface. It outperforms gnuplot's internal fitting code in many cases. Also, this backend is now mature enough to go into CVS now (update pending). Later, I would like to addminuit
, too.I am not too happy with the
set fit backend internal/minuit/cminpack
command, though. Any better idea?