[SciPy-User] scipy.optimize.slsqp.fmin_slsqp - Inequality constraints incompatible
fj
frantisek.jahoda at gmail.com
Tue Sep 10 06:02:24 EDT 2013
I am using SciPy 0.10.1 and the following code stops at Inequality
constraints incompatible (Exit mode 4) error. Can I avoid it? I suspect that
the error is connected with bounds, because it works without them. Thank
you.
import scipy.optimize
upper_bounds = [91680237, 87141351, 19183473, 84453111]
x0 = [1461516, 1230049, 0, 0]
ieqcons = [
lambda x: 3139153 - (x[0] + x[1] + x[2] + x[3]),
lambda x: 1461516 - (x[0] + x[2] + x[3]),
lambda x: 1230049 - (x[1] + x[2]),
]
scipy.optimize.slsqp.fmin_slsqp(
func=lambda x: sum((x[i] - upper_bounds[i])**2 for i in xrange(4)),
fprime=lambda x: [2 * (x[i] - upper_bounds[i]) for i in xrange(4)],
x0=x0,
bounds=[(0, b) for b in upper_bounds],
ieqcons=ieqcons,
iprint=2,
)
--
View this message in context: http://scipy-user.10969.n7.nabble.com/scipy-optimize-slsqp-fmin-slsqp-Inequality-constraints-incompatible-tp18637.html
Sent from the Scipy-User mailing list archive at Nabble.com.
More information about the SciPy-User
mailing list