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: fmincon with bounds results solution outside the bounds!
Replies: 1   Last Post: Feb 22, 2011 12:02 PM

 Messages: [ Previous | Next ]
 Hanan Shteingart Posts: 4 Registered: 6/25/09
fmincon with bounds results solution outside the bounds!
Posted: Feb 22, 2011 11:36 AM

hello,
I need to find a positive solution (e.g. x>0) which sums to 1
(sum(x)=1) but if I put lb=0 I still get negative solutions...

X = % load P*N data
N = size(X,2);
W0 = 1/N*ones(N,1);

A = [];
b = [];
Aeq = ones(1,N);
beq =1;
lb = 0;
ub = inf;
mycon = [];

W =
fmincon(@(W)myfun(W,X),W0,A,b,Aeq,beq,lb,ub,mycon,optimset('Algorithm',
'interior-point'));

Result:

W =

1.1876
0.1269
1.9361
-5.1877 ---------> negative!
-5.7522
1.6872
0.6485
-1.7252
5.6637
3.3205
-1.1855
1.5645
5.4133
-8.4845
1.7869

What's wrong?

Date Subject Author
2/22/11 Hanan Shteingart
2/22/11 Steven Lord