Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Preventing negative values in fmincon
Replies: 10   Last Post: May 28, 2008 12:03 PM

 Messages: [ Previous | Next ]
 John D'Errico Posts: 9,130 Registered: 12/7/04
Re: Preventing negative values in fmincon
Posted: May 23, 2008 11:53 AM

"Mike " <michael.gerstREMOVE@yale.edu> wrote in message
<g16n7a\$9m8\$1@fred.mathworks.com>...
> Bruno and John, thanks for the tip.
>
> If I understand you correctly, the following simple LP problem
>
> Obj = a*X1 + a*X2 + a*X3
> subject to: X1 + X2 + X3 =< b
>
> would transform to
>
> Obj = a*sqrt(X1^2) + b*sqrt(X2^2) + c*sqrt(X3^2)
> subject to: sqrt(X1^2) + sqrt(X2^2) + sqrt(X3^2) =< b
>
> Is this the basic idea?

Not exactly. Have the optimizer vary a vecotr
with three unknowns in it [Y1,Y2,Y3]. Inside
the objective function, transform your
variables so that

X1 = Y1^2
X2 = Y2^2
X3 = Y3^2

So now X1, X2, X3 are assured to be positive.

When the optimization is done, and it returns
the vector [Y1, Y2, Y3], just square the elements
to recover [X1, X2, X3].

There are similar strategies to deal with variables
that have both upper and lower bounds.

John

Date Subject Author
5/21/08 Michael
5/23/08 Bruno Eklund
5/23/08 John D'Errico
5/23/08 Michael
5/23/08 Michael
5/23/08 John D'Errico
5/23/08 Nicolas
5/23/08 Michael
5/23/08 John D'Errico
5/25/08 medvall
5/28/08 Michael