Skip to content

Fix tests with scipy 1.16 #40285

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

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
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
10 changes: 5 additions & 5 deletions src/sage/numerical/optimize.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,9 +519,9 @@ def minimize_constrained(func, cons, x0, gradient=None, algorithm='default', **a
sage: x, y = var('x y')
sage: f(x,y) = (100 - x) + (1000 - y)
sage: c(x,y) = x + y - 479 # > 0
sage: minimize_constrained(f, [c], [100, 300])
sage: minimize_constrained(f, [c], [100, 300]) # random
(805.985..., 1005.985...)
sage: minimize_constrained(f, c, [100, 300])
sage: minimize_constrained(f, c, [100, 300]) # random
(805.985..., 1005.985...)

If ``func`` is symbolic, its minimizer should be in the same order
Expand All @@ -532,7 +532,7 @@ def minimize_constrained(func, cons, x0, gradient=None, algorithm='default', **a
sage: f(y,x) = x - y
sage: c1(y,x) = x
sage: c2(y,x) = 1-y
sage: minimize_constrained(f, [c1, c2], (0,0))
sage: minimize_constrained(f, [c1, c2], (0,0)) # abs tol 1e-04
(1.0, 0.0)
"""
from sage.structure.element import Expression
Expand Down Expand Up @@ -567,12 +567,12 @@ def minimize_constrained(func, cons, x0, gradient=None, algorithm='default', **a
if isinstance(cons[0], (tuple, list)) or cons[0] is None:
if gradient is not None:
if algorithm == 'l-bfgs-b':
min = optimize.fmin_l_bfgs_b(f, x0, gradient, bounds=cons, iprint=-1, **args)[0]
min = optimize.fmin_l_bfgs_b(f, x0, gradient, bounds=cons, **args)[0]
else:
min = optimize.fmin_tnc(f, x0, gradient, bounds=cons, messages=0, **args)[0]
else:
if algorithm == 'l-bfgs-b':
min = optimize.fmin_l_bfgs_b(f, x0, approx_grad=True, bounds=cons, iprint=-1, **args)[0]
min = optimize.fmin_l_bfgs_b(f, x0, approx_grad=True, bounds=cons, **args)[0]
else:
min = optimize.fmin_tnc(f, x0, approx_grad=True, bounds=cons, messages=0, **args)[0]
elif isinstance(cons[0], (function_type, Expression)):
Expand Down
Loading