[SciPy-user] [OpenOpt] lb issue

dmitrey dmitrey.kroshko at scipy.org
Sun Jun 29 02:20:03 EDT 2008


I don't see any difficulties to map my advice to more difficult cases 
(just don't forget to increase your ineq constraints by contol, for to 
compare those ones with zero, not contol, and use inf, not the huge 
value you have mentioned). Current ralg implementation doesn't need 
objfunc value when point is outside of feasible region (i.e. if *any* 
constraint is bigger than p.contol, not only lb-ub constraint). OO calls 
objFunc outside feasible region just for to check some stop criteria, 
yield iter output point text and possible graphics output.

Regards, D.

Emanuele Olivetti wrote:
> Unfortunately it is not so simple to map this advice to my
> real situation, which is more complex than the
> proof-of-concept example of the initial message. Returning
> a big positive value when x is outside the bounds is an option
> I considered some time ago but then discarded. But I'll think
> more about it now.
>
> Ciao,
>
> Emanuele
>
> dmitrey wrote:
>   
>> Hi Emanuele,
>>
>> I could propose you temporary solution (see below), this one doesn't
>> require updating oo from svn. However, usually ALGENCAN, ipopt and
>> scipy_slsqp work much better for box-bound constrained problems (w/o
>> other constraints) than current ralg implementation.
>> D.
>>
>> import numpy as N
>> from scikits.openopt import NLP
>> from numpy import any, inf
>> size = 100
>> dimensions = 2
>> data = N.random.rand(size,dimensions)-0.5
>>
>> contol = 1e-6
>> lb=N.zeros(dimensions) + contol
>>
>> def f(x):
>>    global data
>>    if any(x<0):
>>        #objective function is not defined here, let's use inf instead
>>        #however, some iters will show objFunVa= inf in text output
>>        # and graphic output is currently unavailable for the case
>>        return inf
>>    return N.dot(data**2,x.T)
>>
>> x0 = N.ones(dimensions)
>> p = NLP(f,x0,lb=lb, contol = contol)
>> p.solve('ralg')
>> print p.ff,p.xf
>>
>>     
>
>
>
>
>   




More information about the SciPy-User mailing list