%load('matrixoutput.mat');
%load('dec132015matrixoutputtol12');    % work PC
%load('dec13homePCmatrixoutputtol12all45');   % tolerance 12 home PC
load('dec1515WorkPCmatrixoutputtol5');      


VertLabel={'Esc16a','Esc16b','Esc16c','Esc16d','Esc16e','Esc16g',...
    'Esc16h','Esc16i','Esc16j','Had12 ','Had14 ','Had16 ','Had18 ',...
    'Had20 ','Kra30a','Kra30b','Kra32 ','Nug12 ','Nug14 ','Nug15 ',...
    'Nug16a','Nug16b','Nug17 ','Nug18 ','Nug20 ','Nug21 ','Nug22 ',...
    'Nug24 ','Nug25 ','Nug27 ','Nug28 ','Nug30 ','Rou12 ','Rou15 ',...
    'Rou20 ','Scr12','Scr15 ','Scr20 ','Tai12a','Tai15a','Tai17a',...
    'Tai20a','Tai25a','Tai30a','Tho30 '};

HorizLabel={
        '1.','2.','3.','4.','5.','6.','7. ADMM','8 Tol5','9 Tol5','10 Tol12/5','11 HKM'
'opt','Bundle \cite{rendlsotirov:06}','HKM-FR','ADMM','feas', 'ADMM','vs Bundle', 'cpusec','cpusec', 'cpuratio','cpuratio'
'value','LowBnd','LowBnd','LowBnd','UpBnd', '\%gap','\%Impr LowBnd','HighRk','LowRk','HighRk','Tol 9'
	             };
%%%
%   FEAS1 = feas_obj1;
%   FEAS2 = feas_obj1row1;
%   FEAS3 = feas_obj2;
%   FEAS4 = feas_obj2row1;

%outputmatrix11(iprob,:)=...
%   [Out11.obj(end) lbd feas_obj1 feas_obj1row1 Out11.iter Out11.toc];
%outputmatrix22(iprob,:)=...
%   [Out22.obj(end) lbd feas_obj2 feas_obj2row1 Out22.iter Out22.toc];
   
OptBundHKM=[68 59 50 % Esc16a
292 288 276 % Esc16b
160 142 132 % Esc16c
16 8 -12 % Esc16d
28 23 13 % Esc16e
26 20 11 % Esc16g
996 970 909 % Esc16h
14 9 -21 % Esc16i
8 7 -4 % Esc16j
1652 1643 1641 %had12
2724 2715 2709 %had14
3720 3699 3678 %had16
5358 5317 5287 %had18
6922 6885 6848 %had20
149936 136059 0   %tho30
91420 81156 0 %kra30b
88700 79659 0 %kra32
578	557 530 %nug12
1014 992 960 %nug14
1150 1122 1071 %nug15
1610 1570 1528 %nug16a
1240 1188 1139 %nug16b
1732 1669 1622 %nug17
1930 1852 1802 %nug18
2570 2451 2386 %nug20
2438 2323 2386 %nug21
3596 3440 3396 %nug22
3488 3310 0 %nug24
3744 3535 0 %nug25
5234 4965 0 %nug27
5166 4901 0 %nug28
6124 5803 0 %nug30
235528 223680 221161 %rou12
354210 333287 323235 %rou15
725522 663833 642856 %rou20
31410 29321 23973 %scr12
51140 48836 42204 %scr15
110030 94998 83302 %scr20
224416 222784 215637 %tai12a
388214 364761 349586 %tai15a
491812 451317 441294 %tai17a
703482 637300 619092 %tai20a
1167256 1041337	1096657 %tai25a
1818146 1652186 0 %tai30
88900 77647 0 %kra30a
];

minfeasvals=min([outputmatrix11(:,3:4) outputmatrix22(:,3:4)]')';
temp=(outputmatrix11(:,2)-(1e-5));   % to avoid ceil roundoff error
lowerbnd=ceil(temp);
percgap=(100*(minfeasvals-lowerbnd))./OptBundHKM(:,1);  % using abs(lower-best-upper)/true-opt
percimpr=(100*(lowerbnd-OptBundHKM(:,2)))./OptBundHKM(:,1);
%[h11,m11,s11]=mytime(outputmatrix11(:,end));
cpu5H=outputmatrix11(:,end);
cpu5L=outputmatrix22(:,end); 
%Results=[OptBundHKM lowerbnd minfeasvals percgap percimpr (outputmatrix11(:,end)) outputmatrix22(:,end) 
temp=OptBundHKM(:,3);
temp(temp==0)=-1111;   % solution not found
OptBundHKM(:,3)=temp;
Results=[OptBundHKM lowerbnd minfeasvals percgap percimpr cpu5H cpu5L
];
%Results=[OptBundHKM ceil(outputmatrix11(:,2)) minfeasvals [h11 m11 s11] outputmatrix22(:,end) percgap percimpr];
%aformat=['%s','%d','%d','%d','%d','%d','%d','%8.2f'];
%aformat=['%d  &  %d  &  %d  &  %i &  %d  &  %5.2e  &  %5.2f  &  %6.2f  & %6.2f'];
aformat=['%d  &  %d  &  %d  &  %i &  %d  &  %6.2f  &  %6.2f  &  %5.2e  & %5.2f & %5.2f  & %5.2f'];
%aformat=['%d  &  %d  &  %d  &  %i &  %d  &  %s:%s:%s &  %5.2f  &  %i  &  %i'];

HKMcputimes     % add cputimes for HKM ... variable is HKMcpu
load('dec132015matrixoutputtol12');    % work PC
%Results=[Results (outputmatrix11(:,end))./cpu5H outputmatrix22(:,end)./cpu5L]; 
HKMratio=HKMcpu./cpu5L; 
HKMratio(HKMratio<0)=1111.11;
Results=[Results (outputmatrix11(:,end))./cpu5H HKMratio];
latextable(Results,'Horiz',HorizLabel,'Vert',VertLabel,'Vline',[0,1,NaN],'Hline',[0,3,3,NaN],'format',aformat,'name','TableTemp.tex');
