Geoffrey Zhu wrote:
> Hi Everyone,
>> I am trying to minimize a convex function f(x) that is not defined
> when x<=0 or when x>=1.5. I am trying to use scipy.optimize.golden(),
> but when the minimal point is very close to zero, golden() will call
> my target function on the undefined region. Is there any way to ensure
> that the optimizer will only look for answers within the domain?
Hmm. When you have an open interval like that, (0, 1.5) rather than [0, 1.5],
you will pretty much have to find an espilon that suits your problem and use the
bounds [0+eps, 1.5-eps]. With golden() and brent(), you can use the argument
brack=(0+eps, 1.0, 1.5-eps). The 1.0 isn't special, you can pick anything in
between since your problem is convex. For fminbound(), you can use x1=0+eps,
x2=1.5-eps.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco