Repository navigation
Conversation
Track pharmsol main (e684464) and adapt to its breaking changes: - simulate_subject_dense -> simulate; bind_error_models -> validate_error_models - EquationTypes removed from the prelude re-exports - AssayErrorModels is keyed by OutputLabel; error optimisation, cycle CSV output and nonparametric validation now work with labels - Prediction::outeq() returns &OutputLabel; NPPredictionRow::outeq follows - Output/route labels match exactly (no outeq_N/input_N alias), so examples, benches and tests use numeric labels that match the data
Contributor
|
| Project | PMcore |
| Branch | chore/pharmsol-main |
| Testbed | mhovd-pgx |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result milliseconds (ms) (Result Δ%) | Upper Boundary milliseconds (ms) (Limit %) |
|---|---|---|---|
| bimodal_ke_npag | 📈 view plot 🚷 view threshold | 3,539.70 ms(-18.54%)Baseline: 4,345.58 ms | 6,448.85 ms (54.89%) |
| bimodal_ke_npod | 📈 view plot 🚷 view threshold | 802.24 ms(-38.79%)Baseline: 1,310.54 ms | 2,051.75 ms (39.10%) |
| bimodal_ke_postprob | 📈 view plot 🚷 view threshold | 343.06 ms(-12.01%)Baseline: 389.89 ms | 836.87 ms (40.99%) |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The upgrade makes residual error models label-keyed, but ParametricBuilder still stores them under dense indices, leaving constructed problems without models under their actual output labels.
1 open issue
What changed in this PR
Migrates PMcore to pharmsol main to assess API migration costs and performance ahead of a published release.
Changes:
- Updates simulation calls and error-model validation for the new APIs.
- Adapts error-factor optimization, prediction output, and cycle logs to label-keyed models.
- Replaces prefixed input/output aliases with exact numeric labels in examples, benchmarks, and tests.
| File | Description |
|---|---|
tests/bestdose_tests.rs |
Migrates test models to exact numeric labels. |
src/lib.rs |
Removes the EquationTypes re-export. |
src/iov/optimizer.rs |
Uses the renamed simulation API. |
src/estimation/problem.rs |
Validates assay models using exact output labels. |
src/estimation/nonparametric/predictions.rs |
Preserves output labels in prediction rows. |
src/estimation/nonparametric/cycles.rs |
Adapts cycle logging to label-keyed models. |
src/bestdose/cost.rs |
Updates simulation calls and converts prediction labels to numeric keys. |
src/algorithms/nonparametric/error_optim.rs |
Indexes optimization steps by model enumeration position. |
src/algorithms/mod.rs |
Updates simulation calls and label debug output. |
examples/vanco.rs |
Uses the renamed simulation API. |
examples/vanco_sde/main.rs |
Migrates routes, outputs, and assay labels. |
examples/two_eq_lag/main.rs |
Migrates input, lag, output, and assay labels. |
examples/theophylline/main.rs |
Migrates route, output, and assay labels. |
examples/new_iov/main.rs |
Migrates route, output, and assay labels. |
examples/neely/main.rs |
Migrates multiple outputs and assay labels. |
examples/meta/main.rs |
Migrates infusion, output, and assay labels. |
examples/iov/main.rs |
Migrates route, output, and assay labels. |
examples/drusano/main.rs |
Migrates multiple inputs, outputs, and assay labels. |
examples/chain_algorithms.rs |
Migrates the chained-estimation example’s labels. |
examples/bimodal_ke/main.rs |
Migrates the benchmark example’s labels. |
examples/bimodal_ke_backend_compare.rs |
Aligns labels across DSL, legacy, and macro models. |
examples/bestdose/main.rs |
Updates DSL labels and their explanatory comment. |
Cargo.toml |
Points pharmsol at its Git main branch. |
benches/bimodal_ke.rs |
Migrates model and assay labels for all benchmark cases. |
Review effort: Balanced
| ] } | ||
| faer = "0.24.0" | ||
| pharmsol = "0.29.2" | ||
| pharmsol = { git = "https://github.com/LAPKB/pharmsol.git", branch = "main" } |
mhovd
marked this pull request as draft
October 29, 2026 08:20
This was referenced Oct 29, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Points PMcore at
pharmsolmain (e684464, ahead of 0.29.4) to measure the migration cost and the performance impact. Because this is a git dependency it can't be published as-is; it's meant to be merged once pharmsol cuts a release.Size of the change
24 files, +133 / −147. Most of it is mechanical.
Library (
src/, ~9 files)simulate_subject_dense→simulate;bind_error_models→validate_error_models;EquationTypesno longer re-exported.AssayErrorModelsis now aBTreeMap<OutputLabel, _>(pharmsol#392):error_optim:gamma_deltais indexed by enumeration position instead of the output index.cycles.csv: closures take&OutputLabel.validate_nonparametric_error_models: finds the error model for each observed output by resolving its label, instead of going through the removed bound/dense models. Theouteq_<N>fallback (resolve_output_index) is deleted to match pharmsol.Prediction::outeq()returns&OutputLabel:NPPredictionRow::outeq()now returns&OutputLabel(public API change).Examples / benches / tests (~15 files)
pharmsol#383 removed the
1↔outeq_1/input_1aliasing; labels now have to match exactly. Every model changesouteq_N/input_N→N, e.g.outputs: [1],infusion[1],y[1],"1"inAssayErrorModels::add. Downstream users with prefixed names will hit this at runtime, not at compile time.Behaviour changes worth noting
AssayErrorModels::add("outeq_1", …)stored the model whereiter()couldn't see it, so NPAG/NPOD skipped gamma/lambda optimisation andcycles.csvhad nogamlam.*column. Both now work. (The pharmsol#392 commit message describes this bug.)pred.csvouteqcolumn now holds the data label (1) instead of the dense 0-based slot (0).cycles.csvheader isgamlam.<label>(e.g.gamlam.1).Numerical check (bimodal_ke example, NPAG)
The extra cycles come from the error-model optimisation that now runs. It does two extra Ψ evaluations per cycle, and with
lambda = 0those are no-ops.Performance (
cargo bench --bench bimodal_ke, Criterion, same machine, baseline = main)bimodal_ke_npagbimodal_ke_npodbimodal_ke_postprobNPAG improves less because it now does more work: ~11 % more cycles plus the extra Ψ evaluations. NPOD and postprob are closer to the raw simulator gain, about 27 %.
Testing
cargo test --all-features: 84 passed, 0 failed.cargo clippy --all-targets --all-features: no new warnings (the 2 that remain are on main too).meta,drusano(solver stiffness) andvanco(label mismatch) fail identically on main, so they aren't regressions.iov/vanco_sdewere capped at 90 s with no errors.