could some one please tell me if it is possible to perform a least squares fit with additional constraints implemented through lagrange multipliers in root? I have had looked but I could seem to find a clear reliable answer, if it turns out that it is possible could someone please direct me to an example or an idea as to how this is done? cheers
There are packages available outside the root code.
See for example the package APLCON by Volker Blobel (written in FORTRAN).
I also have some (experimental) root-based code, but at present it only works for linear constraints.
If you are interested, please let me know.
the experimental code you refer to is it similar to this example http://roofit.sourceforge.net/docs/classref/examples/fitgen2.cc.html
I was going to attempt to implement this for my case which has non-linear constraints but if it as you say it only works for linear ones then perhaps I wont bother.
do you (or anyone else) know of a c++ library which can handle lagrange multipliers? I have had a look but couldnt find anything
The example you refer is a constraint minimization using a penalty function. You can actually use lagrangian multipliers plus a penalty functions to solve the equality constraint problem. In this case you can have an iterative procedure and use Minuit, see for example en.wikipedia.org/wiki/Augmented_ … ian_method
However, I will try to use the APLCON package pointed out by Stefan. For other package you can see Nag, which provide constraint optimisation using different methods (see nag.co.uk/numeric/CL/nagdoc_ … conts.html)
You need a license, but maybe they give you a trial license if you are at some reasearch institute.
I had written a plugin in ROOT for (nag_opt_nlp), but I need to complete for the constraint support. I can give you the code if you are interested.
Otherwise you can try to use free package like ab-initio.mit.edu/wiki/index.php/NLopt
Please let me know if you find this package useful, so eventually we could include an interface for it in ROOT.
thanks for the references.
The specific problem I am trying to solve is to minimize a multidimensional nonlinear function. Initially I didnt have any constraints so I followed essentially the same minimization as found in the example http://root.cern.ch/drupal/content/numerical-minimization. I then realisaed that I had additional constraints which are quadratic functions of the unknowns.
It was initially suggested that I use Lagrange multipliers but perhaps this penalty function/penalty function plut lagrange multiplier would be better. What would you recommend for my specific problem?
You might try to use en.wikipedia.org/wiki/Augmented_ … ian_method with Minuit,
from root.cern.ch/drupal/content/nume … nimization.
If you fail, try to use one of the package I referenced before, depending what is more convenient for you. I have not much experience with them to say which one is better to use.