mixle.doe.constrained module¶
Constrained Bayesian optimization over a bounded input space (WS-E).
Extends the unconstrained GP-BO loop (mixle.doe.bayesopt) to problems with black-box
inequality constraints c_k(x) <= 0. The objective and each constraint get their own GP
surrogate; candidates are scored by a feasibility-weighted acquisition
merit(x) = acquisition(x) * prod_k P(c_k(x) <= 0)
where the per-constraint feasibility probability comes from that constraint’s GP posterior,
P(c_k <= 0) = Phi(-mean_k / std_k) (Gardner et al., 2014). The acquisition’s incumbent is the
best feasible objective seen so far; until a feasible point is found the search is driven by
feasibility alone, then switches to improving the objective within the feasible region.
- class ConstrainedBayesOptResult(x, y, best_x, best_y, c, feasible)[source]
Bases:
BayesOptResultOutcome of a constrained Bayesian-optimization run.
cholds the(N, K)observed constraint values (feasible rows have all entries<= 0) andfeasibleis the corresponding boolean mask.best_x/best_yare the best feasible point; if no feasible point was found they fall back to the least-infeasible observation.- c: ndarray
- feasible: ndarray
- probability_of_feasibility(mean, std)[source]
Return the per-point probability that all constraints are satisfied (
c_k <= 0).meanandstdare(n, K)posterior predictive moments of theKconstraint surrogates. Returns an(n,)array, the product over constraints ofPhi(-mean_k / std_k). Where a constraint’sstdis zero the feasibility is deterministic (1.0 ifmean <= 0).
- propose_next_constrained(x, y, c, bounds, n_candidates=512, seed=None, *, maximize=False, xi=0.0, acq='ei', acq_kwargs=None, fit_kwargs=None, return_acquisition=False)[source]
Propose the next point under inequality constraints
c_k(x) <= 0.Fits a GP to the objective
(x, y)and one GP per constraint column ofc(an(N, K)array), then maximizes the feasibility-weighted acquisition overn_candidatesLatin-hypercube points. Until a feasible observation exists the acquisition factor is held at 1 so the search targets feasibility; afterwards the incumbent is the best feasible objective. Returns the chosen(d,)point, optionally with its merit.- Parameters:
- Return type:
- constrained_minimize(objective, constraints, bounds, n_init=5, n_iter=15, seed=None, *, maximize=False, xi=0.0, acq='ei', acq_kwargs=None, n_candidates=512, fit_kwargs=None)[source]
Constrained GP Bayesian optimization of
objectivesubject toconstraintsoverbounds.Each callable in
constraintsmaps a(d,)point to a scalar that is feasible when<= 0. Seeds with ann_init-point Latin-hypercube design, then runsn_iterfeasibility-weighted acquisition steps. Minimizes the objective by default; returns the best feasible point (or the least-infeasible one if none feasible) along with the full evaluation history.