Infeasible or unbounded (Gurobi)

44 views
Skip to first unread message

Astghik

unread,
Aug 15, 2019, 11:59:53 AM8/15/19
to YALMIP
Hello,

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.

Here is my code:

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)

Johan Löfberg

unread,
Aug 15, 2019, 12:03:18 PM8/15/19
to YALMIP
https://yalmip.github.io/debugginginfeasible/

and since you are using an optimizer and have problems, you should set verbose to 2 to ensure you see a print-out (or better yet, never debug optimizer objects, use a direct optimize call)

Astghik

unread,
Aug 15, 2019, 12:10:24 PM8/15/19
to YALMIP
I've already followed the steps mentioned in the link. And I figured out that the problem is not unbounded, it's infeasible.
Also, just using the optimize(cons,objective), I got the following log.


Academic license - for non-commercial use only
Optimize a model with 7390 rows, 2135 columns and 16880 nonzeros
Model has 139 quadratic objective terms
Variable types: 2075 continuous, 60 integer (60 binary)
Coefficient statistics:
  Matrix range     [1e-03, 1e+03]
  Objective range  [0e+00, 0e+00]
  QObjective range [2e-02, 4e+00]
  Bounds range     [1e+00, 1e+00]
  RHS range        [5e-02, 1e+03]
Presolve removed 1890 rows and 162 columns
Presolve time: 0.01s
Presolved: 5500 rows, 1973 columns, 14785 nonzeros
Presolved model has 129 quadratic objective terms
Variable types: 1913 continuous, 60 integer (60 binary)

Root relaxation: objective 0.000000e+00, 3741 iterations, 0.02 seconds

    Nodes    |    Current Node    |     Objective Bounds      |     Work
 Expl Unexpl |  Obj  Depth IntInf | Incumbent    BestBd   Gap | It/Node Time

     0     0    0.00000    0   60          -    0.00000      -     -    0s
     0     0    0.00000    0   60          -    0.00000      -     -    0s
     0     2    0.00000    0   60          -    0.00000      -     -    0s

Explored 29 nodes (24621 simplex iterations) in 0.58 seconds
Thread count was 8 (of 8 available processors)

Solution count 0

Model is infeasible or unbounded
Best objective -, best bound -, gap -

ans = 

  struct with fields:

    yalmipversion: '20190425'
       yalmiptime: 1.7656
       solvertime: 0.6524
             info: 'Either infeasible or unbounded (GUROBI-GUROBI)'
          problem: 12

Johan Löfberg

unread,
Aug 15, 2019, 12:14:04 PM8/15/19
to YALMIP
well then your next step is to figure out which constraints make it infeasible, by adding slacks and generally removing/relaxing constraints. Nothing anyone else but you can do
Reply all
Reply to author
Forward
0 new messages