commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gilles <>
Subject Re: [math] some debug features would be useful in optim package.
Date Tue, 09 Jul 2013 21:55:10 GMT

> I am trying to extends the optim package for my own needs, keeping in
> mind that I may possibly contribute to common-math. So I try to stick
> to the general design philosophy of common-math
> In my project, I do need to compare the performance of different
> algorithm. So I need to keep track not
> only of initial guess, final results and number of iteration, but 
> also
> of intermediate results. For instance, it would be gread to have an
> option to keep track of the trajectory, for instance as an array of
> values that can be retrieved at the end. Something like (using the 
> yet yo be
> developped "fluent" interface).
>   class MyOptimizer implement DebuggableOptim ...
>   MyOptimizer optim = new MyOptimiser().withDebuggable(true) ;
>   PointValuePair resultPair = optim.optimize(...) ;
>   PointValuePair [] trajectory = optim.getTrajectory() ;

Although I agree that it can be useful to keep track of how an
algorithm reached the result, I'm wary to make it part of the
optimizer's API.
In fact a user could define a functionality like this by
extending the "ConvergenceChecker" classes:

public class ConvergenceTracker extends SimpleValueChecker {
     private final List<PointValuePair> path;

     public ConvergenceTracker(final double relativeThreshold,
                               final double absoluteThreshold,
                               final List<PointValuePair> path) {
         super(relativeThreshold, absoluteThreshold);
         this.path = path;

     public boolean converged(final int iteration,
                              final PointValuePair previous,
                              final PointValuePair current) {
         return super.converged(iteration, previous, current);

> For my own purpose, I am developping implementation of different
> gradient based optim methods not
> available yet with 3.2 (simple gradient, Newton and quasi-Newton 
> methods)
> To do so I also implemented a general purpose
> abstract public class NumericallyDerivableMultivariateFunction
> implements MultivariateFunction {
>  ...
> This class impement the gradient and hessian matrix based on finite
> differences
> If it can be of any use

The features certainly look interesting.

> yours truly
> François Laferriere
> P.S. I previously submitted this stuff to "user" list and Gilles
> suggested to push it on the dev list

Next step would be: code, unit tests, ... :-)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message