fix(sampler): deterministic parameter matching in TPE
When two parameters share the same Distribution (e.g. two FloatParam::new(-5.0, 5.0) in one study), TpeSampler iterated trial.distributions (a HashMap) with find_map to extract a value matching the target distribution. HashMap iteration order varies across runs, so x's history could be conflated with y's history non-deterministically — making seeded TPE runs flaky in parallel test execution. Pick the smallest-ParamId match instead, so the choice is stable across runs. Also: - src/sampler/genetic.rs: collapse if into match guard (clippy) - src/lib.rs: drop std_instead_of_core lint (the only remaining hits are std::io::Error/ErrorKind, which have no stable core equivalent yet) - Cargo.toml: relax minimum versions for fastrand/tokio/tracing/ optimizer-derive; bump dev-dep tokio to 1.50 to match in-tree usage
This commit is contained in:
+5
-5
@@ -16,14 +16,14 @@ categories = ["algorithms", "science", "mathematics"]
|
||||
readme = "README.md"
|
||||
|
||||
[dependencies]
|
||||
fastrand = "2.3"
|
||||
fastrand = "2"
|
||||
thiserror = "2"
|
||||
parking_lot = "0.12"
|
||||
tokio = { version = "1.30", features = ["sync", "rt-multi-thread"], optional = true }
|
||||
optimizer-derive = { version = "0.1.0", path = "optimizer-derive", optional = true }
|
||||
tokio = { version = "1", features = ["sync", "rt-multi-thread"], optional = true }
|
||||
optimizer-derive = { version = "0.1", path = "optimizer-derive", optional = true }
|
||||
serde = { version = "1", features = ["derive"], optional = true }
|
||||
serde_json = { version = "1", optional = true }
|
||||
tracing = { version = "0.1.29", optional = true }
|
||||
tracing = { version = "0.1", optional = true }
|
||||
sobol_burley = { version = "0.5", optional = true }
|
||||
nalgebra = { version = "0.34", optional = true }
|
||||
fs2 = { version = "0.4", optional = true }
|
||||
@@ -40,7 +40,7 @@ cma-es = ["dep:nalgebra"]
|
||||
gp = ["dep:nalgebra"]
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { version = "1.30", features = ["rt-multi-thread", "macros", "time"] }
|
||||
tokio = { version = "1.50", features = ["rt-multi-thread", "macros", "time"] }
|
||||
optimizer-derive = { version = "0.1.0", path = "optimizer-derive" }
|
||||
serde_json = "1"
|
||||
criterion = { version = "0.8", features = ["html_reports"] }
|
||||
|
||||
Reference in New Issue
Block a user