@@ -28,13 +28,16 @@ class PH(mpisppy.phbase.PHBase):
28
28
# uncomment the line below to get per-rank profile outputs, which can
29
29
# be examined with snakeviz (or your favorite profile output analyzer)
30
30
#@profile(filename="profile_out")
31
- def ph_main (self , finalize = True ):
31
+ def ph_main (self , finalize = True , attach_prox = True ):
32
32
""" Execute the PH algorithm.
33
33
34
34
Args:
35
35
finalize (bool, optional, default=True):
36
36
If True, call `PH.post_loops()`, if False, do not,
37
37
and return None for Eobj
38
+ attach_prox (bool, optional, default=True):
39
+ If True, use a proximal term, if False, no proximal
40
+ term is added to the objective function
38
41
39
42
Returns:
40
43
tuple:
@@ -56,15 +59,15 @@ def ph_main(self, finalize=True):
56
59
"""
57
60
verbose = self .options ['verbose' ]
58
61
smoothed = self .options ['smoothed' ]
59
- self .PH_Prep (attach_smooth = smoothed )
62
+ self .PH_Prep (attach_prox = attach_prox , attach_smooth = smoothed )
60
63
61
64
if (verbose ):
62
- print ('Calling PH Iter0 on global rank {}' . format ( global_rank ) )
65
+ print (f 'Calling { self . __class__ . __name__ } Iter0 on global rank { global_rank } ' )
63
66
trivial_bound = self .Iter0 ()
64
67
if self ._can_update_best_bound ():
65
68
self .best_bound_obj_val = trivial_bound
66
69
if (verbose ):
67
- print ( 'Completed PH Iter0 on global rank {}' . format ( global_rank ) )
70
+ print ( f 'Completed { self . __class__ . __name__ } Iter0 on global rank { global_rank } ' )
68
71
if ('asynchronousPH' in self .options ) and (self .options ['asynchronousPH' ]):
69
72
raise RuntimeError ("asynchronousPH is deprecated; use APH" )
70
73
0 commit comments