nlopt icon indicating copy to clipboard operation
nlopt copied to clipboard

nlopt::AUGLAG + nlopt::LD_MMA does not work. Even the simple example in nlopt tutorial fails to converge

Open dujinpeng0249 opened this issue 2 years ago • 2 comments

I made some modifications to the code used in nlopt tutorial. Specifically, using nlopt::AUGLAG to handle the inequality constraints and the local optimizer nlopt::LD_MMA for the actual optimization. Unfortunately, this approach did not allow the problem to converge.

The modified part of the original code is as follows:

std::vector lb(2); lb[0] = -HUGE_VAL; lb[1] = 0;

nlopt::opt opt(nlopt::AUGLAG, 2); nlopt::opt local_opt(nlopt::LD_MMA, 2); local_opt.set_xtol_rel(1e-6); local_opt.set_lower_bounds(lb);

opt.set_local_optimizer(local_opt); opt.set_lower_bounds(lb); opt.set_xtol_rel(1e-5); opt.set_min_objective(myvfunc, NULL); my_constraint_data data[2] = {{2, 0}, {-1, 1}}; opt.add_equality_constraint(myvconstraint, &data[0], 1e-8); opt.add_equality_constraint(myvconstraint, &data[1], 1e-8);

If I just use nlopt::LD_MMA then I can get the desired result quickly, but after the above changes, the program runs without any result. I'm not sure what the problem is yet, can you help me see what the cause is, thank you very much!

dujinpeng0249 avatar Nov 23 '23 15:11 dujinpeng0249

Following this question, can the developers give an example of using the AUGLAG to solve problems with equality and inequality constraints? Thanks!

yufenghe22 avatar Feb 06 '24 03:02 yufenghe22

same question, AUGLAG seems never work!

stdpython avatar Mar 06 '24 08:03 stdpython