On Jan 16, 2012, at 5:25 AM, Norman Violet wrote: > Am 12.01.2012 14:32, schrieb Steven G. Johnson: >>> In my Matlab program I use NLOpt this way: >> Ah, you are calling NLopt from Matlab. That explains it; currently, there >> is no way to force termination in the Matlab interface. You have to call it >> from another language to use nlopt_force_stop. >> > Ah, okay. In this case I would kindly ask for such an option. Why not > use NaN or -Inf as a trigger value? Of course I don't know the source > code, but it could be possible to look out for those values and call > nlopt_force_stop automatically, couldn't it?
This is a good suggestion, at least for the Matlab interface where it is not really feasible to call nlopt_force_stop directly. I just added this into the code, and it will be in the next release. > Thinking about it, it might be better to use -Inf than NaN since it can > happen to get an NaN as the result of the cost functional (in particular > with algorithms not based on gradients). At least this is my experience > with Matlab. I think I prefer using NaN, as the only other reason for user code to produce a NaN value is a bug; there is no reasonable way to do optimization with NaNs. (Whereas Inf values could in principle be worked with to some extent, even if most of the NLopt algorithms probably don't handle them properly.) _______________________________________________ NLopt-discuss mailing list [email protected] http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss
