Skip to content

Improve doc for best_trial/best_trials in constrained optimization - #6522

Merged
y0z merged 2 commits into
optuna:masterfrom
not522:best-trial-doc
Mar 25, 2026
Merged

y0z merged 2 commits into
optuna:masterfrom
not522:best-trial-doc

Conversation

@not522

@not522 not522 commented Mar 18, 2026

Copy link
Copy Markdown
Member

Motivation

Resolve #6242
best_trial and best_trials support constrained optimization in #5426, but it is not reflected in the document.

Description of the changes

Adding the note for constrained optimization in the document of best_trial and best_trials.

@not522 not522 added the document Documentation related. label Mar 18, 2026

@y0z y0z left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Describing the behavior when no feasible trial exists would be helpful.

if len(feasible_trials) == 0:
raise ValueError("No feasible trials are completed yet.")

trials = [t for t in trials if t.state == TrialState.COMPLETE]
if consider_constraint:
trials = _get_feasible_trials(trials)
if len(trials) == 0:
return []

@y0z y0z self-assigned this Mar 19, 2026
@not522

not522 commented Mar 24, 2026

Copy link
Copy Markdown
Member Author

Thank you. I've updated doc for no feasible trials. PTAL.

@y0z y0z left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@y0z
y0z merged commit a73ef0c into optuna:master Mar 25, 2026
12 checks passed
@y0z y0z added this to the v4.9.0 milestone Mar 25, 2026
@y0z y0z removed their assignment Mar 25, 2026
@not522
not522 deleted the best-trial-doc branch March 27, 2026 06:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

document Documentation related.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NSGAII Sampler Pareto Front Logic inconsistency

2 participants