Skip to content

Rename NSGAIISampler to NsgaiiSampler in Rust - #265

Merged
c-bata merged 1 commit into
mainfrom
refactor/rename-nsgaii-sampler
Oct 5, 2026
Merged

c-bata merged 1 commit into
mainfrom
refactor/rename-nsgaii-sampler

Conversation

@Alnusjaponica

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #212: align the sampler type name with the NsgaiiBuilder naming (per the discussion with ozaki-san and PE baba-san).

Changes

  • rustuna_sampler::nsgaii::NSGAIISampler → rustuna_sampler::nsgaii::NsgaiiSampler2
    • struct, Default, Sampler impl, NsgaiiBuilder2::build, new, seed_from_u64 signatures, and the tests in nsgaii.rs
    • doc examples updated accordingly
  • rustuna_pyo3: PyNSGAIISampler2 → PyNsgaiiSampler (src/sampler/nsgaii.rs, study.rs, lib.rs)
  • rustuna_sampler/benches/nsgaii.rs: bench uses NsgaiiSampler::default()

Unchanged (Rust-only rename):

  • The Python-visible class name rustuna.samplers.NSGAIISampler (#[pyclass(name = "NSGAIISampler2")]), .pyi stubs, rustuna/samplers.py, Python tests, and docs
  • The parent cache key prefix "NSGAIISampler2:parent:"
  • References to Optuna's NSGAIISampler in doc comments

Verification

  • cargo clippy --locked --workspace --lib --bins --tests --examples --all-features -- -D warnings — clean
  • cargo test --locked --all-features — pass
  • cargo fmt --all -- --check — clean
  • cargo +nightly bench --no-run — bench compiles (uses NsgaiiSampler::default())
  • Python: uv run pytest tests/ — 701 passed, 18 skipped
  • cargo test -p rustuna_storage --locked -- --ignored — 3 pass

The Python-visible class name `rustuna.samplers.NSGAIISampler` (pyclass name),
the parent cache key prefix, and references to Optuna's sampler are kept unchanged.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

The PR description incorrectly documents several renamed symbols with a nonexistent 2 suffix.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Renames the Rust NSGA-II sampler types while preserving the Python-visible API.

Changes:

  • Renames NSGAIISampler to NsgaiiSampler.
  • Updates Rust benchmarks, tests, documentation, and PyO3 internals.
  • Retains Python class name NSGAIISampler.
File Description
rustuna_sampler/​src/​nsgaii.rs Renames the sampler and references.
rustuna_sampler/​benches/​nsgaii.rs Updates benchmark usage.
rustuna_pyo3/​src/​study.rs Updates PyO3 sampler resolution.
rustuna_pyo3/​src/​sampler/​nsgaii.rs Renames the internal Python wrapper.
rustuna_pyo3/​src/​lib.rs Registers the renamed wrapper.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

/// }
/// ```
pub struct NSGAIISampler {
pub struct NsgaiiSampler {

@c-bata c-bata 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.

@c-bata
c-bata merged commit aa68144 into main Oct 5, 2026
8 checks passed
@c-bata
c-bata deleted the refactor/rename-nsgaii-sampler branch October 5, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants