bayesian-optimization / BayesianOptimization

A Python implementation of global optimization with gaussian processes.
https://bayesian-optimization.github.io/BayesianOptimization/index.html
MIT License
7.95k stars 1.55k forks source link

Constrained optimization does not allow duplicate points #436

Closed YoungJaeBae closed 1 year ago

YoungJaeBae commented 1 year ago

Using bayesian-optimization 1.4.3, in bayesian_optimization.py line 135-155 ,


        if constraint is None:
            # Data structure containing the function to be optimized, the
            # bounds of its domain, and a record of the evaluations we have
            # done so far
            self._space = TargetSpace(f, pbounds, random_state=random_state,
                                      allow_duplicate_points=self._allow_duplicate_points)
            self.is_constrained = False
        else:
            constraint_ = ConstraintModel(
                constraint.fun,
                constraint.lb,
                constraint.ub,
                random_state=random_state
            )
            self._space = TargetSpace(
                f,
                pbounds,
                constraint=constraint_,
                random_state=random_state
            )
            self.is_constrained = True

constrained optimization does not pass argument allow_duplicate_points to initialization of TargetSpace instance, eventually causing errors.

Is this intended behavior?

till-m commented 1 year ago

I don't think this is intended behaviour (@bwheelz36?).

@YoungJaeBae Would you be willing to provide a fix?

YoungJaeBae commented 1 year ago

Thank you for answering. I am not familiar with contributing. Would you please do me a favor?

Best Regards,

till-m commented 1 year ago

Not sure I understand your question correctly, but if you're asking how to contribute:

  1. Fork this repository
  2. In your forked version of this repository, fix the problem.
  3. Open a pull request from your repository (where the problem has been fixed) to this repository.
  4. A maintainer of this repository (e.g. me) will review the pull request and merge your contribution.

See also here.