Skip to content

Commit 729e1ab

Browse files
committed
Add note on former scipy warning
1 parent 952fda3 commit 729e1ab

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

src/tranquilo/subsolvers/fallback_subsolvers.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,17 @@ def _grad(x, g, h):
184184
return crit, grad
185185

186186

187+
def _get_constraint():
188+
"""Constraint enforcing ||x||^2 <= 1 as a simple inequality for SLSQP."""
189+
return {
190+
"type": "ineq",
191+
"fun": lambda x: 1 - x @ x,
192+
"jac": lambda x: -2 * x,
193+
}
194+
195+
187196
# def _get_constraint():
197+
# """Raises scipy warning."""
188198
# def _constr_fun(x):
189199
# return x @ x
190200

@@ -198,12 +208,3 @@ def _grad(x, g, h):
198208
# jac=_constr_jac,
199209
# keep_feasible=True,
200210
# )
201-
202-
203-
def _get_constraint():
204-
"""Constraint enforcing ||x||^2 <= 1 as a simple inequality for SLSQP."""
205-
return {
206-
"type": "ineq",
207-
"fun": lambda x: 1 - x @ x,
208-
"jac": lambda x: -2 * x,
209-
}

0 commit comments

Comments
 (0)