Skip to content

Commit 541770a

Browse files
committed
use xbar for rescaling denom_bound
1 parent 12f8f62 commit 541770a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

mpisppy/extensions/grad_rho.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,12 @@ def _scen_indep_denom(self):
119119
denom_max = max(max(denom) for denom in global_denoms.values())
120120
scen_indep_denom = {}
121121
for ndn, global_denom in global_denoms.items():
122-
for i, v in enumerate(global_denom):
123-
if (scen_indep_denom[ndn, i]) <= self.denom_bound * v:
124-
scen_indep_denom[ndn, i] = max(denom_max, self.denom_bound * v)
122+
for i, denom in enumerate(global_denom):
123+
# xbar is for rescaling, e.g., if the variable value is "naturally" small
124+
if denom <= self.denom_bound * xbars[ndn, i]._value:
125+
scen_indep_denom[ndn, i] = max(denom_max, self.denom_bound * xbars[ndn, i]._value)
125126
else:
126-
scen_indep_denom[ndn, i] = v
127+
scen_indep_denom[ndn, i] = denom
127128

128129
return scen_indep_denom
129130

0 commit comments

Comments
 (0)