nlopt
nlopt copied to clipboard
nlopt::AUGLAG + nlopt::LD_MMA does not work. Even the simple example in nlopt tutorial fails to converge
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
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!
Following this question, can the developers give an example of using the AUGLAG to solve problems with equality and inequality constraints? Thanks!
same question, AUGLAG seems never work!