Skip to content

design: ADMM user-API automation, phased plan A-E#684

Closed
DLWoodruff wants to merge 2 commits into
Pyomo:mainfrom
DLWoodruff:admm-api-automation-design
Closed

design: ADMM user-API automation, phased plan A-E#684
DLWoodruff wants to merge 2 commits into
Pyomo:mainfrom
DLWoodruff:admm-api-automation-design

Conversation

@DLWoodruff
Copy link
Copy Markdown
Collaborator

Summary

  • Drafts a phased plan to reduce ADMM model-module boilerplate, organized as 5 independently-shippable phases (A–E), each with its own follow-up PR, tests, and example migration.
  • Phase A: auto-build the scenario tree for --stoch-admm via new first_stage_cost(scenario) / first_stage_varlist(scenario) module hooks so Stoch_AdmmWrapper calls attach_root_node itself (eliminating the asymmetry vs --admm).
  • Phase B: accept Pyomo Var/VarData in consensus_vars_creator (normalize to var.name internally; strings still work).
  • Phase C: default combining_names / split_admm_stoch_subproblem_scenario_name pair using __ADMM__ as the delimiter (verbose but safe for shells/filenames/CSV).
  • Phase D: default admm_stoch_subproblem_scenario_names_creator with correct nesting (outer = stoch, inner = admm).
  • Phase E: document admm_args as canonical for ADMM CLI args; drop redundant registrations from example inparser_adder functions.
  • Item F (merging AdmmWrapper and Stoch_AdmmWrapper) and multistage-origin stoch-admm are explicitly out of scope.
  • The doc clarification in admm-doc-crossref commit 24bf5802 ("clarify attach_root_node contract differs for --admm vs --stoch-admm") will be superseded by phase A's PR.

Test plan

  • Design doc reviewed; phase ordering, back-compat strategy, and the resolved open questions (hook signature; delimiter) confirmed
  • No code changes in this PR; CI should be a no-op apart from any doc-build job
  • Phase A branch + PR opens against main once this design merges

🤖 Generated with Claude Code

DLWoodruff and others added 2 commits May 13, 2026 10:42
Drafts a phased rollout of the ADMM user-API automation discussed in
the ongoing admm-doc-crossref thread:

  A. Auto-build the scenario tree for --stoch-admm (new
     first_stage_cost / first_stage_varlist module hooks; wrapper
     calls attach_root_node itself).
  B. Accept Pyomo Var/VarData in consensus_vars_creator (normalize
     to var.name internally; back-compat with strings).
  C. Default combining_names / split_admm_stoch_subproblem_scenario_name
     pair in mpisppy.utils.stoch_admmWrapper.
  D. Default admm_stoch_subproblem_scenario_names_creator with correct
     nesting (outer = stoch, inner = admm).
  E. Document admm_args as canonical for ADMM CLI args; drop
     redundant registrations from example inparser_adder funcs.

Each phase: own branch, own PR, own tests, keeps the old API as a
fallback.  Item F (merging AdmmWrapper and Stoch_AdmmWrapper) is
explicitly out of scope.

Multistage-origin stoch-admm is also out of scope: the BFs=None branch
in stoch_admmWrapper is the only path exercised by any caller today.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase A: scenario form (first_stage_cost(scenario) / first_stage_varlist(scenario)).
Phase C: default delimiter is __ADMM__ (verbose but unambiguous; safe
for shells, filenames, CSV writers).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.03%. Comparing base (bfc2ce3) to head (87174ea).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #684      +/-   ##
==========================================
+ Coverage   71.02%   71.03%   +0.01%     
==========================================
  Files         154      154              
  Lines       19248    19252       +4     
==========================================
+ Hits        13670    13676       +6     
+ Misses       5578     5576       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DLWoodruff
Copy link
Copy Markdown
Collaborator Author

Closing while we iterate on the design and implement phase A. Will reopen (or replace with a successor PR) once the API is exercised by phase A's implementation and feels stable.

@DLWoodruff DLWoodruff closed this May 13, 2026
DLWoodruff added a commit to DLWoodruff/mpi-sppy-1 that referenced this pull request May 13, 2026
Adds the design doc that motivates this PR's phase A implementation.
The doc covers all five phases (A-E) but only phase A is implemented
here; B-E will follow as separate PRs.

  A. Auto-build the scenario tree for --stoch-admm via new
     first_stage_cost / first_stage_varlist module hooks (this PR).
  B. Accept Pyomo Var/VarData in consensus_vars_creator.
  C. Default combining_names / split_admm_stoch_subproblem_scenario_name
     pair in mpisppy.utils.stoch_admmWrapper, with __ADMM__ as the
     delimiter.
  D. Default admm_stoch_subproblem_scenario_names_creator with the
     correct nesting (outer = stoch, inner = admm).
  E. Drop redundant ADMM-arg registrations from example
     inparser_adder functions; admm_args is canonical.

Item F (merging AdmmWrapper and Stoch_AdmmWrapper) and
multistage-origin stoch-admm are explicitly out of scope.

Each phase is independently shippable, preserves the old API as a
fallback, and migrates the canonical example.  Phase A's per-scenario
error matrix (hooks-x-attached) and its both-or-neither contract are
spelled out in section 2 of the doc, and the implementation in this
PR matches.

The design doc was originally drafted on a separate branch and went
through review (closed PR Pyomo#684) before phase A was implemented; the
"files" list in section 2 was updated after implementation to
reflect findings (AdmmBundler needed the same plumbing,
consensus_vars_creator required a refactor away from
_mpisppy_node_list, the custom driver had to forward hooks too).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant