On Jun 27, 2010, at 8:57 AM, Lars Petter Mostad wrote:
I have been experimenting with nlopt to solve a simple(order 4) constrained least squares problem using COBYLA. Running my program on both a 32-bit Fedora 7 and a 64-bit Fedora 12 works fine, but when I when i try to run it on the embedded STLinux(http://www.stlinux.com/ ) distribution, the program prints "Floating point exception"(not a C ++ exception) and quits if i use more that about 2000 iterations.

By adding printouts at the entry and exit of my objective and constraint functions, I can see that the exception doesn't happen in my code. I don't know GDB, so, unfortunately, I can't be any more specific.

I have tried both nlopt 1.2 and 2.0.2, and I get the same thing happening. Do you have any idea about what the problem can be?

The fact that you are running COBYLA for more than 2000 iterations with only 4 unknowns probably indicates that you haven't set an appropriate stopping criterion....I doubt it takes that many iterations to converge. I'm guessing that, even on the non-embedded systems where it "works" it is returning the NLOPT_ROUNDOFF_LIMITED error code to indicate that progress has stopped because of roundoff errors. (Roundoff limitations mean that eventually COBYLA will end up with a simplex so small that roundoff errors make it singular.) Probably, you need to set larger tolerances for stopping critierion so that it doesn't try to converge better than what machine precision allows.

It may be that your embedded system is setting the floating-point unit in a different mode so that it crashes on divide by zero or something like that instead of giving infinity (NLopt checks for the infinities creeping in and halts with NLOPT_ROUNDOFF_LIMITED if they are detected).

You can try forcing any fp exceptions to kill your program on the non- embedded systems, too, by adding the following to the beginning of your program:

        #include <fenv.h>

then (in main):

        feenableexcept(FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID);

To get more information, you will have to configure NLopt with -- enable-debug, compile your progam with the -g flag, and run it under gdb. To run it under gdb, do "gdb myprogram" then, at the gdb prompt, do "run ....any arguments to myprogram....". Then gdb should give you a prompt if it crashes. At the prompt, you can type "where" to get a stack trace (tell where in the program it is) and "list" to list those lines of code, and "print ...variable..." to print the value of a variable.

Steven
_______________________________________________
NLopt-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to