Skip to content

Commit d1689dc

Browse files
authored
Merge pull request #251 from jrmaddison/jrmaddison/fix_l_bfgs_warning
Fix L-BFGS-B `DeprecationWarning`: `disp` is deprecated in SciPy 1.16.0
2 parents 1d26d01 + 7f3931e commit d1689dc

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

pyadjoint/optimization/optimization.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,10 @@ def minimize_scipy_generic(rf_np, method, bounds=None, **kwargs):
6262
dJ = lambda m: rf_np.derivative()
6363
H = lambda x, p: rf_np.hessian(p)
6464

65-
if "options" not in kwargs:
66-
kwargs["options"] = {}
67-
# TODO: What to do here?
68-
"""
69-
if rank(rf_np.rf.mpi_comm()) != 0:
70-
# Shut up all processors except the first one.
71-
kwargs["options"]["disp"] = False
72-
"""
73-
else:
65+
kwargs.setdefault("options", {})
66+
if method not in ["L-BFGS-B"]:
7467
# Print out progress information by default
75-
if "disp" not in kwargs["options"]:
76-
kwargs["options"]["disp"] = True
68+
kwargs["options"].setdefault("disp", True)
7769

7870
# Make the default SLSLQP options more verbose
7971
if method == "SLSQP" and "iprint" not in kwargs["options"]:

0 commit comments

Comments
 (0)