Add mrp_generic: generic driver for sequential sampling#639
Draft
DLWoodruff wants to merge 11 commits intoPyomo:mainfrom
Draft
Add mrp_generic: generic driver for sequential sampling#639DLWoodruff wants to merge 11 commits intoPyomo:mainfrom
DLWoodruff wants to merge 11 commits intoPyomo:mainfrom
Conversation
Adds a model-agnostic CLI driver for sequential sampling confidence intervals, analogous to generic_cylinders for decomposition. Supports both EF and cylinder-based xhat generation, two-stage and multi-stage problems, and BM/BPL stopping criteria. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #639 +/- ##
==========================================
+ Coverage 70.16% 70.93% +0.77%
==========================================
Files 153 155 +2
Lines 18905 19077 +172
==========================================
+ Hits 13265 13533 +268
+ Misses 5640 5544 -96 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Add test_mrp_generic.py to the confidence-intervals CI job and run_coverage.bash so MRP code is included in coverage reports. Expand tests with mock-based coverage of _cylinder_xhat_generator, multistage/cylinders branches in do_mrp, parse_mrp_args, and the mrp_generic __main__ block. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- The confidence-intervals CI job doesn't install pytest, so run test_mrp_generic.py directly (it has unittest.main()). - Increase max_iterations from 3 to 10 in test_mrp_cylinders.py so xhatshuffle has enough iterations to find an inner bound on CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The bash example was orphaned: not invoked by any CI job, not included in run_coverage.bash, and not referenced from the rst docs. Add an end-to-end invocation step to the confidence-intervals job and a matching run_phase in run_coverage.bash so flag/path rot gets caught, and point at the script from doc/src/seqsamp.rst for discoverability. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- farmer_mrp_generic.bash now takes an optional solver arg / SOLVERNAME env and defaults to xpress, so CI (which lacks a cplex license) can run it. - parse_mrp_args registers the full set of decomposition args (proper bundles, fixer, gapper, tracking, rho groups, etc.) so --xhat-method=cylinders no longer crashes on cfg.unpickle_bundles_dir in name_lists. - run_coverage.bash forwards its SOLVER to farmer_mrp_generic.bash. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The inner-loop xhat step was drawing int(mult*nk) / mult*(nk-nk_m1)
names but advancing self.ScenCount by mk / mk-mk_m1. When ArRP > 1
and lower_bound_k was not a multiple of ArRP, these diverge, leaving
unused scenario indices between iterations (and, for the reuse branch,
passing a float count that would crash scenario_names_creator).
Draw mk / mk-mk_m1 names so the advance matches the draw. Also turn
the top-level print("TBD: check seqsampling for start vs start_seed")
into a block comment describing the two-path seed convention (two-stage
uses start=ScenCount; multi-stage uses start_seed / sample_options seed).
Adds a solver-free unit test that exercises ArRP=2 with odd
lower_bound_k values, records every scenario_names_creator call, and
asserts ScenCount == sum(draws) plus pairwise disjointness.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
_cylinder_xhat_generator had rank 0 unlink the bcast'd tmp .npy immediately after reading it, with no barrier between read and remove. Faster ranks could finish np.load before the unlink, but slower ones hit FileNotFoundError (seen on CI MPICH with test_mrp_cylinders). Add a global Barrier after read so rank 0 can't delete until every rank has loaded the file. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
_cylinder_xhat_generator now issues two barriers (after write, and after read so rank 0 can't unlink before peers finish); the mocked test assertion was pinned to one. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
mrp_generic.py, a model-agnostic CLI driver for sequential sampling (MRP) confidence intervals, analogous togeneric_cylinders.pyfor decomposition--xhat-method--branching-factors)--stopping-criterionmpisppy/generic/mrp.py; entry point inmpisppy/mrp_generic.pydoc/design/mrp_generic_design.rstTest plan
test_mrp_generic.py: config, xhat generator, do_mrp with BM and BPL)test_mrp_cylinders.pywithmpiexec -np 3)straight_tests.pysmoke teststest_conf_int_farmer.pytests still pass (no regressions)🤖 Generated with Claude Code