Dear Johan,
Could you help me with how to use your bnb code to solve a mixed integer LP problem. I want the bnb to branch on binvar z1 , z2 and find the most approriate value of z1,z2. But with the current code (see below), the method gives the result directly and there don't have any branch and bound.The computation result of limpr is right, but i don't get the right answer of z1 and z2. For now, I don't know where goes wrong, could you help me? Thank you in advance!
* Starting YALMIP integer branch & bound.
* Lower solver : LINPROG
* Upper solver : rounder
* Max iterations : 300
Node Upper Gap(%) Lower Open
1 : 8.612E+000 0.00 8.612E+000 0 Successfully solved
+ 1 Finishing. Cost: 8.6117
/ code
{
limpr=sdpvar(S*A,1);
z1=binvar(n+1,1);
z2=binvar(n+1,1);
F=[Aeq*limpr==beq,limpr>=0,sum(z1)==1,sum(z2)==1];
lpmat=reshape(sum(reshape(limpr,A,S)),n+1,[]);
SumofSet1=transpose(fliplr(cumsum(fliplr(sum(lpmat)))));
SumofSet1(1)=[];
SumofSet1(end+1)=0;
SumofSet2=flipud(cumsum(flipud(sum(lpmat,2))));
SumofSet2(1)=[];
SumofSet2(end+1)=0;
F=[F,SumofSet1<=ones(n+1,1)-z1+1e-5,SumofSet2<=ones(n+1,1)-z2+1e-5];
obj=f'*limpr;
ops=sdpsettings('solver','bnb','bnb.branchrule','max','bnb.method','breadth','bnb.solver','linprog');
optimize(F,obj,ops);
pi=value(limpr);
}