Thanks for the sample code; I can reproduce your problem and have a fix.

On each step, the MMA algorithm calls NLopt recursively to optimize a convex local model of the objective and constraints in a trust region. (Technically, it solves the dual problem rather than the primal one.) It looks like you are running into a limitation stemming from NLopt not solving this subsidiary problem accurately enough.

You can override NLopt's defaults for solving this subsidiary problem by the set_local_optimizer method. In particular, add the following lines to your computeNLOpt function before calling optimize:

        nlopt::opt dual_opt(nlopt::LD_LBFGS,n);
        dual_opt.set_ftol_rel(1e-14);
        optim.set_local_optimizer(dual_opt);

This fixes the problem for me.

In the next release, I should probably lower the default tolerance for the dual problem. You can alternatively do this yourself by applying the following patch to api/optimize.c. Change:
              nlopt_set_ftol_rel(dual_opt, LO(ftol_rel, 1e-12));
to
              nlopt_set_ftol_rel(dual_opt, LO(ftol_rel, 1e-14));

Steven

PS. You can feel free to set a tolerance of zero for inequality constraints. A nonzero tolerance is only really important for equality constraints.

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

Reply via email to