Re: FindMinimum within a specific interval

*To*: mathgroup at smc.vnet.net*Subject*: [mg32933] Re: FindMinimum within a specific interval*From*: davidrschmidt at hotmail.com (Dave Schmidt)*Date*: Wed, 20 Feb 2002 01:26:13 -0500 (EST)*References*: <200201310645.BAA04291@smc.vnet.net> <a3f0ka$b2v$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

You already have two excellent answers to your question, and I realize what I'm about to offer is probably less suited to your specific problem than the other two. However, this seemed like a good time to share a trick I've learned to use when I want to impose constraints on FindMinimum or FindRoot. These techniques are probably obvious to many of you, but I had not seen them suggested in any of the many postings about constrained optimization in Mathematica, so here goes. First, to impose a linear inequality constraint on a variable, do a simple change of variable. For instance, to minimize f[x] subject to a+bx>0, where a and b are numbers, just use FindMinimum[f[(Exp[y]-a)/b],{y,0}], then the critical value of x is (Exp[y]-a)/b. Second, I frequently work with probabilities and probability distributions. A simple way to approach this is to use a logit function. For instance, if in the example above, I wanted to constrain x to be in [0,1], I could use FindMinimum[f[Exp[y]/(Exp[y]+Exp[1])],{y,0}]. Suppose I want to minimize f[p1,p2,p3] subject to p1+p2+p3=1 and pi>=0. I could use f[p1,p2,1-p1-p2] to force the equation, but that would not help with the non-negativity constraints. An easy way to impose these constraints is to define a function, logit[a_,b1_,b2_]=Exp[a]/(Exp[b1]+Exp[b2]+Exp[1]), which is non-negative and satisfies logit[b1,b1,b2]+logit[b2,b1,b2]+logit[1,b1,b2]=1 for any b1 and b2. Then use FindMinimum[f[logit[b1,b1,b2],logit[b2,b1,b2],logit[1,b1,b2]],{b1,1},{b2,1}]. This can be generalized easily to impose any linear equation on a set of non-negative variables. However, this is not well suited to your problem because it forces the equation to hold. For the problems I work on, these change-of-variable techniques seem to give me quicker convergence to an answer than any sort of penalty function based method.