Is it possible to get the same dual and primal solution with a m*b <= x <= M*b constraint?

28 views
Skip to first unread message

Reinhold B

unread,
Nov 20, 2013, 10:52:48 AM11/20/13
to yal...@googlegroups.com
Hello,

I'm trying to model a unit commitment problem, with some minimal power output constraint. I would like to use the dualization function form Yalmip to test if it solves my problem faster.

I found that the primal and the dual solutions are not the same and here is a small example to reproduce this:

D = [ 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000 ];

Pmin = 1;Pmax = 2;C_P = 3;
Gen = [
   
%Pmin,    Pmax,  C_P,
   
450.0,   900.0,   20;
   
250.0,   700.0,   40;
   
100.0,   400.0,   65;
   
];

N
= 3; T = 10;
v
= binvar(N,T);
p
= sdpvar(N,T);

ct
= [];
for t = 1:T
    ct
= [ct ...
       
0 <= v(:,t) <=  1 ,...
       
0 <= p(:,t) <= Gen(:,Pmax),...
        sum
(p(:,t)) == D(t) ,...
       
Gen(:,Pmin) .* v(:,t) <=  p(:,t) <=  Gen(:,Pmax) .* v(:,t) ,...
       
];
end
 
c_p
= repmat(Gen(:,C_P),1,T) .* p;

ob
= sum(sum( c_p ));

solvesdp
(ct,ob,sdpsettings('dualize',1));p1= double(p);v1 = double(v);
disp
('----------------------------------------');
solvesdp
(ct,ob,sdpsettings('dualize',0));p2 =double(p);v2 = double(v);
display
(p1)
display
(p2)
display
(v1)
display
(v2)

I get this result:
p1 =
   
100   200   300   400   500   600   700   800   900   900
     
0     0     0     0     0     0     0     0     0   100
     
0     0     0     0     0     0     0     0     0     0


p2
=
     
0     0     0     0   500   600   700   800   900   900
     
0     0   300   400     0     0     0     0     0     0
   
100   200     0     0     0     0     0     0     0   100


v1
=
   
0.1111    0.2222    0.3333    0.4444    0.5556    0.6667    0.7778    0.8889    1.0000    1.0000
         
0         0         0         0         0         0         0         0         0    0.1429
         
0         0         0         0         0         0         0         0         0         0


v2
=
     
0     0     0     0     1     1     1     1     1     1
     
0     0     1     1     0     0     0     0     0     0
     
1     1     0     0     0     0     0     0     0     1

The output for the primal solving (p2,v2) is what I expect.

This constraint seems to be the problem:
Gen(:,Pmin) .* v(:,t) <=  p(:,t) <=  Gen(:,Pmax) .* v(:,t)

I played around with something like the following, but do not get what I expect.
        %implies(v(n,t), Gen(n,Pmin) <= p(n,t) <= Gen(n,Pmax)), ...
       
%implies(Gen(n,Pmin) <= p(n,t) <= Gen(n,Pmax), v(n,t)), ...
       
%iff(v(n,t), Gen(n,Pmin) <= p(n,t) <= Gen(n,Pmax)), ...
       
%iff(Gen(n,Pmin) <= p(n,t) <= Gen(n,Pmax), v(n,t)), ...


In the end I'm wondering if it is at all possible to transfer this constraint to the dual form?
What am I missing?

If it's not possible, what may help to speed up the solving process. Cplex needs endless time with the full data (and a bigger model) while resting at a 0.08% gap.

Best Regards

Johan Löfberg

unread,
Nov 20, 2013, 3:54:44 PM11/20/13
to yal...@googlegroups.com
Doesn't make sense to apply dualize on an integer program, as duality theory doesn't even apply (i.e., YALMIP should really break here and tell you there are binary variables in the model, will add that)
Reply all
Reply to author
Forward
0 new messages