confine the value
If x is the variable being optimized replace it with x = z^2 and optimize over z. That will constraint x to be nonnegative.
On 10/23/05, Chun-Ying Lee <u9370004 at cc.kmu.edu.tw> wrote:
Dear R users: I wonder if it is possible to confine the value which "optim" optimized to be all positive. I use optim with method "Nelder-Mead". Please give me some comments. Thanks in advance!!