[SciPy-user] how to use SciPy. optimize. cobyla?
Gilles Rochefort
gilles.rochefort@gmail....
Mon Jan 5 07:53:44 CST 2009
Anyway, cons is a list of functions and not a list of values.
In that case, I guess these functions have to be your bound constraints,
x1 >= 1 --> C1 = lambda x: x[0] - 1
x1 <= 100 --> C2 = lambda x: 100 - x[0]
x2 >=.2 --> C3 = lambda x: x[1] - .2
x2 <= .8 --> C4 = lambda x: .8 - x[1]
and finally cons = [C1,C2,C3,C4]
Best regards,
Gilles Rochefort.
2009/1/5 Gilles Rochefort <gilles.rochefort@gmail.com>
> Hello,
>
> Not sure to fully understand what you want to do ?
>
> Assuming you want to minimize a function Fm with bounds constaints - maybe
> fmin_tnc or fmin_l_bfgs_b is better choice, depending on the
> nature of function (continuity, differentiable, etc. ) .
>
>
>
> 2009/1/5 zhang chi <zhangchipr@gmail.com>
>
>> hi
>> I have a function Fm(x1,x2) that can't be expressed in math mode, but
>> can be written using program. And x1 $\in$ [1,100]; x2 $\in$ [ 0.2,0.8].
>> So could I use Cobyla like the following:
>>
>> def Fm(x1,x2):
>> ..........
>> return value
>>
>> x0 = [50,0.5]
>> cons = [1:100;0.2:0.8]
>> min = fmin_coblya(Fm, x0, cons, args=(), consargs=None, rhobeg=1.0, rhoend=1e-4,iprint=1, maxfun=1000)
>>
>> thank you very much.
>>
>>
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user@scipy.org
>> http://projects.scipy.org/mailman/listinfo/scipy-user
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20090105/0fb00aaa/attachment-0001.html
More information about the SciPy-user
mailing list