Skip to content

FWPH: forward linearize_* so the can't-linearize warning fires (#274)#710

Merged
DLWoodruff merged 3 commits into
Pyomo:mainfrom
DLWoodruff:fwph-warn-linearize-274
May 17, 2026
Merged

FWPH: forward linearize_* so the can't-linearize warning fires (#274)#710
DLWoodruff merged 3 commits into
Pyomo:mainfrom
DLWoodruff:fwph-warn-linearize-274

Conversation

@DLWoodruff
Copy link
Copy Markdown
Collaborator

@DLWoodruff DLWoodruff commented May 17, 2026

Summary

  • Fixes FWPH does not warn that it can't linearize the objective #274. The vanilla fwph_hub / fwph_spoke factories did not forward cfg.linearize_proximal_terms or cfg.linearize_binary_proximal_terms into the options dict handed to FWPH, so FWPH._options_checks_fw never saw the flag and the user got no warning when they combined --linearize-proximal-terms with --fwph. With an LP-only solver (e.g. glpk) optimization silently proceeded and then failed in the QP solve, exactly as Matthew-Signorotti reported.
  • cfg_vanilla.fwph_hub and cfg_vanilla.fwph_spoke now explicitly set options["linearize_proximal_terms"] and options["linearize_binary_proximal_terms"] after the _fwph_options merge, mirroring the existing pattern in ph_hub.
  • opt/fwph.py _options_checks_fw: gate the two warning prints on self.cylinder_rank == 0 so HPC runs don't emit N copies of the same message.
  • New tests in mpisppy/tests/test_config.py cover both the cfg_vanilla forwarding and the rank-0 warning paths in FWPH._options_checks_fw.

Note: bknueven's follow-up suggestion (FWPH should accept separate mip_solver_name / qp_solver_name so you can pair glpk/cbc with ipopt) is tracked as a separate enhancement in #712.

Test plan

  • ruff check clean on changed files
  • Manual reproduction with mpiexec -np 2 ... --fwph --linearize-proximal-terms --solver-name glpk now prints the expected "linearize_proximal_terms cannot be used with the FWPH algorithm" warning before the (expected) glpk-cannot-do-QPs failure
  • New unit tests pass locally (pytest mpisppy/tests/test_config.py)
  • CI on this PR

🤖 Generated with Claude Code

…#274)

The vanilla fwph_hub / fwph_spoke factories did not forward
cfg.linearize_proximal_terms or cfg.linearize_binary_proximal_terms
into the options dict handed to FWPH. _options_checks_fw therefore
never saw the flag, so the user got no warning when they combined
--linearize-proximal-terms with --fwph. With an LP-only solver
(e.g. glpk), optimization then silently proceeded and ultimately failed
in the QP solve.

- cfg_vanilla.fwph_hub and cfg_vanilla.fwph_spoke: explicitly set
  options["linearize_proximal_terms"] and
  options["linearize_binary_proximal_terms"] after the _fwph_options
  merge, mirroring the existing pattern in ph_hub.
- opt/fwph.py _options_checks_fw: gate the two warning prints on
  self.cylinder_rank == 0 so HPC runs don't emit N copies of the same
  message.

Fixes Pyomo#274

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

codecov Bot commented May 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.28%. Comparing base (90c3bec) to head (9187dde).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #710      +/-   ##
==========================================
+ Coverage   71.19%   71.28%   +0.09%     
==========================================
  Files         154      154              
  Lines       19432    19438       +6     
==========================================
+ Hits        13835    13857      +22     
+ Misses       5597     5581      -16     

☔ 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 and others added 2 commits May 17, 2026 16:05
Adds two test classes to test_config.py:

- TestFWPHLinearizeForwarding asserts cfg_vanilla.fwph_hub and
  cfg_vanilla.fwph_spoke copy cfg.linearize_proximal_terms and
  cfg.linearize_binary_proximal_terms into the options dict (the
  forwarding lines added in this PR).
- TestFWPHOptionsChecksWarnings drives FWPH._options_checks_fw with a
  stub and verifies the rank-0 warning prints fire (and stay silent
  on non-zero ranks) and that the offending flags are cleared.

Covers the patch lines codecov flagged on PR 710.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@DLWoodruff DLWoodruff merged commit bbe8fba into Pyomo:main May 17, 2026
31 checks passed
@DLWoodruff DLWoodruff deleted the fwph-warn-linearize-274 branch May 17, 2026 23:23
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.

FWPH does not warn that it can't linearize the objective

1 participant