Skip to content

Commit

Permalink
make sure prox_approx does not loop forever; tee all
Browse files Browse the repository at this point in the history
  • Loading branch information
bknueven committed Jan 10, 2025
1 parent abf9569 commit 51bcf9d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 2 additions & 3 deletions mpisppy/spopt.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,8 @@ def _vb(msg):
s._solver_plugin.options[option_key] = option_value

solve_keyword_args = dict()
if self.cylinder_rank == 0:
if tee is not None and tee is True:
solve_keyword_args["tee"] = True
if tee is not None and tee is True:
solve_keyword_args["tee"] = True
if (sputils.is_persistent(s._solver_plugin)):
solve_keyword_args["save_results"] = False
elif disable_pyomo_signal_handling:
Expand Down
4 changes: 3 additions & 1 deletion mpisppy/utils/prox_approx.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@ def check_tol_add_cut(self, tolerance, persistent_solver=None):
# print(f"initial distance: {_f(this_val, x_pnt, y_pnt)**(0.5)}")
# print(f"this_val: {this_val}")
next_val = _newton_step(this_val, x_pnt, y_pnt)
while not isclose(this_val, next_val, rel_tol=1e-6, abs_tol=1e-6):
for _ in range(10):
if isclose(this_val, next_val, rel_tol=1e-6, abs_tol=1e-6):
break
# print(f"newton step distance: {_f(next_val, x_pnt, y_pnt)**(0.5)}")
# print(f"next_val: {next_val}")
this_val = next_val
Expand Down

0 comments on commit 51bcf9d

Please sign in to comment.