# [SciPy-user] lagrange multipliers in python

Christian K ckkart@hoc....
Mon Jun 18 08:28:29 CDT 2007

```fdu.xiaojf@gmail.com wrote:
> Hi all,
>
> fdu.xiaojf@gmail.com wrote:
>
>  >
>  > My last email was composed in a hurry, so let me describe my problem in
>  > detail to make it clear.
>  >
>  > I have to minimize a multivariate function F(x1, x2, ..., xn) subject to
>  > multiple inequality constraints and equality constraints.
>  >
>  > The number of variables(x1, x2, ..., xn) is 10 ~ 20, the number of
>  > inequality constraints is the same with the number of variables( all
>  > variables should be no less than 0). The number of equality constraints
>  > is less than 8(mainly 4 or 5), and the equality constraints are linear.
>  >
>  > My function is too complicated to get the expression of derivate easily, so
>  > according to Joachim Dahl(dahl.joachim@gmail.com)'s post, it is probably
>  > non-convex. But I think it's possible to calculate the first derivate
>  > numerically.
>  >
>  > I have tried scipy.optimize.fmin_l_bfgs_b(), which can handle bound constraints
>  > but seems cannot handle equality constraints.
>  >
>  > Mr. Markus Amann has kindly sent me a script written by him, which can
>  > handle equality constraints and is easy to use. The method used by
>  > Markus involves the calculation of Jacobian, which I don't
>  > understand.(Sorry for my ignorance in this filed. My major is chemistry,
>  > and I'm trying to learn some knowledge about numerical optimization.)
>  > However, it seems that the script cannot handle inequality constraints.
>  > (sorry if I was wrong).
>  >
>  > I hope my bad English have described my problem clearly.
>  >
>  > Any help will be greatly appreciated.
>  >
>  > Best regards,
>  >
>  > Xiao Jianfeng
>
> I have found COBYLA(http://www.jeannot.org/~js/code/index.en.html#COBYLA),
> and it has a Python interface, which make it very easy to use.

You seem not to be aware that cobyla is part of scipy:
scipy.optimize.fmin_cobyla

Christian

```