astamm / nloptr

nloptr provides an R interface to NLopt, a free/open-source library for nonlinear optimization providing a common interface to a number of different optimization routines which can handle nonlinear constraints and lower and upper bounds for the controls.
https://astamm.github.io/nloptr/
Other
106 stars 34 forks source link

Exposing nlopt functions for weighted tolerance (nlopt_set_x_weight and cie) #124

Open jchiquet opened 2 years ago

jchiquet commented 2 years ago

The three following functions detailed in the documention pages of NLopt

nlopt_result nlopt_set_x_weights(nlopt_opt opt, const double *w);
nlopt_result nlopt_set_x_weights1(nlopt_opt opt, const double w);
nlopt_result nlopt_get_x_weights(const nlopt_opt opt, double *w);

are not exposed in nloptrAPI.h. I suggest in this PR some simple modifications which hopefully give access to these functionalities.

astamm commented 1 year ago

Hi @jchiquet. I assume you already tried to use them as currently exposed in your PR and it all works smoothly?

jchiquet commented 1 year ago

Hi @jchiquet. I assume you already tried to use them as currently exposed in your PR and it all works smoothly?

Indeed. Do you need an example?

astamm commented 1 year ago

If you can provide an example, that would be ideal. I will integrate it in the unit tests so we can make sure it works on all platforms. Thanks! And happy new year!

astamm commented 1 year ago

Hi @jchiquet. The master branch is undergoing a series of patch changes. Could you update this branch to make sure it still works. And can you please add the example we discussed so that I can then merge your PR? Thanks a lot.

jchiquet commented 1 year ago

I will, but don't have time right now. Plus, this doesn't seem to be a very urgent/important fix on my side.

astamm commented 1 year ago

Hey @jchiquet. If you find 5 minutes to add an example, I could merge this PR and include it in the next release. I am planning a release soon. Thanks!