[SciPy-user] [OpenOpt] lb issue

Emanuele Olivetti emanuele@relativita....
Sat Jun 28 17:17:42 CDT 2008


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