[SciPy-user] Generating tuples and lists connected with
optimize.fmin_l_bfgs_b(func, guess, bounds=bounds, iprint=-1)
ckkart at hoc.net
Fri Jul 1 03:14:54 CDT 2005
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),
>> guess = 2.0,2.0,2.0,1.0,1.0,1.0
>> A small example would be appreciated.
>> Thanks in advance
>> SciPy-user mailing list
>> SciPy-user at scipy.net
> Is there a better way for building 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.
More information about the SciPy-user