Skip to content

BruteForceSampler stops before suggesting all combinations in parallel optimization #5780

@not522

Description

@not522

Expected behavior

BruteForceSampler should suggest all parameter combinations, but it stops unexpectedly before that in parallel optimization.

Environment

  • Optuna version:4.2.0.dev
  • Python version:3.9.4
  • OS:macOS-15.1-x86_64-i386-64bit
  • (Optional) Other libraries and their versions:

Error messages, stack traces, or logs

See the following MRE.

Steps to reproduce

import time
import optuna

def objective(trial):
    x = trial.suggest_int("x", 0, 1)
    time.sleep(x)
    y = trial.suggest_int("y", 0, 1)
    return x + y

sampler = optuna.samplers.BruteForceSampler(seed=42)
study = optuna.create_study(sampler=sampler)
study.optimize(objective, n_jobs=2)
[I 2024-11-22 17:43:20,854] A new study created in memory with name: no-name-86ca63d9-e334-4237-a5a5-854dd2483f9f
[I 2024-11-22 17:43:20,855] Trial 0 finished with value: 1.0 and parameters: {'x': 0, 'y': 1}. Best is trial 0 with value: 1.0.
[I 2024-11-22 17:43:20,856] Trial 2 finished with value: 0.0 and parameters: {'x': 0, 'y': 0}. Best is trial 2 with value: 0.0.
[I 2024-11-22 17:43:21,861] Trial 1 finished with value: 1.0 and parameters: {'x': 1, 'y': 0}. Best is trial 2 with value: 0.0.

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue/PR about behavior that is broken. Not for typos/examples/CI/test but for Optuna itself.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions