I'm solving a Mixed Integer Problem using Gurobi. However I get an error saying that the problem is either infeasible or unbounded. It works when theta is 0, but if I increase it a bit, I get the error.
u = sdpvar(repmat(nu,1,K+1),ones(1,K+1),'full');
x = sdpvar(repmat(nx,1,K+1),ones(1,K+1),'full');
r = sdpvar(repmat(nx,1,K+1),ones(1,K+1),'full');
lambda=sdpvar(K+1,m1,'full');
z = sdpvar(K+1,1,'full');
s=sdpvar(K+1,m1,N,'full');
bin=binvar(K+1,m1,'full');
Gt=sdpvar(m1,ny,'full');
gt=sdpvar(m1,1,'full');
cons=[];
objective = 0;
theta=0.1;
alpha=0.99;
delta=0.02;
M=1000;
for k = 1:K
for j=1:m1
for i=1:N
cons=cons+[-alpha*z(k)/(1-alpha)-Gt(j,:)/(1-alpha)*(C*x{k})-Gt(j,:)/(1-alpha)*sum(w1{i}(:,(1:k)),2)+gt(j)/(1-alpha)<=s(k,j,i),...
-alpha*z(k)/(1-alpha)<=s(k,j,i),...
z(k)<=s(k,j,i),...
sqrt(sum((Gt(j,:)'/(1-alpha)).^2))<=lambda(k,j)];
end
cons=cons+[lambda(k,j)*theta+1/N*sum(s(k,j,:))<=delta+M*bin(k,j)];
end
cons = cons+[x{k+1} == A*x{k}+B*u{k},sum(bin(k,:))<=m1-1];
objective = objective + (x{k}-r{k})'*Q*(x{k}-r{k})+u{k}'*R*u{k};
end
objective = objective + (x{K+1}-r{K+1})'*Q*(x{K+1}-r{K+1});
parameters_in = {x{1},[r{:}],gt,Gt};
solutions_out = {[u{:}],[x{:}],objective,z,lambda,s,dist,bin,sum1};
opt=sdpsettings('showprogress',1,'solver','gurobi','debug',1);
controller = optimizer(cons,objective,opt,parameters_in,solutions_out)