Skip to content

Commit

Permalink
Clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
NATSUME Hiroaki committed Oct 10, 2024
1 parent 6484c77 commit 7748ead
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Tunny/Solver/Python/check_duplication.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ def check_duplicate(trial):
)
for t in reversed(trials_to_consider):
if trial.params == t.params:
trial.set_user_attr(
"NOTE",
f"trial {t.number} and trial {trial.number} were duplicate parameters.",
)
if "Constraint" in t.user_attrs:
trial.set_user_attr("Constraint", t.user_attrs["Constraint"])
set_attr_to_duplicate_trial(trial, t)
return t.values
return None


def set_attr_to_duplicate_trial(base_trial, compared_trial) -> None:
base_trial.set_user_attr(
"NOTE",
f"trial {compared_trial.number} and trial {base_trial.number} were duplicate parameters.",
)
if "Constraint" in compared_trial.user_attrs:
base_trial.set_user_attr("Constraint", compared_trial.user_attrs["Constraint"])

0 comments on commit 7748ead

Please sign in to comment.