Skip to content

Commit b90a975

Browse files
committed
add subgradient hub example
1 parent c3c3d7b commit b90a975

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

Diff for: examples/netdes/netdes_cylinders.py

+12-5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def _parse_args():
2222
cfg.two_sided_args()
2323
cfg.xhatlooper_args()
2424
cfg.ph_args()
25+
cfg.subgradient_args()
2526
cfg.fwph_args()
2627
cfg.lagrangian_args()
2728
cfg.subgradient_bounder_args()
@@ -71,11 +72,17 @@ def main():
7172
else:
7273
ph_ext = None
7374

74-
# Vanilla PH hub
75-
hub_dict = vanilla.ph_hub(*beans,
76-
scenario_creator_kwargs=scenario_creator_kwargs,
77-
ph_extensions=ph_ext,
78-
rho_setter = None)
75+
if cfg.SUBGRAD:
76+
hub_dict = vanilla.subgradient_hub(*beans,
77+
scenario_creator_kwargs=scenario_creator_kwargs,
78+
ph_extensions=ph_ext,
79+
rho_setter = None)
80+
else:
81+
# Vanilla PH hub
82+
hub_dict = vanilla.ph_hub(*beans,
83+
scenario_creator_kwargs=scenario_creator_kwargs,
84+
ph_extensions=ph_ext,
85+
rho_setter = None)
7986

8087
if cross_scenario_cuts:
8188
hub_dict["opt_kwargs"]["options"]["cross_scen_options"]\

Diff for: examples/run_all.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ def do_one_mmw(dirname, runefstring, npyfile, mmwargstring):
248248
f"--num-scens 3 --crops-multiplier=1 --EF-solver-name={solver_name} "
249249
"--BPL-c0 25 --BPL-eps 100 --confidence-level 0.95 --BM-vs-BPL BPL")
250250

251-
do_one("netdes", "netdes_cylinders.py", 5,
251+
do_one("netdes", "netdes_cylinders.py", 4,
252252
"--max-iterations=3 --instance-name=network-10-20-L-01 "
253-
"--solver-name={} --rel-gap=0.0 --default-rho=1 --presolve "
254-
"--slammax --lagrangian --xhatshuffle --cross-scenario-cuts --max-solver-threads=2".format(solver_name))
253+
"--solver-name={} --rel-gap=0.0 --default-rho=10000 --presolve "
254+
"--slammax --SUBGRAD --xhatshuffle --cross-scenario-cuts --max-solver-threads=2".format(solver_name))
255255

256256
# sizes is slow for xpress so try linearizing the proximal term.
257257
do_one("sizes",

0 commit comments

Comments
 (0)