Skip to content

Commit 1f05582

Browse files
authored
Merge pull request #391 from bknueven/lagrangian_subgradient
add subgradient option to lagrangian
2 parents 4d18d6b + 7f0bba6 commit 1f05582

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

Diff for: doc/src/secretmenu.rst

+8
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,11 @@ hub definition dictionary is called ``hub_dict`` you would add
4848
hub_dict["opt_kwargs"]["PHoptions"]["initial_proximal_cut_count"] = 4
4949
5050
before passing ``hub_dict`` to ``spin_the_wheel``.
51+
52+
53+
subgradient_while_waiting
54+
-------------------------
55+
56+
The Lagrangian spoke has an additional argument, `subgradient_while_waiting`,
57+
which will compute subgradient steps while it is waiting on new W's from the
58+
hub.

Diff for: mpisppy/cylinders/lagrangian_bounder.py

+8
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ def main(self):
5858
if hasattr(self.opt, 'rho_setter'):
5959
rho_setter = self.opt.rho_setter
6060
extensions = self.opt.extensions is not None
61+
verbose = self.opt.options['verbose']
6162

6263
self.lagrangian_prep()
6364

@@ -86,3 +87,10 @@ def main(self):
8687
if extensions:
8788
self.opt.extobject.enditer_after_sync()
8889
self.dk_iter += 1
90+
elif self.opt.options.get("subgradient_while_waiting", False):
91+
# compute a subgradient step
92+
self.opt.Compute_Xbar(verbose)
93+
self.opt.Update_W(verbose)
94+
bound = self.lagrangian()
95+
if bound is not None:
96+
self.bound = bound

0 commit comments

Comments
 (0)