I run the code without constraints successfully. But the status is failed when I run the code with constraints. I want to know where is the problem. The code is as follows.
%Quaratic Function Parameter
d = 1;
%agent number
n=4;m=24;
p=[50.59;50.59;50.59;50.59;50.59;50.59;50.59;53.03;73.03;84.63;
95.23;103.94;105.45;99.37;79.37;79.68;99.68;98.73;110;89.99;70;
50.;50;50;20;20;20;20;20;20;20;20;20.;29.85;41.70;51.45;53.14;45.14;25.14;
25.49;45.49;45.62;60.20;40.20;20.20;20;20;20;41.86;41.86;41.86;41.86;
41.86;41.86;41.86;41.86;49.99;49.99;49.99;49.99;49.99;49.99;49.99;
49.99;49.99;49.99;50;41.77;44.29;33.77;15;15;-38.49;-33.72;-22.95;-37.45;
-27.45;-35.45;-32.45;-47.15;40.01;59.99;59.99;59.99;59.99;59.99;31.09;
29.72;59.99;59.99;60;0;0;0;-9.40;-25.2];
pc=[-38.49;-33.72;-22.95;-37.45;-27.45;-35.45;-32.45;-47.15;0;0;0;0;0;0;0;0;0;0;0;0;0;0;
-9.40;-25.2];
pdc=[0;0;0;0;0;0;0;0;40.01;59.99;59.99;59.99;59.99;59.99;31.09;29.72;
59.99;59.99;60;0;0;0;0;0];
soc=[0.5366;0.5686;0.5904;0.6260;0.6521;0.6858;0.7166;0.7614;0.7193;0.6561;0.5930;0.5298;0.4666;0.4035;0.3708;0.3395;
0.2763;0.2132;0.1500;0.1500;0.1500;0.1500;0.1589;0.1829];
h=ones(m,1);
r2=[0.0522857750247349,-0.0973073496643254,-0.0456589206550002,0.0523827279934064,0.0910176855862704,...
-0.0977956645723851,-0.0695295692765470,0.0100361742988780,-0.0777340191196880,0.0648702342936438,...
0.0382852139816137,0.0605817111435625,0.0352069824600734,-0.0382067804580811,-0.0504562698320362,...
0.00242349576503612,-0.0848336755354031,0.00286986685050039,0.0784220577488957,0.0884475203514253,...
-0.0713485515668208,-0.0477446358567047,-0.0371256383196058,-0.00295447800531104,-0.0599768330946589,...
-0.0883649681418379,-0.0336218925813448,-0.0851379855723749,-0.0991237521696081,0.0628444943747487,...
-0.0484281542410637,0.0233101203606579,-0.0815418650339530,0.0652255296159712,-0.0295532025514083,...
0.0571960790575682,0.0191498553136222,-0.0159294981462438,0.0405603871891857,-0.0484384919124653,...
0.0916190453475988,-0.0954909969065925,0.0320675066016359,0.0812982290032321,0.00843330273564344,...
0.0719412323422997,-0.0159373048811222,0.0422267014078312,-0.0279232594993017,-0.0668501393775403,...
-0.00323976512297872,0.0504082655434843,0.0618164505734617,-0.0570062070171439,-0.0446849455068520,...
-0.0553874756912667,-0.0485842134929263,-0.0562097093046431,0.0950972303439717,0.0922924544884207,...
0.0223083758062541,-0.0784740724198052,-0.0335438048049180,0.0319661850299598,0.0877807801324594,...
-0.0138252887752228,-0.0331152704145310,0.0613111909386342,0.0939038638349391,-0.0618344042025527,...
-0.0531048589119195,0.00971790743147290,0.0819412102671132,-0.00647468766252909,0.0245798881288342,...
-0.0824710128607722,-0.0649344164159173,-0.0596077179604057,-0.0308719226504313,0.0168920705228691,...
0.0307891446573035,-0.0844238632117023,0.0612325270244751,0.0253292396105695,-0.0686607571631583,...
0.0928884243943591,-0.0861708299056019,0.0152119582647811,-0.0494663361502407,0.0863943340676045,...
0.0612497637710019,0.0692415072105984,0.0467844720054807,-0.0127193818173358,-0.0366084795372653,0.0348825891059421];
a1=100*0.02*h;a2=100*0.0175*h;a3=100*0.0625*h;a4=0*h;
a=[a1;a2;a3];A=diag(a);
A1=diag([a1;h1;h1;h1]); A2=diag([h1;a2;h1;h1]);A3=diag([h1;h1;a3;h1]);A4=diag([h1;h1;h1;a4]);
a5=100*2*h;a6=100*1.75*h;a7=100*h;a8=0*h;
B1=[a5;h1;h1;h1];B2=[h1;a6;h1;h1];B3=[h1;h1;a7;h1];
B0=[a5;a6;a7];
SOC_0=0.5;SOC_min=0.15;SOC_max=0.85;n_d=0.95;n_c=0.95;
delta_t=1;E_r=1000;M=tril(ones(24));
lower1=50*h;lower2=20*h;lower3=15*h;lower4=0*h;
Upper1=120*h;Upper2=80*h;Upper3=50*h;Upper4=60*h;
lower=[lower1;lower2;lower3;lower4;]; Upper=[Upper1;Upper2;Upper3;Upper4;];
r1L=-20*ones(m,1);r2L=-20*ones(m,1);r3L=-20*ones(m,1);
r1U=20*ones(m,1);r2U=20*ones(m,1);r3U=20*ones(m,1);
ef=3.1604;
kr=5.68;
ac1=kr*ef*100*0.00004*h;ac2=kr*ef*100*0.00005*h;ac3=kr*ef*100*0.000024*h;
ac=[ac1;ac2;ac3];AA=diag(ac);
AA1=diag([ac1;h1;h1;h1]); AA2=diag([h1;ac2;h1;h1]);AA3=diag([h1;h1;ac3;h1]);
ac5=100*0.2*h;ac6=100*0.3*h;ac7=100*0.12*h;
BB1=[ac5;h1;h1;h1];BB2=[h1;ac6;h1;h1];BB3=[h1;h1;ac7;h1];
BB0=[ac5;ac6;ac7];
cvx_begin
variable c(n*m)
expression EP(n*m)
for i=1:96
EP(i)=c(i)*r2(i);
end
f1=(p(1:72)+EP(1:72))'*A*(p(1:72)+EP(1:72))+B0'*(p(1:72)+EP(1:72))+100*0.01*abs(pdc-
pc+EP(73:96))'*ones(m,1);
f2=(p(1:72)+EP(1:72))'*AA*(p(1:72)+EP(1:72))+BB0'*(p(1:72)+EP(1:72));
f=0.4*f1+0.6*f2;
minimize(f)
subject to
10*lower1+10*c(1:24)*0.1<=10*p(1:24)<=10*Upper1-10*c(1:24)*0.1;
10*lower2+10*c(25:48)*0.1<=10*p(25:48)<=10*Upper2-10*c(25:48)*0.1;
10*lower3+10*c(49:72)*0.1<=10*p(49:72)<=10*Upper3-10*c(49:72)*0.1;
10*-Upper4+10*c(73:96)*0.1<=10*pdc-10*pc<=10*Upper4-10*c(73:96)*0.1;
10*SOC_min*h+10*c(73:96)*0.1<=10*soc<=10*SOC_max*h-10*c(73:96)*0.1;
Be1=c(1,:)+c(24+1,:)+c(2*24+1,:)+c(3*24+1,:);Be6=c(6,:)+c(24+6,:)+c(2*24+6,:)+c(3*24+6,:);
Be2=c(2,:)+c(24+2,:)+c(2*24+2,:)+c(3*24+2,:);Be7=c(7,:)+c(24+7,:)+c(2*24+7,:)+c(3*24+7,:);
Be3=c(3,:)+c(24+3,:)+c(2*24+3,:)+c(3*24+3,:);Be8=c(8,:)+c(24+8,:)+c(2*24+8,:)+c(3*24+8,:);
Be4=c(4,:)+c(24+4,:)+c(2*24+4,:)+c(3*24+4,:);Be9=c(9,:)+c(24+9,:)+c(2*24+9,:)+c(3*24+9,:);
Be5=c(5,:)+c(24+5,:)+c(2*24+5,:)+c(3*24+5,:);Be10=c(10,:)+c(24+10,:)+c(2*24+10,:)+c(3*24+10,:);
Be11=c(11,:)+c(24+11,:)+c(2*24+11,:)+c(3*24+11,:);
Be12=c(12,:)+c(24+12,:)+c(2*24+12,:)+c(3*24+12,:);
Be13=c(13,:)+c(24+13,:)+c(2*24+13,:)+c(3*24+13,:);
Be14=c(14,:)+c(24+14,:)+c(2*24+14,:)+c(3*24+14,:);
Be15=c(15,:)+c(24+15,:)+c(2*24+15,:)+c(3*24+15,:);
Be16=c(16,:)+c(24+16,:)+c(2*24+16,:)+c(3*24+16,:);
Be17=c(17,:)+c(24+17,:)+c(2*24+17,:)+c(3*24+17,:);
Be18=c(18,:)+c(24+18,:)+c(2*24+18,:)+c(3*24+18,:);
Be19=c(19,:)+c(24+19,:)+c(2*24+19,:)+c(3*24+19,:);
Be20=c(20,:)+c(24+20,:)+c(2*24+20,:)+c(3*24+20,:);
Be21=c(21,:)+c(24+21,:)+c(2*24+21,:)+c(3*24+21,:);
Be22=c(22,:)+c(24+22,:)+c(2*24+22,:)+c(3*24+22,:);
Be23=c(23,:)+c(24+23,:)+c(2*24+23,:)+c(3*24+23,:);
Be24=c(24,:)+c(24+24,:)+c(2*24+24,:)+c(3*24+24,:);
BeBe=[Be1,Be2,Be3,Be4,Be5,Be6,Be7,Be8,Be9,Be10,Be11,Be12,Be13,Be14,Be15,Be16,Be17,Be18,Be19,Be20,Be21,Be22,Be23,Be24];
10*BeBe==10*h';
cvx_end
The control screen shows that,
Calling SDPT3 4.0: 460 variables, 122 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
num. of constraints = 122
dim. of socp var = 196, num. of socp blk = 26
dim. of linear var = 240
dim. of free var = 24 *** convert ublk to lblk
SDPT3: Infeasible path-following algorithms
version predcorr gam expon scale_data
NT 1 0.000 1 0
it pstep dstep pinfeas dinfeas gap prim-obj dual-obj cputime
0|0.000|0.000|4.6e+01|4.8e+01|2.7e+09|-4.170598e+05 0.000000e+00| 0:0:01| chol 1 1
1|0.301|0.301|3.2e+01|3.3e+01|1.0e+09| 9.450892e+06 -1.077121e+06| 0:0:01| chol 1 1
2|0.304|0.304|2.2e+01|2.3e+01|6.6e+08| 1.291308e+07 -1.633624e+06| 0:0:01| chol 1 1
3|0.417|0.416|1.3e+01|1.4e+01|4.4e+08| 1.602765e+07 -2.220844e+06| 0:0:01| chol 1 1
4|0.705|0.705|3.9e+00|4.0e+00|1.6e+08| 1.849652e+07 -2.727335e+06| 0:0:01| chol 1 1
5|0.853|0.858|5.7e-01|5.7e-01|3.5e+07| 1.441458e+07 -2.025786e+06| 0:0:01| chol 1 1
6|0.722|0.732|1.6e-01|1.5e-01|1.6e+07| 9.575430e+06 -1.277692e+06| 0:0:01| chol 1 1
7|0.725|0.748|4.4e-02|3.8e-02|7.5e+06| 5.733517e+06 -6.983195e+05| 0:0:01| chol 1 1
8|0.666|0.418|1.5e-02|2.2e-02|4.4e+06| 3.281292e+06 -5.134142e+05| 0:0:01| chol 1 1
9|0.863|0.642|2.0e-03|8.1e-03|1.8e+06| 1.373474e+06 -2.729107e+05| 0:0:01| chol 1 1
10|0.986|0.428|2.9e-05|4.8e-03|7.6e+05| 4.464948e+05 -1.799270e+05| 0:0:01| chol 1 1
11|0.894|0.660|3.0e-06|1.6e-03|2.8e+05| 1.780801e+05 -6.282060e+04| 0:0:01| chol 1 1
12|1.000|0.345|1.7e-08|1.1e-03|1.6e+05| 8.732443e+04 -3.154287e+04| 0:0:01| chol 1 1
13|1.000|0.435|1.2e-08|6.0e-04|1.0e+05| 6.082009e+04 -3.242149e+03| 0:0:01| chol 1 1
14|1.000|0.347|1.5e-08|3.9e-04|7.4e+04| 1.703278e+04 1.016503e+04| 0:0:01| chol 1 1
15|1.000|0.255|3.0e-08|2.9e-04|8.0e+04|-3.679259e+05 1.650414e+04| 0:0:01| chol 1 1
16|1.000|0.039|6.5e-07|3.1e-04|7.9e+06|-2.039322e+08 1.692229e+04| 0:0:01| chol 1 2
17|0.020|0.007|3.6e-06|3.3e-04|2.2e+08|-3.410598e+09 7.208159e+03| 0:0:01| chol 2 2
18|0.002|0.000|3.6e-06|3.6e-04|4.9e+08|-5.134786e+09 -3.836078e+03| 0:0:01| chol 2 2
19|0.017|0.001|3.6e-06|3.9e-04|2.2e+09|-1.674604e+10 -2.204906e+04| 0:0:01| chol 2 2
20|0.002|0.002|3.6e-06|4.1e-04|3.0e+09|-1.894992e+10 -1.801613e+05| 0:0:01| chol 2 2
21|0.008|0.001|3.5e-06|4.4e-04|5.2e+09|-2.687199e+10 -2.753483e+05| 0:0:01| chol 2 2
22|0.004|0.002|3.5e-06|4.6e-04|6.8e+09|-3.046763e+10 -6.153614e+05| 0:0:01| chol 2 2
23|0.007|0.002|3.5e-06|4.9e-04|9.4e+09|-3.677836e+10 -9.310350e+05| 0:0:01| chol 2 2
24|0.008|0.003|3.5e-06|5.2e-04|1.3e+10|-4.399968e+10 -1.496069e+06| 0:0:01| chol 2 2
25|0.011|0.004|3.4e-06|5.4e-04|1.7e+10|-5.322033e+10 -2.492574e+06| 0:0:01| chol 2 2
26|0.015|0.004|3.4e-06|5.7e-04|2.3e+10|-6.589776e+10 -3.910785e+06| 0:0:01| chol 2 2
27|0.018|0.006|3.3e-06|5.9e-04|3.2e+10|-8.252000e+10 -6.583181e+06| 0:0:01| chol 2 2
28|0.024|0.007|3.3e-06|6.1e-04|4.5e+10|-1.063460e+11 -1.026301e+07| 0:0:01| chol 2 2
29|0.028|0.010|3.3e-06|6.3e-04|6.3e+10|-1.379168e+11 -1.730162e+07| 0:0:01| chol 2 2
30|0.036|0.010|3.2e-06|6.5e-04|9.0e+10|-1.844805e+11 -2.680311e+07| 0:0:01| chol 2 2
31|0.041|0.014|3.0e-06|6.7e-04|1.3e+11|-2.481490e+11 -4.513078e+07| 0:0:01| chol 2 2
32|0.050|0.014|3.1e-06|6.9e-04|1.9e+11|-3.461953e+11 -6.944319e+07| 0:0:01| chol 2 2
33|0.054|0.019|3.7e-06|7.0e-04|2.7e+11|-4.845549e+11 -1.166257e+08| 0:0:01|
sqlp stop: dual problem is suspected of being infeasible
number of iterations = 33
residual of dual infeasibility
certificate X = 1.92e-10
reldist to infeas. <= 6.62e-13
Total CPU time (secs) = 1.48
CPU time per iteration = 0.04
termination code = 2
DIMACS: 1.4e-05 0.0e+00 2.2e-03 0.0e+00 -1.0e+00 5.6e-01
Status: Infeasible
Optimal value (cvx_optval): +Inf