Hi there, What you're describing is indeed already implemented for all the language interfaces in NLopt. For MATLAB:
http://ab-initio.mit.edu/wiki/index.php/NLopt_Matlab_Reference#Nonlinear_constraints (the line might be truncated there by my e-mail client) To quote directly: > Just as for nonlinear constraints in C, you can specify nonlinear inequality > and equality constraints by setting opt.fc and opt.h to be cell arrays of > function handles (of the same form as the objective function above) for the > inequality and equality constraints, respectively. It sounds as if you're incorrectly forming the result of your constraint functions; as mentioned, you cannot merely have functions which each return vectors, but rather you must have one function for every scalar constraint function (i.e. "one vector function" ==> "N constraint functions"), and then have all these individual constraint functions as handles in a cell array. Alternatively, you could instead be referring to bound constraints, in which case you similarly need to break them up into their constituent scalars, also covered in the documentation. To quote: > The bound constraints can be specified by setting opt.lower_bounds and/or > opt.upper_bounds to vectors of length n (the same as the length of the > initial guess passed to nlopt_optimize). Good luck, and if it turns out you meant something else, feel free to get back - just make sure you specify very clearly what you mean, and what it is that you are expecting from NLopt, so that it's possible to reach understanding, and thus a solution. Best regards, Adam Hirst On 17/03/17 11:23, 戴远航 wrote: > Hello, > > I am wondering if I can use vector-valued constraints in MATLAB when > using NLOPT. > It seems that there are already several questions about this but there > is no answer to this? > > If it is not possible, please just tell me it is not supported right > now so that I can figure out other solutions, or if possible, please let > me now how to use it. > > Thanks so much and best regards, > Dail > > > _______________________________________________ > NLopt-discuss mailing list > [email protected] > http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss > -- Using GPG? Add my key, and respond to me with it enabled! Also, feel free to verify my key with me online or in person! Not using GPG? You should, it's easy! https://www.enigmail.net/documentation/quickstart.php _______________________________________________ NLopt-discuss mailing list [email protected] http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss
