- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to optimize an exponential multivariable function using the TR solver (dtrnlsp_solve). I have been going over it for a week and the solver fails miserably. All I get everytime is "NaN" for the coefficients. The same problem is optimized in C# NI libraries.
The function is sometime like F(x) = a0 + sum(ai*exp(-x/ti)) (i=1 to 6)
'ai' and 'ti' are my design variables. (Vector X)
I understand it's difficult to gague without further details? Generally, any ideas of what's wrong? Is it normal for the solver to behave this way at times for certain equations? I have successfully used the solver for optimizing other equations.
Also, I can't seem to find good examples for the central differences solver (DJACOBI_SOLVE). The one described in the manual is very limited and has a lot of errors. Can anyone point me to certain examples using the central differences solver?
Thanks,
Shriram
--
Mechanica Engineer - FEA Development
Moore Nanotechnology Systems
Swanzey, NH - 03431
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As I understood, F(x) is not differentiableif t = 0. Moreover, if t approaches 0 then the objective function is unbounded. I would recommend changing aninitial point or using solver for problems with boundary constraints (where X > 0).
Please let me know how it works.
Thank you!
--Nikita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the reply.
I am not sure if the function should cause any problem. The same function is optimized very well using National Instruments curvefit library. That however uses the Leverberg-Marquardt algorithm and Intel uses the Trust-Region algorithm.
- I am not sure what you mean by an unbounded function. As t nears zero, the exponential term nears 1 and the function returns a constant value. At t=0, the exponential terms are all equal to 1. The function values are still finite.
- I was under the impression that the Trust-Region algorithm was a derivative free method. If t = 0, the function value is a constant and hence the derivative is zero.
However, I tried assigning lower bounds and changing initial guesses, but with little or no success to the results. After certain iterations, the design variables and function values suddenly become "NaN". I can't understand this unexpected behavior.
But, as you say, if I remove the data points which are equal to 0 or have very small values (like 1E-7, 1E-3) etc. then the solver does a much better job.
Thanks again,
Shriram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Shriram,
Actually, TR solvers are not derivative free methods, users objective function F(x) = y f(x), where F(x): Rn ->Rm, m>=nshould bea twice differentiable function in Rn.
As of your function, it is unbounded, if t nears 0 and t < 0. Something likes that
F(x) = 1.935444e+44, t = -1.000000e-02
F(x) = 1.295015e+49, t = -9.000000e-03
F(x) = 1.393615e+55, t = -8.000000e-03
F(x) = 7.932340e+62, t = -7.000000e-03
F(x) = 1.736785e+73, t = -6.000000e-03
F(x) = 5.202701e+87, t = -5.000000e-03
F(x) = 2.697447e+109, t = -4.000000e-03
F(x) = 4.189477e+145, t = -3.000000e-03
F(x) = 1.010586e+218, t = -2.000000e-03
F(x) = inf, t = -1.000000e-03
F(x) = 1.200000e+00, t = 0.000000e+00
F(x) = 1.200000e+00, t = 1.000000e-03
F(x) = 1.200000e+00, t = 2.000000e-03
Did try to use solver for problems with boundary constraints [ T > 0] and use initial point [ T > 0 ]?
Thank you!
--Nikita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think I had tried with lower bounds greater than 0, and still had the same problems. However, I will still make sure once again as what you say makes good sense.
Thanks Nikita!
Shriram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had a quick question. I can specify the lower and upper bounds and use the function 'dtrnlspbc_xxx' solver.
However, I have no upper bound and I cannot set an arbitrary number. Is it possible to set a lower bound and have upper bound, unbounded?
Thanks,
Shriram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Or you can use max. value of double precision as upper bound.
Thank you!
--Nikita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is difficult to repeat it; sequential calls with the same input will complete the optimization smoothly or have the NaN in a random fashion. Is there a threading problem?
It happens on different machines.
We've noticed that it usually happens more regualrly in Release mode than in Debug mode.
All of this has led us to suspect it was related to memory management, like the CLR's garbage collector, by Release mode optimizations performed by the compiler, or by Interop marshalling problems. I am not very familiar with all of these topics. We are pinning all 3 arrays ("x", "fec", and "fjac") as is necessary to send the arrays to MKL as pointers. In trying to fix the issue, I used GCHandle.Alloc (followed by GCHandle.Free at the end of the optimization call) to pin the arrays in another way, and it still fills the x array with NaN occasionally. I've also tried making a deep copy of the x array before function evaluations, also to no avail.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page