Skip to content

Commit 265345b

Browse files
DLWoodruffclaude
andauthored
xhatspecific_spoke: wire scenario_dict and all_nodenames (#586) (#707)
xhatspecific_spoke in cfg_vanilla took `scenario_dict` and `all_nodenames` parameters but dropped both before constructing the spoke dict, so callers got "missing data" errors at runtime: * `all_nodenames` was not forwarded to _Xhat_Eval_spoke_foundation (sibling spokes like xhatshuffle_spoke already forward it). * `scenario_dict` should populate opt_kwargs.options.xhat_specific_options.xhat_scenario_dict, which the XhatSpecificInnerBound bounder reads at startup. Nothing was setting that key, so the bounder hit a KeyError before it could try a candidate. Fix: - Forward all_nodenames through to _Xhat_Eval_spoke_foundation. - Populate xhat_specific_options with xhat_scenario_dict (from the argument) and xhat_solver_options (mirroring xhatlooper_spoke's pattern of reusing iterk_solver_options). Also fix the only known caller, examples/aircond/aircond_cylinders.py: when `--solver-options` is passed alongside `--xhatspecific`, the override loop reached into `xhat_looper_options` (which xhatspecific does not have) instead of `xhat_specific_options`. Post-factory-fix this would still KeyError; rename to the correct key. Fixes #586 Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 1cc109e commit 265345b

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

examples/aircond/aircond_cylinders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ def main():
315315
sd["opt_kwargs"]["options"]["iterk_solver_options"].update(soptions)
316316

317317
if with_xhatspecific:
318-
xhatspecific_spoke["opt_kwargs"]["options"]["xhat_looper_options"]["xhat_solver_options"].update(soptions)
318+
xhatspecific_spoke["opt_kwargs"]["options"]["xhat_specific_options"]["xhat_solver_options"].update(soptions)
319319
if with_xhatshuffle:
320320
xhatshuffle_spoke["opt_kwargs"]["options"]["xhat_looper_options"]["xhat_solver_options"].update(soptions)
321321
# special code to get a trace for xhatshuffle

mpisppy/utils/cfg_vanilla.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,10 +1258,16 @@ def xhatspecific_spoke(
12581258
scenario_creator,
12591259
scenario_denouement,
12601260
all_scenario_names,
1261+
all_nodenames=all_nodenames,
12611262
scenario_creator_kwargs=scenario_creator_kwargs,
12621263
ph_extensions=ph_extensions,
12631264
extension_kwargs=extension_kwargs,
12641265
)
1266+
xhatspecific_dict["opt_kwargs"]["options"]["xhat_specific_options"] = {
1267+
"xhat_solver_options": xhatspecific_dict["opt_kwargs"]["options"]["iterk_solver_options"],
1268+
"xhat_scenario_dict": scenario_dict,
1269+
"csvname": "specific.csv",
1270+
}
12651271
_maybe_attach_jensens(xhatspecific_dict, cfg, "xhatspecific",
12661272
average_scenario_creator, scenario_creator_kwargs)
12671273
return xhatspecific_dict

0 commit comments

Comments
 (0)