Note: this is a follow-up of a discussion started off-list about including Brent minimizing algorithm (which is not the same algorithm as Brent solver already provided by [math]).
Gilles Sadowski a écrit : > Hello. > >> ----- "Gilles Sadowski" <gil...@harfang.homelinux.org> a écrit : > > [Note: I'm replying from my other email account.] > >>> OK, I've adapted my code to use the "BrentSolver" root finder from >>> the Commons-Math library. >>> >>> Now, we are wiping all the "Numerical Recipes" code ;-). >>> Problem: I currently use a largely NR-inspired version of the Brent >>> *minimum* finding algorithm. Did you foresee to include this in >>> Commons-Math? At first sight, I think that it would amount to make a >> Yes. We want to add this and some others like classical golden-ratio. >> This is related to issue https://issues.apache.org/jira/browse/MATH-177 >> (which is specified for multidimensional algorithms). > >>> new "BrentMinimizer" class that would be a copy of "BrentSolver" >>> except for the method that implements the algorithm itself: >>> >>> private double solve(final UnivariateRealFunction f, >>> <rest of the arguments ...>) >> probably to be replaced by "minimize" I guess. > > In Commons-Math there currently is an "estimation" package, an "analysis" > package and an "optimization" package. I'm not sure I understand where you > would want to put this "BrentMinizer" class which I've proposed. The estimation and optimization packages will most probably be refactored. They are difficult to understand as is and too specialized. The concept of measurement is for example not general enough and difficult to understand. I think there should be a minimization package with a few interfaces and some implementations of low level algorithms for univariate cases (golden section, Brent) and multivariate cases (steepest descent, conjugate gradient, Gauss-Newton ...). Then another package should provide higher level concepts like measurements, physical model. > > IMHO, there is a close relationship between the functionality already > present in "UnivariateRealSolverImpl" (in package "analysis") and what is > required for implementing Brent's minimization algorithm in Commons-Math, so > I'd suggest putting it there (see below). This is also possible. Perhaps minimization should be a sub-package of analysis ? In this case, solving should also be made a sub-package. This would avoid cluttering the package too much. > >>> If that seems correct, I'm willing to try to implement that new method >>> (based on the description in Brent's book). >>> What do you think? >> This would be great! However, since we want to redesign the minimization >> part, we should start discussing about this on the developers mailing list. >> This allows more people to join the conversation and provide their own >> views on the topic. > > Now I'm subscribed to the ML, hence you can move the rest of the discussion > over there. Fine. Let's continue here. > >> We are always looking for new contributors (and perhaps later commiters). >> The first steps are to provide patch using the JIRA system. > > I don't know how to do that; is there an explanation somewhere? Our JIRA issue system is here: http://issues.apache.org/jira/browse/MATH, you have already used it to register issue MATH-218. When you are logged in, you can "Attach file to this issue" using a link in the left menu. I would suggest to attach the files to the existing issue MATH-177. So you can create the issue asking for the minimization method and immediately after attach the files to it. A mail is sent automatically to us and the issue and files are publicly visible so anybody can comment on them. Committers can pick the files there to commit them when everybody has agreed. > Anyways, I've attached the files which I've created/modidied in order to add > the new algorithm. Here is the output of "svn status" (in directory > "trunk"): Thanks. Please put them on Jira too so that other people can look at them. > > ? src/test/org/apache/commons/math/analysis/BrentMinimizerTest.java > ? src/java/org/apache/commons/math/analysis/BrentMinimizer.java > M src/java/org/apache/commons/math/analysis/UnivariateRealSolver.java > M src/java/org/apache/commons/math/analysis/UnivariateRealSolverImpl.java > > In summary: To make it useful as a minimum finder, I added a method in > "UnivariateRealSolver": > > public double getFunctionValue(); > > and the implementation bits (instance variable and methods) in > "UnivariateRealSolverImpl": > > private double functionValue; > public double getFunctionValue() { return functionValue; } > public void setResult(double x, double fx, int iterationCount) { ... } > > And running "mvn test" shows: > > Results : > > Tests run: 1473, Failures: 0, Errors: 0, Skipped: 0 > >> The patches are reviewed and checked in by existing commiters. > > Let me know what you think. I will try to have a look this week. Luc > > Best, > Gilles > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org