You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Adrien Andre <ad...@legos.obs-mip.fr> on 2012/08/08 14:37:49 UTC

Re: [math] Optimize non-differentiable multivariate real function with initial guess

Luc, Gilles, thank you for your quick answers !

I'll try to begin with the PowellOptimizer.
I haven't found documentation i could understand
about the optimizer constructor parameters:
The rel & abs thresholds.

But i'll start with values provided in
test.java.org.apache.commons.math3.optimization.direct.PowellOptimizerTest.doTest(MultivariateFunction,double[],double[],GoalType,double,double  
pointTol)

Regards,
Adrien


Quoting Gilles Sadowski <gi...@harfang.homelinux.org>:

> Hello.
>
>>
>> >
>> > i'm implementing in java a model which was originally developped   
>> in Matlab.
>> >
>> > The goal is to minimize a non-differentiable trivariate real function.
>> > The Matlab code calls the fminunc function
>> > x = fminunc(fun,x0,options)
>> > with x0 = [a, b, c] the initial guess, and
>> > options as 'MaxFunEvals' to 500
>> >
>> > I don't think the function is differentiable.
>> > But i'm not very skilled in math
>> > and mainly not at ease with the different parameters required for
>> > optimizers creation...
>> >
>> > Could someone advise me about which to use ?
>>
>> Look at either NelderMeadSimplex, MultiDimensionalSimplex or
>> CMAESOptimizer in the org.apache.commons.math3.optimization.direct package.
>
> The easiest would be to start with "PowellOptimizer" (in the same package).
>
> Code would be like:
> ---CUT---
>     MultivariateOptimizer optim = new PowellOptimizer();
>     MultivariateFunction f = ... your function ...
>
>     PointValuePair result = optim.optimize(500, f, GoalType.MINIMIZE,
>                                            new double[] { a, b, c});
>     double[] minimum = result.getPoint();
> ---CUT---
>
>
> Regards,
> Gilles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Re: [math] Optimize non-differentiable multivariate real function with initial guess

Posted by Gilles Sadowski <gi...@harfang.homelinux.org>.
On Wed, Aug 08, 2012 at 02:37:49PM +0200, Adrien Andre wrote:
> Luc, Gilles, thank you for your quick answers !
> 
> I'll try to begin with the PowellOptimizer.
> I haven't found documentation i could understand
> about the optimizer constructor parameters:
> The rel & abs thresholds.

Be warned that there is an inconsistency in the usage of those
tolerances in "PowellOptimizer" in Commons Math 3.0. That problem doesn't
always show up, but it could prevent finding a solution in a "reasonable"
number of evaluations.
In the development version of Commons Math, this problem should be fixed and
the tolerances refer to the absolute and relative changes of the function
value: When the function does not change anymore (within the given
tolerances), the optimizer stops.

You can download a snaphsot of Commons Math 3.1 here:
 https://repository.apache.org/content/repositories/snapshots/org/apache/commons/commons-math3/3.1-SNAPSHOT/

HTH,
Gilles

> 
> But i'll start with values provided in
> test.java.org.apache.commons.math3.optimization.direct.PowellOptimizerTest.doTest(MultivariateFunction,double[],double[],GoalType,double,double
> pointTol)
> 
> Regards,
> Adrien
> 
> 
> Quoting Gilles Sadowski <gi...@harfang.homelinux.org>:
> 
> >Hello.
> >
> >>
> >>>
> >>> i'm implementing in java a model which was originally
> >>developped  in Matlab.
> >>>
> >>> The goal is to minimize a non-differentiable trivariate real function.
> >>> The Matlab code calls the fminunc function
> >>> x = fminunc(fun,x0,options)
> >>> with x0 = [a, b, c] the initial guess, and
> >>> options as 'MaxFunEvals' to 500
> >>>
> >>> I don't think the function is differentiable.
> >>> But i'm not very skilled in math
> >>> and mainly not at ease with the different parameters required for
> >>> optimizers creation...
> >>>
> >>> Could someone advise me about which to use ?
> >>
> >>Look at either NelderMeadSimplex, MultiDimensionalSimplex or
> >>CMAESOptimizer in the org.apache.commons.math3.optimization.direct package.
> >
> >The easiest would be to start with "PowellOptimizer" (in the same package).
> >
> >Code would be like:
> >---CUT---
> >    MultivariateOptimizer optim = new PowellOptimizer();
> >    MultivariateFunction f = ... your function ...
> >
> >    PointValuePair result = optim.optimize(500, f, GoalType.MINIMIZE,
> >                                           new double[] { a, b, c});
> >    double[] minimum = result.getPoint();
> >---CUT---
> >
> >
> >Regards,
> >Gilles
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> >For additional commands, e-mail: user-help@commons.apache.org
> >
> >
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org