[SciPy-user] how to use SciPy. optimize. cobyla?
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 - 1
x1 <= 100 --> C2 = lambda x: 100 - x
x2 >=.2 --> C3 = lambda x: x - .2
x2 <= .8 --> C4 = lambda x: .8 - x
and finally cons = [C1,C2,C3,C4]
2009/1/5 Gilles Rochefort <email@example.com>
> 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 <firstname.lastname@example.org>
>> 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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user