forum.alglib.net

ALGLIB forum
It is currently Sun Dec 22, 2024 8:58 pm

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: {rep} in {minlmoptimize} returns broken number in {func}
PostPosted: Fri Sep 23, 2011 7:43 am 
Offline

Joined: Fri Sep 23, 2011 7:29 am
Posts: 2
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.


Top
 Profile  
 
 Post subject: Re: {rep} in {minlmoptimize} returns broken number in {func}
PostPosted: Mon Sep 26, 2011 5:15 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
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.


Top
 Profile  
 
 Post subject: Re: {rep} in {minlmoptimize} returns broken number in {func}
PostPosted: Mon Sep 26, 2011 10:57 am 
Offline

Joined: Fri Sep 23, 2011 7:29 am
Posts: 2
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.


Top
 Profile  
 
 Post subject: Re: {rep} in {minlmoptimize} returns broken number in {func}
PostPosted: Mon Sep 26, 2011 11:58 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 927
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 17 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group