I tried to run on a balanced matrix M=[ 600 670 960 560
900 280 970 540
310 350 950 820
325 290 600 540 ]
f = M(:)' ;
T=size(M,1)
y=eye(T);
Aeq=[y y y y];
d=length(Aeq)
beq = ones(T,1);
[x ,fval]=intlinprog(f,1:d,[],[],Aeq,beq,zeros(d,1),inf(d,1));
find(x);
But the code gives answer x is 3 6 8 13 and fval=1440 which is incorrect.
The correct answer is x=3 6 12 13 and fval=1750.
Can you suggest the error in code?
Note: the above matrix M given as example in Matchpair function in Matlab