Skip to content

Commit

Permalink
Address comments by Alnusjaponica
Browse files Browse the repository at this point in the history
  • Loading branch information
nabenabe0928 committed Nov 6, 2023
1 parent 0d8ab14 commit de32944
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions multi_objective/quadratic_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
Optuna example that optimizes simple quadratic functions.
In this example, we optimize two objective values.
Unlike a single-objective optimization, an optimization gives the trade-off between two objectives.
As a result, we get best trade-offs between two objectives, a.k.a Pareto solutions.
Unlike single-objective optimization, an optimization gives a trade-off between two objectives.
As a result, we get the best trade-offs between two objectives, a.k.a Pareto solutions.
"""

Expand Down
6 changes: 3 additions & 3 deletions quadratic_simple_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ def constraints(trial):

print("Number of finished trials: ", len(study.trials))

feasible_trial_ids = [
feasible_trial_numbers = [
trial.number
for trial in study.trials
if all(c <= 0.0 for c in trial.system_attrs["constraints"])
]
if len(feasible_trial_ids) == 0:
if len(feasible_trial_numbers) == 0:
print("No trials satisfied all the constraints.")
else:
best_trial_id = sorted(feasible_trial_ids, key=lambda i: study.trials[i].value)[0]
best_trial_id = sorted(feasible_trial_numbers, key=lambda i: study.trials[i].value)[0]
best_trial = study.trials[best_trial_id]
print(f"Best trial was found at Trial#{best_trial_id}")
print(f" Params: {best_trial.params}")
Expand Down

0 comments on commit de32944

Please sign in to comment.