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

{rep} in {minlmoptimize} returns broken number in {func}
http://forum.alglib.net/viewtopic.php?f=2&t=447
Page 1 of 1

Author:  jakmer [ Fri Sep 23, 2011 7:43 am ]
Post subject:  {rep} in {minlmoptimize} returns broken number in {func}

Hi,
when I use minlmoptimize with the reporting function, the double func value of the objective function does not seem to get initialized - returns 1e+134 (and the optimization problem ends at the initial point with endcriteria==4 -> flat gradient). Would you have some pointers for me as to when such behaviour can be expected? (I am not able to post the code here, since it is a part of bigger project).
Thanks.

Author:  Sergey.Bochkanov [ Mon Sep 26, 2011 5:15 am ]
Post subject:  Re: {rep} in {minlmoptimize} returns broken number in {func}

Can you post at least some snippet, some part of your code? I've tried to trace all possible control paths - in all cases report fields are correctly initialized. I will make further investigation today, but having at least parts of your code will be very helpful.

Author:  jakmer [ Mon Sep 26, 2011 10:57 am ]
Post subject:  Re: {rep} in {minlmoptimize} returns broken number in {func}

I managed to solve it myself, in the objective function I was using operator= with real_1d_array {fi} in the left hand side (hoping that the memory allocation etc. will be done correctly). Now I am copying the objFun array into {fi} by element and all works ok.

Author:  Sergey.Bochkanov [ Mon Sep 26, 2011 11:58 am ]
Post subject:  Re: {rep} in {minlmoptimize} returns broken number in {func}

Delegate which calculates objective function is defined as

Code:
public delegate void ndimensional_fvec (double[] arg, double[] fi, object obj)


As you may see, it is possible to assign some array directly to fi. But - because it is passed without "ref" - this assignment won't modify original array. This change will be visible within function only.

It was done on purpose because a) excessive memory allocations may cost too much (even in C#), so this design tries to reduce number of allocations, and b) in order to avoid corruption of the internal memory structures, i.e. to restrict access to the array - you can access its elements, but can't change array size.

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