class_docstr: Operator for applying a constraint on a Parameter
  
  Parameters
  ----------
  func: function
      the constraint function, taking the same arguments that the function to optimize.
      This constraint function must return a float (or a list/tuple/array of floats),
      positive if the constraint is not satisfied, null or negative otherwise.
  optimizer: str
      name of the optimizer to use for solving the constraint
  budget: int
      the budget to use for applying the constraint
  
  Example
  -------
  >>> constrained_parameter = Constraint(constraint_function)(parameter)
  >>> constrained_parameter.value  # value after trying to satisfy the constraint
class_docstr_tok: ["Operator","for","applying","a","constraint","on","a","Parameter","Parameters","--","--","--","--","--","func",":","function","the","constraint","function",",","taking","the","same","arguments","that","the","function","to","optimize",".","This","constraint","function","must","return","a","float","(","or","a","list\/tuple\/array","of","floats",")",",","positive","if","the","constraint","is","not","satisfied",",","null","or","negative","otherwise",".","optimizer",":","str","name","of","the","optimizer","to","use","for","solving","the","constraint","budget",":","int","the","budget","to","use","for","applying","the","constraint","Example","--","--","--","-",">",">",">","constrained_parameter","=","Constraint","(","constraint_function",")","(","parameter",")",">",">",">","constrained_parameter.value","#","value","after","trying","to","satisfy","the","constraint"]
docstr: Find a new parameter that better satisfies the constraint
docstr_tok: ["Find","a","new","parameter","that","better","satisfies","the","constraint"]
code: def apply_constraint(
      self, parameter: core.Parameter
  ) -> core.Parameter:
      """Find a new parameter that better satisfies the constraint"""
      # This function can be overriden
      optim = self._opt_cls(parameter, budget=self._budget)
      early_stopping = callbacks.EarlyStopping(self.stopping_criterion)
      optim.register_callback("ask", early_stopping)
      optim.minimize(self.function)
      return optim.pareto_front()[0]
  
file_path: nevergrad/nevergrad/ops/constraints.py
imports: import numpy
  import nevergrad.common.typing
  from nevergrad.common import errors
  from nevergrad.parametrization import core
  from nevergrad import optimizers
  from nevergrad import callbacks
label_desc: Use image node_id 3 for calling the Constraint obj's underlying member method code with example usage: obj.apply_constraint(parameter) and returns: optim