forum.alglib.net http://forum.alglib.net/ |
|
Getting Results from CG optimisation http://forum.alglib.net/viewtopic.php?f=2&t=522 |
Page 1 of 1 |
Author: | Hen3ry [ Sat Jan 21, 2012 7:09 pm ] |
Post subject: | Getting Results from CG optimisation |
I am having great trouble getting results from the mincgresults() function. The code is as follows: Code: alglib::real_1d_array lambdaJout; lambdaJout.setlength(lenJ); for (int i = 0; i < lenJ; i++) { lambdaJout[i] = 0.0; } alglib::mincgcreatef(lambdaJguess, diffstep, cgstate); alglib::mincgsetcond(cgstate, epsg, epsf, epsx, maxits); alglib::mincgsetscale(cgstate, lambdascale); alglib::mincgsetprecscale(cgstate); alglib:mincgoptimize(cgstate, CG_opt, NULL, ptr); mincgresults(cgstate, lambdaJout, cgrep); printf("cg rep termination = %i\n", int(cgrep.terminationtype)); FILE* lambdaoptout = fopen("lambdaopt.txt", "w"); for (int i = 0; i < lenJ; i++) { fprintf(lambdaoptout, "%i %e\n", i, lambdaJout[i]); } fclose(lambdaoptout); It seems that no matter what I try to do with mincgresults, I cannot get anything but zeros in the print statement. The code runs, and the cg rep termination result is 1, but lambdaJout never seems to change. I can post more of the code if needed, and would very much appreciate an help people can offer. Thanks. |
Author: | Sergey.Bochkanov [ Mon Jan 23, 2012 5:55 am ] |
Post subject: | Re: Getting Results from CG optimisation |
Please, post all code which works with ALGLIB: a) initialization of lambdaJguess, diffstep and other parameters, b) CG_opt() function, c) everything else which can influence results. I will help you with this issue, but I need more info :) |
Author: | Hen3ry [ Tue Jan 24, 2012 5:54 pm ] |
Post subject: | Re: Getting Results from CG optimisation |
Dear Sergey, I have found that my error comes from having very badly miscalculated the scaling. Have fixed this, and now get results. Thank you for your response, and for creating the library. |
Page 1 of 1 | All times are UTC |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |