forum.alglib.net
http://forum.alglib.net/

BLEIC optimizer issue
http://forum.alglib.net/viewtopic.php?f=2&t=762
Page 1 of 2

Author:  Raf1600 [ Thu Jan 24, 2013 7:33 am ]
Post subject:  BLEIC optimizer issue

Hello

I am trying to use the BLEIC optimization function of the ALGLIB library to solve the constrained minimization of a convex quadratic function in the form.

C = 1/2*xT*A *x + bT*x

A symmetric and positive definite.

I get different solutions when I include explicitly the gradient of the function:

grad(C) = A*x+b

and when I let the optimizer calculate it. But the latter takes several orders of magnitude longer to finish.

Author:  Sergey.Bochkanov [ Thu Jan 24, 2013 5:14 pm ]
Post subject:  Re: BLEIC optimizer issue

1. What about function values? Are they significantly different? What is better - one obtained with analytic gradient or one obtained with numerical gradient?
2. Can you post your code here?

Author:  Raf1600 [ Fri Jan 25, 2013 7:09 am ]
Post subject:  Re: BLEIC optimizer issue

They are really different.

Its subjected to xi>=0 for all i.

Even the regions where the constraints are active are different.

With the analytical gradiente the values xi where the constraints are inactive are all the same, but with the numerical gradient they vary.

Author:  Sergey.Bochkanov [ Fri Jan 25, 2013 9:28 am ]
Post subject:  Re: BLEIC optimizer issue

Again - can you post actual code? :) I have to debug actual code to understand what is going on... In our tests we solved problems like your many times, and both methods gave same results.

Author:  Raf1600 [ Fri Jan 25, 2013 12:24 pm ]
Post subject:  Re: BLEIC optimizer issue

I've included an artificial gradient funtion, i.e. all zeros but one 1 in one of the rows and I get exactly the same solution than with the real gradient function.

The code to generate the matices is quite long but the optimization part is:

alglib.minbleicstate state;
alglib.minbleicreport rep;
double epsg = 0.000001;
double epsf = 0;
double epsx = 0;
double epso = 0.00001;
double epsi = 0.00001;
alglib.minbleiccreate(ndivX * ndivY, Press, out state);
alglib.minbleicsetlc(state, c, ct);
alglib.minbleicsetinnercond(state, epsg, epsf, epsx);
alglib.minbleicsetoutercond(state, epso, epsi);
alglib.minbleicoptimize(state, func_grad, null, null);
alglib.minbleicresults(state, out Press, out rep);

Where func_grad:

public void func_grad(double[] x, ref double func, double[] grad, object obj)
{
func = prodEsc(AB, x) + 0.5 * BilinealForm(x, T, x);
grad = sumVect(AB, ProdMatVect(T, x));
return;
}

prodEsc is a dot product funtion
BilinealForm makes the xT*A*x operations
and sumVect adds two vectors

Author:  Sergey.Bochkanov [ Mon Jan 28, 2013 8:56 am ]
Post subject:  Re: BLEIC optimizer issue

Can you post actual matrices and initial point? Maybe as attachment, or download link to some external file storage?

The problem may be caused by numerical properties of your matrices.

Author:  Raf1600 [ Thu Jan 31, 2013 8:47 am ]
Post subject:  Re: BLEIC optimizer issue

I forgot to mention another constraint that al xi must sum 187321 in this case.

I have attached a excel file with the matrices, the initial point and the solutions with analytical and numerical gradient.

Thank you for the interest by the way.

Attachments:
matrices.xlsb [222.83 KiB]
Downloaded 480 times

Author:  Raf1600 [ Thu Feb 07, 2013 10:50 am ]
Post subject:  Re: BLEIC optimizer issue

Have you been able to check it out?

Do you have any hint whether the problem is in my code or in the matrix?

Author:  Sergey.Bochkanov [ Sun Feb 10, 2013 7:41 am ]
Post subject:  Re: BLEIC optimizer issue

Your problem can be solved as follows:
1. upgrade to ALGLIB 3.7.0
2. change internal constant maxnonmonotoniclen at line 12723 of optimization.cs to 1.0E10

It should help. I did not tested your problem on 3.6.0, but on 3.7.0 it stalls because of numerical properties of the problem (high numerical noise). Proposed fix should make algorithm more tolerant to numerical noise in target function and it will be able to solve problem. I did not figured out exactly why numerical differentiation works, and analytic gradient is prone to noise, but I feel that it is not important question... maybe we have "close-to-limits" situation...

Author:  Raf1600 [ Mon Feb 11, 2013 8:09 am ]
Post subject:  Re: BLEIC optimizer issue

I've just tried and I keep getting exactly the same results.

I increased that constant up to 1E20 with no change in the results.

How can I see what the gradient the program calculates automatically?

Just to make myself sure I'm calculating the gradient properly.

Page 1 of 2 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/