# [SciPy-user] Usage of fmin_tnc and fmin_l_bfgs_b

Xiaojian Wang wangxj.uc at gmail.com
Fri Sep 15 10:59:09 CDT 2006

Thanks Nils,

yes, fmin_cobyla  can handle the general constraints, however I also still
don't know how to
write the constraints: "a list of callable function" cons
and there are no examples in this optimize module!, I also appreciate any
helps from any of you.

for fmin_l_bfgs_b, see examples in this module, I have run this module
without difficulty including
lower and upper boundary for each design variables to solve my problems.

Xiaojian

On 9/15/06, Nils Wagner <nwagner at iam.uni-stuttgart.de> wrote:
>
> Nils Wagner wrote:
> > Hi all,
> >
> > I would like to solve a constrained optimization problem with scipy.
> > As far as I understand it there exists two possible functions for my
> > problem in scipy - fmin_tnc and fmin_l_bfgs_b.
> >
> > The problem is given by
> >
> > min f(x)
> >
> > subjected to
> >
> > \theta_1 \le theta \le theta_2
> >
> >  and
> >
> >  r_1 \le r \le r_2
> >
> > where x is a vector \in \mathds{R}^{2n+1}.
> >
> > theta is the last entry in x.
> >
> > r = \| x[:2*n] \| = linalg.norm(x[:2*n])
> >
> >
> > How do I specify the bounds for my problem ? I mean
> > it's easy to define the bounds for the l a s t parameter (\theta) but
> > I am at a loss how to formulate
> > the bounds for x[0],...,x[2n-1] s e p a r a t e l y.
> >
> >     bounds  -- a list of (min, max) pairs for each element in x,
> defining
> >                the bounds on that parameter. Use None for one of min or
> max
> >                when there is no bound in that direction
> >
> > Any hint would be appreciated.
> >
> > Nils
> >
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user at scipy.org
> > http://projects.scipy.org/mailman/listinfo/scipy-user
> >
> Sorry for replying to myself.
>
> I guess I can use fmin_cobyla with the following constraints
>
> cons1= x[-1]-\theta_1
> cons2=\theta_2-x[-1]
> cons3=linalg.norm(x[:2*n])-r_1
> cons4=r_2-linalg.norm(x[:2*n])
>
> Is that correct ? Is there a better way to implement the problem ?
>
> Nils
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...