- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
On rare occasions, my function DLCONF from the IMSL library exceeds maximum number of function evaluations and I guess it is because my function is flat for some iterations. To avoid that problem, I am curious if there is a way to compute a maximum number of iterations needed to get a convergence as in DZBREN (another IMSL library)?
So before calling DLCONF, I would like to compute the number of iterations needed to get a convergence and call some other routine if maximum number of iterations exceeds my preset value of MAXFCN. So I can avoid that particular iteration with a different routine and my program does not stop iterating? DLCONF so far is fast and I don’t want to entirely switch to a new subroutine.
best
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Read the IMSL documentation on ERSET. You can control whether error messages are printed, and whether the program terminates when an error condition (such as exceeding the iteration limit) is reached. Using ERSET, you can tell IMSL to return control to you when LCONF has failed, following which you can call LCONF with a different starting point and possibly relaxed accuracy requirement, or call a different routine.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can specify the maximum number of iterations to be allowed using the optional argument MAXFCN (see the IMSL documentation). You have to estimate what is a reasonable value to specify based on your experience and your knowledge of the function. More complex functions and more optimization variables usually require larger values of MAXFCN.
On the other hand, in general it is impossible calculate in advance a value for the number of iterations that will ensure convergence to a specified tolerance after starting from some arbitrary initial guess for the variables. Often it is impossible even to know in advance that a solution will be reached if MAXFCN is effectively infinite.
Here is a simple example (from root finding, not optimization). Suppose I wish to solve x2 = 4, and I decide to use the iteration scheme xn+1 = 4/xn, x0 = 1. We get x1 = 4, x2 = 1, ..., which goes on for ever without converging. On the other hand, the iteration xn+1 = (xn + 4/xn)/2 works nicely. In this trivial case, we can work out the convergence rate, but if you have not seen this example before you may be somewhat surprised by the behavior of the iterates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
mecej4 wrote:
You can specify the maximum number of iterations to be allowed using the optional argument MAXFCN (see the IMSL documentation). You have to estimate what is a reasonable value to specify based on your experience and your knowledge of the function. More complex functions and more optimization variables usually require larger values of MAXFCN.
On the other hand, in general it is impossible calculate in advance a value for the number of iterations that will ensure convergence to a specified tolerance after starting from some arbitrary initial guess for the variables. Often it is impossible even to know in advance that a solution will be reached if MAXFCN is effectively infinite.
Thanks a lot for that, I have already set MAXFCN to a reasonably high number and as you suggested even if I set it to infinity I may not get a solution. In my case, I get a solution if I use a different routine but it is at least 2 times slower than DLCONF. I was curious if it is possible to estimate the number of iterations if which convergence is guaranteed (see IMSL routine of DZBREN in which a formula is provided such that the number of iterations to get convergence can be computed). I was hoping to avoid those instances by using a different routine.
For instance, is it possible to embed into my code smth like, if maximum number of evaluations are reached for DLCONF, use XXXX routine so that the code does not stop iterating?
best
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Read the IMSL documentation on ERSET. You can control whether error messages are printed, and whether the program terminates when an error condition (such as exceeding the iteration limit) is reached. Using ERSET, you can tell IMSL to return control to you when LCONF has failed, following which you can call LCONF with a different starting point and possibly relaxed accuracy requirement, or call a different routine.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page