Permalink
Browse files

BUG: fix constraint jacobian retrieval in slsqp

  • Loading branch information...
1 parent 005cdcf commit 8cec7190157835de59a2b6a0a255e32eb2e71def @lmwang9527 lmwang9527 committed with dlax May 9, 2012
Showing with 3 additions and 4 deletions.
  1. +3 −4 scipy/optimize/slsqp.py
View
@@ -247,16 +247,15 @@ def _minimize_slsqp(func, x0, args=(), jac=None, bounds=None,
raise ValueError('Constraint %d has no function defined.' % ic)
# check jacobian
- if con.get('jac') is None:
+ cjac = con.get('jac')
+ if cjac is None:
# approximate jacobian function
def cjac(x, *args):
return approx_fprime(x, con['fun'], epsilon, *args)
- else:
- cjac = None
# update constraints' dictionary
cons[ctype] += ({'fun' : con['fun'],
- 'jac' : con.get('jac', cjac),
+ 'jac' : cjac,
'args': con.get('args', ())}, )

0 comments on commit 8cec719

Please sign in to comment.