Hi Weiyi, On Tue, Mar 20, 2012 at 8:41 PM, Weiyi Zhang <[email protected]> wrote: > Hi, I'm very new to NLopt. I implemented the C++ example on NLopt Tutorial > page(http://ab-initio.mit.edu/wiki/index.php/NLopt_Tutorial) to get > myself familiar with this library. It worked all fine with LD_MMA and > LN_COBYLA until I changed the algorithm into LN_NELDERMEAD. I could pass the > compilation but got > "terminate called after throwing an instance of 'std::invalid_argument' > what(): nlopt invalid argument > Aborted" > returned when I tried to run it. Can someone enlighten me what went wrong > here? It's really confusing to me that one optimization problem that runs > fine in one algorithm couldn't pass another one. Thank you!
This is likely because LN_NELDERMEAD doesn't support non-linear constraints (like those in the example). >From all the local Local derivative-free methods (LN_), only COBYLA supports nonlinear constraints. It is said here: http://ab-initio.mit.edu/wiki/index.php/NLopt_Algorithms#Local_gradient-based_optimization And yes, sometimes it is confusing, the what() in the exception could be more descriptive, although I think it is not in practice because the C portion of the code doesn't handle exceptions messages (just return error codes), it is only at the C++ level that the exception is thrown, and by that time the exact reason for "invalide argument" is lost. Alfredo > > _______________________________________________ > NLopt-discuss mailing list > [email protected] > http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss > -- Alfredo Correa, Ph.D. Condensed Matter and Materials Division Lawrence Livermore National Laboratory _______________________________________________ NLopt-discuss mailing list [email protected] http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss
