Skip to content

Introduce NsgaiiBuilder and TpeBuilder for samplers - #212

Open
Alnusjaponica wants to merge 2 commits into
mainfrom
feat/nsgaii-builder
Open

Alnusjaponica wants to merge 2 commits into
mainfrom
feat/nsgaii-builder

Conversation

@Alnusjaponica

@Alnusjaponica Alnusjaponica commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Replace the XxxConfig/from_config construction pattern with builders following the API style of std::thread::Builder: settings are configured by chaining setter methods and the sampler is created with build.

let sampler = NSGAIISampler::builder()
    .population_size(100)
    .mutation_prob(0.1)
    .crossover_prob(0.9)
    .swapping_prob(0.5)
    .seed(42)
    .build();

let sampler = TpeSampler::builder()
    .n_startup_trials(20)
    .multivariate(true)
    .seed(42)
    .build();

Changes

  • Add NsgaiiBuilder and TpeBuilder (with Default) exposing builder(), chainable setters, and build()
  • Remove NsgaiiConfig/TpeConfig and from_config
  • Keep new, seed_from_u64, and Default on the samplers for backward compatibility; they now delegate to the builders
  • Update the pyo3 bindings to construct samplers through the builders

@Alnusjaponica
Alnusjaponica marked this pull request as draft August 18, 2026 02:40
@c-bata c-bata self-assigned this Aug 19, 2026
Replace the XxxConfig/from_config construction pattern with builders
following the API style of std::thread::Builder: settings are configured
by chaining setter methods and the sampler is created with `build`.

NSGAIISampler and TpeSampler keep `new`, `seed_from_u64` and `Default`
for backward compatibility, and they now delegate to the builders. The
pyo3 bindings construct samplers through the builders as well.
@Alnusjaponica Alnusjaponica changed the title Introduce NsgaiiConfig for NSGAIISampler Introduce NsgaiiBuilder and TpeBuilder for samplers Sep 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants