Closed SH2282000 closed 1 year ago
Maybe just
import warnings warnings.filterwarnings("ignore", message=".Lambda as constraint is not advised because it may not be picklable.")
By the way, note that "register_cheap_constraint" is useful only when the objective function is computationally much more expensive that the constraints. Otherwise the other tool is "constraint_violation". In most applications I use "constraint_violation", but "register_cheap_constraint" is better when the objective function is very expensive and/or does not work when constraints are violated. Reopen the issue or post in https://www.facebook.com/groups/nevergradusers if you need help with constraints, I know that we have not enough doc and users suffer a bit with that.
Steps to reproduce
When finding the minimum
x
that fulfill a specific constraint: if this last constraint is defined as a lambda function, the following warning is thrown:Therefore, I replaced my lambda definition:
...by a function definition...
However, as specified in the documentation, I should be able to use a lambda function for constraining my optimization. I need more information on that, to know if this is a bug or am I misusing NGOpt.
Observed Results
When the lambda definition is replaced by a function definition. No warnings are thrown.
Expected Results
No warnings thrown as in the documentation.
Relevant Code