[SciPy-user] Generating tuples and lists connected with
optimize.fmin_l_bfgs_b(func, guess, bounds=bounds, iprint=-1)
Nils Wagner
nwagner at mecha.uni-stuttgart.de
Fri Jul 1 04:38:51 CDT 2005
Christian Kristukat wrote:
> Nils Wagner wrote:
>
>> Nils Wagner wrote:
>>
>>> Hi all,
>>>
>>> Sorry for this inquiry but how can I initialize the list "bounds"
>>> and the tuple "guess" more efficiently ?
>>> The entries in bounds are identical for each design variable, while
>>> the initial guess consists of two different values.
>>> So how can I benefit from this pattern in building "bounds" and
>>> "guess" for 2n design variables ?
>>>
>>> bounds = [(0.0,2.0), (0.0,2.0), (0.0,2.0), (0.0,2.0), (0.0,2.0),
>>> (0.0,2.0)]
>>> guess = 2.0,2.0,2.0,1.0,1.0,1.0
>>>
>>> A small example would be appreciated.
>>>
>>> Thanks in advance
>>> Nils
>>>
>>> _______________________________________________
>>> SciPy-user mailing list
>>> SciPy-user at scipy.net
>>> http://www.scipy.net/mailman/listinfo/scipy-user
>>
>>
>>
>> Is there a better way for building bounds ?
>>
>> bounds=[]
>> for i in arange(0,2*n):
>> bounds = bounds + [(0.0,2.0)]
>
>
> bounds = [(0.0,2.0)]*n
>
> This works with python lists, not with numeric arrays.
>
> btw: I'm using fmin_tnc which is another constrained minimizer and I
> found that it is much faster than bfgs for large problems.
>
> Regards, Christian
>
Christian,
Thank you very much for your hints. I have tried fmin_tnc. It's really
faster than fmin_l_bfgs_b.
Is it possible to solve constrained optimization problems of the form
min f(x)
s.t.
0 < x_1 < =1
0 < x_2 < =1
n(x) = 0
with scipy. n(x) denotes a nonlinear function of the design variables
x^T=[x_1,\dots,x_n]
So we have both equality and inequality constraints.
Best regards,
Nils
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user
More information about the SciPy-user
mailing list