Gilles,

Thank you for recommending LevenbergMarquardtOptimizer. It works for our 
function. However, it seems to take much longer than BOBYQAOptimizer. Is 
this expected as it needs to compute gradient?

Andrew



From:
Gilles <[email protected]>
To:
<[email protected]>
Date:
12/19/2013 07:03 PM
Subject:
Re: [math] BOBYQAOptimizer hang



On Thu, 19 Dec 2013 08:53:14 -0500, [email protected] wrote:
> Gilles,
>
> Thank you for answering. PowellOptimizer did not work very well for 
> our
> particular function, and other optimizers in scalar.noderiv are not 
> easily
> understandable.

It would be interesting to know what you tested, and what did not work 
as
you expected, in order to look for bugs in "PowellOptimizer".

For the other optimizer, it is perhaps an issue of setting good 
parameters
and initial guess...

> BOBYQAOptimizer usually works well. Do you have
> suggestions that we might work around this particular case so it does 
> not
> hang?

I have no idea.
If I had to debug it, I'd first trace the code execution to locate 
where it
hangs.

> We minimize LS with grid (x,y) having 9 points.

Did you consider using the "LevenbergMarquardtOptimizer"?


Best regards,
Gilles

>
> Andrew
>
>
> class LS implements MultivariateFunction {
>         private BS bs = new BS();
>         private double[] x;
>         private double[] y;
>         private double const1;
>         private int optionType;
>
>         public LS(double[] x, double[] y, int optionType, double 
> const1) {
>                 this.x = x;
>                 this.y = y;
>                 this.optionType = optionType;
>                 this.const1 = const1;
>         }
>
>         @Override
>         public double value(double point[]) {
>                 int len = x.length;
>                 double val = 0;
>                 for (int i=0; i<len; i++) {
>                         double yc = bs.f2(x[i], point[0]*const1, 
> point[1],
> point[2], optionType);
>                         val += Math.pow(yc-y[i], 2);
>                 }
>                 return val;
>         }
>
> }
>
> class BS {
>         public double blackScholes(double price, double strike, 
> double
> time, double vol, int optionType) {
>             double volrootime = Math.pow(time, 0.5) * vol;
>             double topline1 = Math.log(price/strike);
>             double topline2 = Math.pow(vol, 2)/2* time;
>             double topline = topline1 + topline2;
>             double d1 = topline / volrootime;
>             double d2 = d1 - volrootime;
>
>             double val = 0.0;
>             NormalDistribution normal = new NormalDistribution();
>             if (optionType==1)
>                 val = (price * normal.cumulativeProbability(d1) - 
> strike *
> normal.cumulativeProbability(d2));
>             else
>                 val = (strike * normal.cumulativeProbability(-d2) - 
> price
> * normal.cumulativeProbability(-d1));
>
>             return val;
>         }
>
>         public double f2(double x, double ah, double ai, double aj, 
> int
> ak) {
>                 return ah*bScore(x, ai, aj, ak);
>         }
>
>         public double bScore(double price, double strike, double vol, 
> int
> optionType) {
>                 return blackScholes(price, strike, 1, vol, 
> optionType);
>         }
> }
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]




The contents of this email are the property of PNC. If it was not addressed to 
you, you have no legal right to read it. If you think you received it in error, 
please notify the sender. Do not forward or copy without permission of the 
sender. This message may contain an advertisement of a product or service and 
thus may constitute a commercial electronic mail message under US Law. The 
postal address for PNC is 249 Fifth Avenue, Pittsburgh, PA 15222. If you do not 
wish to receive any additional advertising or promotional messages from PNC at 
this e-mail address, click here to unsubscribe. 
https://pnc.p.delivery.net/m/u/pnc/uni/p.asp 
By unsubscribing to this message, you will be unsubscribed from all advertising 
or promotional messages from PNC. Removing your e-mail address from this 
mailing list will not affect your subscription to alerts, e-newsletters or 
account servicing e-mails.


Reply via email to