Skip to content

Commit 1284136

Browse files
DLWoodruffclaude
andauthored
solver options: migrate PHBase-based readers off current_solver_options (#702)
Replace the remaining `self.current_solver_options` reads in PHBase-based code with `self._effective_solver_options(self._PHIter)` (or `opt._effective_solver_options(opt._PHIter)` from extensions). This pulls fwph, aph, and the cross-scenario extension onto the layered representation alongside PH's own iter0/iterk solves, and is a real fix beyond just-a-refactor: `current_solver_options` defaults to `{}` after the phase-2 changes, so user-supplied `--solver-options "..."` were being silently dropped on these solve paths. Now they get the full per-iteration fold. Touched: * mpisppy/opt/fwph.py (2 callsites) * mpisppy/opt/aph.py (1 callsite) * mpisppy/extensions/cross_scen_extension.py (1 callsite) The migration is mechanical: each line previously passed `current_solver_options` (a plain dict) and now passes the fold returned by `_effective_solver_options`. The fold's final layer is still `current_solver_options` (the back-compat overlay path), so any Gapper auto-mode mipgap written there still flows through. xhat_eval and lshaped_bounder (the other current_solver_options readers) are SPOpt-based, not PHBase-based — they need `_effective_solver_options` pushed up to SPOpt before they can migrate. That's a separate follow-up; design doc §6.3 updated to reflect the new split. No new tests in this PR: the existing test_aph and the example runs that exercise fwph and cross_scen catch regressions (_effective_solver_options is well-tested in test_solver_options_layers and test_options_reach_solver). Local: full sweep stays at 229/229 pass (+ 29 expected legacy deprecation warnings); ruff clean. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 18f94fe commit 1284136

4 files changed

Lines changed: 5 additions & 5 deletions

File tree

doc/designs/solver_options_redesign.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ Action items (all complete):
841841
|----------------------------------------------------------|-------------------------------------|----------------------------------------------------------------------------------|---------------|
842842
| `options["iter0_solver_options"]`, `options["iterk_solver_options"]` (input to PHBase) | **DeprecationWarning fires when non-empty; legacy dicts still folded into `solver_options_layers`** | unchanged target (`solver_options_layers`) | future, TBD |
843843
| `PHBase.iter0_solver_options`, `iterk_solver_options` (attribute reads) | **DeprecationWarning fires on every read; both are property shims returning `fold_solver_options_layers(layers, 0|1)`** | use `_effective_solver_options(k)` | future, TBD |
844-
| `PHBase.current_solver_options` (attribute reads / writes) | active; still used internally as the back-compat dynamic-overrides overlay by several spokes (fwph, aph, xhat_eval, cross_scen, lshaped) | not deprecated in phase 8 — pending those spokes migrating to the layer system | future, TBD |
844+
| `PHBase.current_solver_options` (attribute reads / writes) | active; fwph, aph, cross_scen_extension now use `_effective_solver_options(k)`; xhat_eval and lshaped_bounder (both SPOpt-based, not PHBase-based) still read `current_solver_options` — pending `_effective_solver_options` being pushed up to SPOpt | future, TBD |
845845
| `option_string_to_dict` | active | unchanged | n/a |
846846
| `option_dict_to_string` | active | unchanged | n/a |
847847

mpisppy/extensions/cross_scen_extension.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _check_bound(self):
9393
and opt.options["tee-rank0-solves"]
9494
)
9595
opt.solve_loop(
96-
solver_options=opt.current_solver_options,
96+
solver_options=opt._effective_solver_options(opt._PHIter),
9797
dtiming=opt.options["display_timing"],
9898
gripe=True,
9999
disable_pyomo_signal_handling=False,

mpisppy/opt/aph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ def APH_iterk(self, spcomm):
934934
self.dispatch_frac = 1 # to get a decent w for everyone
935935
logging.debug('pre APH_solve_loop on rank {}'.format(self.cylinder_rank))
936936
dlist = self.APH_solve_loop(solver_options = \
937-
self.current_solver_options,
937+
self._effective_solver_options(self._PHIter),
938938
dtiming=dtiming,
939939
gripe=True,
940940
disable_pyomo_signal_handling=True,

mpisppy/opt/fwph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ def fwph_main(self, finalize=True):
145145
)
146146
# teeme = True
147147
self.fwph_solve_loop(
148-
mip_solver_options=self.current_solver_options,
148+
mip_solver_options=self._effective_solver_options(self._PHIter),
149149
dtiming=self.options["display_timing"],
150150
tee=teeme,
151151
verbose=self.options["verbose"],
@@ -238,7 +238,7 @@ def iterk_loop(self):
238238
break
239239

240240
self.fwph_solve_loop(
241-
mip_solver_options=self.current_solver_options,
241+
mip_solver_options=self._effective_solver_options(self._PHIter),
242242
dtiming=dtiming,
243243
tee=teeme,
244244
verbose=verbose

0 commit comments

Comments
 (0)