See:

        
http://ab-initio.mit.edu/wiki/index.php/NLopt_Matlab_Reference#Nonlinear_constraints

In particular, in the tutorial example just replace opt.fc and opt.fc_tol with opt.h and opt.h_tol, respectively.

On Mar 30, 2011, at 7:59 PM, Chang wrote:

Steven,

I understand what you said in C/C++/Python, but how to deal with equality constraints in Matlab? treat them the same as inequality ones? Thanks.

Jerry


On Wed, Mar 30, 2011 at 5:53 PM, Steven G. Johnson <[email protected] > wrote: In the current tutorial, both of the constraints are active at the optimum point. So, you can just change them into equality constraints instead of inequality constraints and it should get the same answer.

That is, just change

       nlopt_add_inequality_constraint

into

   nlopt_add_equality_constraint

and then change the algorithm to something that supports equality constraints, e.g. NLOPT_LD_SLSQP or NLOPT_LN_COBYLA.

Steven

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


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

Reply via email to