Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure prox_approx does not loop forever #477

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading