-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcmpres.awk
executable file
·2202 lines (2022 loc) · 80.9 KB
/
cmpres.awk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/awk -f
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#* *
#* This file is part of the program and library *
#* SCIP --- Solving Constraint Integer Programs *
#* *
#* *
#* Copyright (C) 2002-2016 Konrad-Zuse-Zentrum *
#* fuer Informationstechnik Berlin *
#* *
#* SCIP is distributed under the terms of the ZIB Academic License. *
#* *
#* You should have received a copy of the ZIB Academic License *
#* along with SCIP; see the file COPYING. If not email to [email protected]. *
#* *
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#
#@file cmpres.awk
#@brief SCIP Check Comparison Report Generator
#@author Tobias Achterberg
#@author Robert Waniek
#@author Marc Pfetsch
#@author Timo Berthold
#
function abs(x)
{
return x < 0 ? -x : x;
}
function min(x,y)
{
return (x) < (y) ? (x) : (y);
}
function max(x,y)
{
return (x) > (y) ? (x) : (y);
}
function max3(x,y,z)
{
return (x) >= (y) ? max(x,z) : max(y,z);
}
function ceil(x)
{
return (x == int(x) ? x : (x < 0 ? int(x) : int(x+1)));
}
function floor(x)
{
return (x == int(x) ? x : (x < 0 ? int(x-1) : int(x)));
}
function fracceil(x,f)
{
return ceil(x/f)*f;
}
function fracfloor(x,f)
{
return floor(x/f)*f;
}
function sign(x)
{
return (x >= 0 ? 1.0 : -1.0);
}
function mod(x,m)
{
return (x - m*floor(x/m));
}
function printhline(nsolver,short, printsoltimes)
{
for( s = 0; s < nsolver; ++s )
{
if( s == 0 )
printf("------------------------------+-+---------+--------+");
else
{
if( !short )
printf("-+---------+--------+------+------+");
else
printf("-+---------+--------+");
}
if( printsoltimes )
{
if( s == 0 )
printf("---------+--------+");
else
printf("------+------+");
}
}
printf("-------------\n");
}
function isfaster(t,reft,tol)
{
return (t < 1.0/tol*reft && t <= reft - 0.2);
}
function isslower(t,reft,tol)
{
return isfaster(reft, t, tol);
}
function texcompstr(val,refval, x,s,t)
{
x = floor(100*(val/refval-1.0)+0.5);
s = "";
t = "";
if( x < 0 )
{
if( x <= -texcolorlimit )
{
s = "\\textcolor{red}{\\raisebox{0.25ex}{\\tiny $-$}";
t = "}";
}
else
s = "\\raisebox{0.25ex}{\\tiny $-$}";
}
else if( x > 0 )
{
if( x >= +texcolorlimit )
{
s = "\\textcolor{blue}{\\raisebox{0.25ex}{\\tiny $+$}";
t = "}";
}
else
s = "\\raisebox{0.25ex}{\\tiny $+$}";
}
return sprintf("%s%d%s", s, abs(x), t);
}
function texstring(s, ts)
{
ts = s;
gsub(/_/, "\\_", ts);
return ts;
}
function texint(x, ts,r)
{
ts = "";
x = floor(x);
while( x != 0 )
{
r = mod(x, 1000);
x = floor(x/1000);
if( ts != "" )
ts = "\\," ts;
if ( x > 0 )
ts = sprintf("%03d", r) "" ts;
else
ts = r "" ts;
}
return ts;
}
function texsolvername(s, sname)
{
sname = solvername[s];
if( setname[sname] != "" )
sname = setname[sname];
else
{
sub(/.*:/, "", sname);
sub(/.*_/, "", sname);
if( length(sname) > 12 )
sname = substr(sname, length(sname)-11, 12);
}
return sname;
}
# McNemar statistical test
#
# input: two arrays of Boolean values whose difference should be tested for statistical significance and the length of
# both arrays
#
# output: the chi_squared value, (which needs to be transformed to the desired p-value, see also function chi_to_p
function mcnemar(ref_array, solver_array, problistlen)
{
chi_squared = 0.0;
b = 0;
c = 0;
# count the number of entries for which both arrays differ,
# separately for both possible differences (TRUE/FALSE and FALSE/TRUE)
for( i = 0; i < problistlen; ++i )
{
if( ref_array[i] && !solver_array[i] )
b++;
else if( !ref_array[i] && solver_array[i] )
c++;
}
# textbook McNemar formula, the square of the differences of both counters divided by their sum is supposed to be
# chi-square distributed for a random experiment
if( b + c > 0 )
chi_squared = (b-c)*(b-c)/(1.0*(b+c));
return chi_squared;
}
# check significance of chi-square distribution with degree 1 using quantiles
function chi_to_p(chi)
{
if ( chi < 3.841 )
printf(", 0.05 < p X");
else if ( 3.841 <= chi && chi < 5.024 ) # quantile for 1 - 0.05 = 0.95
printf(", p ~ (0.025, 0.05] !");
else if ( 5.024 <= chi && chi < 6.635 ) # quantile for 1 - 0.025 = 0.975
printf(", p ~ (0.01, 0.025] !!");
else if ( 6.635 <= chi && chi < 7.879 ) # quantile for 1 - 0.01 = 0.99
printf(", p ~ (0.005, 0.01]!!!");
else if ( 7.879 <= chi && chi < 12.116 ) # quantile for 1 - 0.005 = 0.995
printf(", p ~(0.0005,0.005]!!!");
else # quantile for 1 - 0.0005 = 0.9995
printf(", p <= 0.0005 !!!");
}
# swaps position i and j of array a
function swap(a, i, j) {
t = a[i]; a[i] = a[j]; a[j] = t;
}
# quicksort algorithm that sorts by the absolute values in non-increasing order
function qsort(a, left, right)
{
# stop recursion
if (left >= right)
return;
# use a random pivot element
swap(a, left, left+int((right-left+1)*rand()));
last = left;
for( i = left+1; i <= right; i++ )
{
if( abs(a[i]) < abs(a[left]) )
swap(a, ++last, i);
}
# swap back pivot, recursive calls
swap(a, left, last);
qsort(a, left, last-1);
qsort(a, last+1, right);
}
# copy time array
function parse_time(ref_array,solver_array,time,o,printorder,probidx,problistlen)
{
s = printorder[o];
p0 = printorder[0];
n = 0;
for( i = 0; i < problistlen; i++ )
{
p = problist[i];
if(probidx[p,p0] != "" && probidx[p,s] != "")
{
ref_array[n] = time[p0,probidx[p,p0]];
solver_array[n] = time[s,probidx[p,s]];
n++;
}
}
}
# copy node array
function parse_nodes(ref_array,solver_array,nodes,o,probidx,problistlen,status,infinity)
{
s = printorder[o];
p0 = printorder[0];
n = 0;
for( i = 0; i < problistlen; i++ )
{
p = problist[i];
if(probidx[p,p0] != "" && probidx[p,s] != "")
{
if( status[p0,probidx[p,p0]] == "timeout" || status[p0,probidx[p,p0]] == "memlimit" )
ref_array[n] = infinity;
else
ref_array[n] = nodes[p0,probidx[p,p0]];
if( status[s,probidx[p,s]] == "timeout" || status[s,probidx[p,s]] == "memlimit" )
solver_array[n] = infinity;
else
solver_array[n] = nodes[s,probidx[p,s]];
n++;
}
}
}
# filter results for Wilcoxon test, only keep data for instances for which both, the relative difference and the
# absolute difference are larger than the given thresholds rel_epsilon and abs_delta
function filter(ref_array, solver_array, problistlen, rel_epsilon, abs_delta)
{
n = 0;
for( i = 0; i < problistlen; i++ )
{
diff = abs(solver_array[i] - ref_array[i]);
if( diff > abs_delta && diff / max3(abs(solver_array[i]), abs(ref_array[i]), 1.0) > rel_epsilon )
{
ref_array[n] = ref_array[i];
solver_array[n] = solver_array[i];
n++;
}
}
return n;
}
# computes the improvement/degradation factors (always >= 1) and marks them by opposite signs
# (negative sign if solver_array[i] is faster than ref_array[i])
function factorize(ref_array, solver_array, n, maxval)
{
for( i = 0; i < n; ++i )
{
if( ref_array[i] >= maxval && solver_array[i] < maxval )
ref_array[i] = -1.0 * maxval;
else if( ref_array[i] < maxval && solver_array[i] >= maxval )
ref_array[i] = 1.0 * maxval;
else if( ref_array[i] == 0.0 && solver_array[i] == 0.0 )
ref_array[i] = 0.0;
else if( ref_array[i] == 0.0 )
ref_array[i] = 1.0 * maxval;
else if( solver_array[i] == 0.0 )
ref_array[i] = -1.0 * maxval;
else if( solver_array[i] / ref_array[i] < 1.0 )
ref_array[i] = -1.0 * ref_array[i] / solver_array[i];
else
ref_array[i] = solver_array[i] / ref_array[i];
solver_array[i] = 0.0;
}
}
# Wilcoxon signed rank test
#
# input: two arrays of real values whose difference should be tested for statistical significance, the length of
# both arrays, and the employed timelimit (to rank instances for which one solver hit the timelimit equally)
#
# output: the z value, (which needs to be transformed to the desired p-value, see also function z_to_p
#
# note: to get meaningful results, some form of filtering should be applied to remove nearly-identical results from the
# test set, see also the filter() function
function wilcoxon(ref_array, solver_array, problistlen, timelimit)
{
w_minus = 0;
w_plus = 0;
# avoid degenerate case
if ( problistlen == 0 )
return 0.0;
# calculate difference
for( i = 0; i < problistlen; i++ )
{
differences[i] = ref_array[i] - solver_array[i];
if( (ref_array[i] >= timelimit) != (solver_array[i] >= timelimit) )
differences[i] = sign(differences[i]) * timelimit;
}
# sort differences by their absolute values
qsort(differences, 0, problistlen-1);
i = 0;
# calculate rank sums
while( i < problistlen )
{
i_start = i;
i_end = i;
i_sum = 0;
# use average in case of tied samples (identical differences) - always executed once
while ( i_end < problistlen && abs((abs(differences[i_start]) - abs(differences[i_end]))) < 1e-06 )
{
i_sum += i_end;
i_end++;
}
i_sum = i_sum/(i_end - i_start);
# add (average) rank values to rank sums
#
# in the default case that the value is unique, this loop and the previous loop are traversed exactly once, s.t.
# the value is simply added to one of the sums
while ( i < i_end )
{
if( differences[i] < 0 )
w_minus += (i_sum+1);
else if( differences[i] > 0 )
w_plus += (i_sum+1);
i++;
}
}
# apply Wilcoxon formula
w = 1.0 * min(w_minus, w_plus);
# apply correction for small number of instances
if ( problistlen <= 60 )
z = (abs(w - 0.25 * problistlen * (problistlen + 1.0)) - 0.5) / sqrt(problistlen * (problistlen+1) * (2*problistlen + 1.0)/24.0);
else
z = (w - 0.25 * problistlen * (problistlen + 1.0)) / sqrt(problistlen * (problistlen + 1.0) * (2*problistlen + 1.0)/24.0);
return z;
}
# check significance of z-value with respect to the normal distribution with mean 0 and variance 1
function z_to_p(z)
{
# check whether z lies in (1 - 0.05) quantile -> null hypothesis is accepted
if ( -1.960 <= z && z <= 1.960 ) # quantile for 1 - 0.05
printf(", 0.05 <= p X");
else if ( -2.241 <= z && z <= 2.241 ) # quantile for 1 - 0.025
printf(", p ~ [0.025, 0.05) !");
else if ( - 2.576 <= z && z <= 2.576 ) # quantile for 1 - 0.01
printf(", p ~ [0.01, 0.025) !!");
else if ( - 2.807 <= z && z <= 2.807 ) # quantile for 1 - 0.005
printf(", p ~ [0.005, 0.01)!!!");
else if ( - 3.481 <= z && z <= 3.481 ) # quantile for 1 - 0.0005
printf(", p ~[0.0005,0.005)!!!");
else # quantile for 1 - 0.0005 = 0.9995
printf(", p < 0.0005 !!!");
}
BEGIN {
# if nonzero, then treat every abort or fail as if solved successfully with the time specified here
failtime = 0;
# the reference solver w.r.t. which to compute relative performance
firstsolver = "OCTERACT";
short = 0; #for each non reference solver, only absolute time and number of nodes are printed
printsoltimes = 0; # for reference solver, absolute time to first and best solution are printed, for other solvers the corresponding ratios
#! please NOTE that this additional output is currently only available for SCIP .res-files created with the evalcheck.sh script and
# the flag printsoltimes = 1 set in check.awk. If other solvers are involved, leave this flag set to 0.
printgap = 0; # if timeout, then print absolute gap at termination in time column, if gap is finite
printsoltimes = !short && printsoltimes; # short deactivates the detailed solution times output
infinity = 1e+20;
timegeomshift = 10.0;
nodegeomshift = 100.0;
mintime = 0.5;
wintolerance = 1.1;
markbettertime = 1.1;
markworsetime = 1.1;
markbetternodes = 5.0;
markworsenodes = 5.0;
onlymarked = 0;
onlyprocessed = 0;
maxscore = 10.0;
consistency = (failtime > 0 ? 0 : 1);
onlyfeasible = 0;
onlyinfeasible = 0;
onlyfail = 0;
exclude = "";
texfile = "";
texincfile = "";
texsummaryfile = "";
texsummaryheader = 0;
texsummaryweight = 0;
texsummaryshifted = 0;
texcolorlimit = 5;
textestset = "";
texcmpfile = "";
texcmpfiledir = "";
texcmpfilename = "";
diagramfile = "";
diagramnsteps = 5; # number of steps at the time line
diagramyellowbg = 0; # Should the background be colored in SCIP-HP-yellow ?
diagramgerman = 0; # Soll die Beschriftung deutsch sein?
thesisnames = 0;
nsetnames = 0;
onlygroup = 0;
group = "default";
problistlen = 0;
nsolver = 0;
nprobs[nsolver] = 0;
fulltotaltime = 0.0;
}
/^=group=/ {
group = $2;
}
/^=setname= / {
if( setorder[$2] == 0 )
{
nsetnames++;
setorder[$2] = nsetnames;
setname[$2] = $3;
for( i = 4; i <= NF; i++ )
setname[$2] = setname[$2]" "$i;
}
setingroup[$2,group] = 1;
}
/^@02 timelimit: / {
timelimit[nsolver] = $3;
}
/^@01 / {
if( onlygroup == 0 || setingroup[$2,onlygroup] )
{
solvername[nsolver] = $2;
nsolver++;
}
nprobs[nsolver] = 0;
}
// {
statuses["ok"];
statuses["timeout"];
statuses["unknown"];
statuses["abort"];
statuses["fail"];
statuses["readerror"];
statuses["better"];
statuses["solved"];
statuses["sollimit"];
statuses["gaplimit"];
statuses["memlimit"];
statuses["nodelimit"];
name[nsolver,nprobs[nsolver]] = $1;
validline = 0;
# check if this is a useable line
if( $10 in statuses ) # BLIS, SYMPHONY
{
# collect data (line with problem size and simplex iterations)
type[nsolver,nprobs[nsolver]] = "?";
conss[nsolver,nprobs[nsolver]] = $2;
vars[nsolver,nprobs[nsolver]] = $3;
dualbound[nsolver,nprobs[nsolver]] = max(min($4, +infinity), -infinity);
primalbound[nsolver,nprobs[nsolver]] = max(min($5, +infinity), -infinity);
gap[nsolver,nprobs[nsolver]] = $6;
iters[nsolver,nprobs[nsolver]] = $7;
nodes[nsolver,nprobs[nsolver]] = max($8,1);
time[nsolver,nprobs[nsolver]] = fracceil(max($9,mintime),0.1);
status[nsolver,nprobs[nsolver]] = $10;
printsoltimes = 0; # additional output is only available for SCIP-.res files
validline = 1;
}
if( $11 in statuses ) # from NLP-trace-files
{
# collect data (line with problem type, problem size and simplex iterations)
type[nsolver,nprobs[nsolver]] = $2;
conss[nsolver,nprobs[nsolver]] = $3;
vars[nsolver,nprobs[nsolver]] = $4;
dualbound[nsolver,nprobs[nsolver]] = max(min($5, +infinity), -infinity);
primalbound[nsolver,nprobs[nsolver]] = max(min($6, +infinity), -infinity);
gap[nsolver,nprobs[nsolver]] = $7;
iters[nsolver,nprobs[nsolver]] = $8;
nodes[nsolver,nprobs[nsolver]] = max($9,1);
time[nsolver,nprobs[nsolver]] = fracceil(max($10,mintime),0.1);
status[nsolver,nprobs[nsolver]] = $11;
printsoltimes = 0; # additional output is only available for SCIP-.res files
validline = 1;
}
if( $12 in statuses ) # GUROBI, CBC
{
# collect data (line with original and presolved problem size and simplex iterations)
type[nsolver,nprobs[nsolver]] = "?";
conss[nsolver,nprobs[nsolver]] = $4;
vars[nsolver,nprobs[nsolver]] = $5;
dualbound[nsolver,nprobs[nsolver]] = max(min($6, +infinity), -infinity);
primalbound[nsolver,nprobs[nsolver]] = max(min($7, +infinity), -infinity);
gap[nsolver,nprobs[nsolver]] = $8;
iters[nsolver,nprobs[nsolver]] = $9;
nodes[nsolver,nprobs[nsolver]] = max($10,1);
time[nsolver,nprobs[nsolver]] = fracceil(max($11,mintime),0.1);
status[nsolver,nprobs[nsolver]] = $12;
printsoltimes = 0; # additional output is only available for SCIP-.res files
validline = 1;
}
if( $13 in statuses ) # GLPK, CPLEX, SCIP without columns displaying times to first and best solution
{
# collect data (line with problem type, original and presolved problem size and simplex iterations)
type[nsolver,nprobs[nsolver]] = $2;
conss[nsolver,nprobs[nsolver]] = $5;
vars[nsolver,nprobs[nsolver]] = $6;
dualbound[nsolver,nprobs[nsolver]] = max(min($7, +infinity), -infinity);
primalbound[nsolver,nprobs[nsolver]] = max(min($8, +infinity), -infinity);
gap[nsolver,nprobs[nsolver]] = $9;
iters[nsolver,nprobs[nsolver]] = $10;
nodes[nsolver,nprobs[nsolver]] = max($11,1);
time[nsolver,nprobs[nsolver]] = fracceil(max($12,mintime),0.1);
status[nsolver,nprobs[nsolver]] = $13;
printsoltimes = 0; # additional output is only available for SCIP-.res files
validline = 1;
}
if( $15 in statuses ) # SCIP with solution times to first/last
{
# collect data (line with problem type, original and presolved problem size and simplex iterations)
type[nsolver,nprobs[nsolver]] = $2;
conss[nsolver,nprobs[nsolver]] = $5;
vars[nsolver,nprobs[nsolver]] = $6;
dualbound[nsolver,nprobs[nsolver]] = max(min($7, +infinity), -infinity);
primalbound[nsolver,nprobs[nsolver]] = max(min($8, +infinity), -infinity);
gap[nsolver,nprobs[nsolver]] = $9;
iters[nsolver,nprobs[nsolver]] = $10;
nodes[nsolver,nprobs[nsolver]] = max($11,1);
time[nsolver,nprobs[nsolver]] = fracceil(max($12,mintime),0.1);
timetofirst[nsolver,nprobs[nsolver]] = fracceil(max($13,mintime),0.1);
timetobest[nsolver, nprobs[nsolver]] = fracceil(max($14, mintime), 0.1);
status[nsolver,nprobs[nsolver]] = $15;
validline = 1;
}
if( validline )
{
# postprocessing of information
if( status[nsolver,nprobs[nsolver]] == "better" )
status[nsolver,nprobs[nsolver]] = "timeout";
if( status[nsolver,nprobs[nsolver]] == "sollimit" || status[nsolver,nprobs[nsolver]] == "gaplimit" || status[nsolver,nprobs[nsolver]] == "solved" )
status[nsolver,nprobs[nsolver]] = "ok";
# SV on Hans' request
if( failtime > 0 && (status[nsolver,nprobs[nsolver]] == "fail" || status[nsolver,nprobs[nsolver]] == "abort") )
{
status[nsolver,nprobs[nsolver]] = "timeout";
time[nsolver,nprobs[nsolver]] = failtime;
}
if( status[nsolver,nprobs[nsolver]] == "timeout" || status[nsolver,nprobs[nsolver]] == "nodelimit" || status[nsolver,nprobs[nsolver]] == "memlimit")
hitlimit[nsolver,nprobs[nsolver]] = 1;
else
hitlimit[nsolver,nprobs[nsolver]] = 0;
probidx[$1,nsolver] = nprobs[nsolver];
probcnt[$1]++;
nprobs[nsolver]++;
if( probcnt[$1] == 1 )
{
problist[problistlen] = $1;
problistlen++;
}
}
}
END {
if( onlygroup > 0 && nsolver == 1 && solvername[1] == "SCIP:default" )
{
printf("only SCIP:default setting found\n");
exit 1;
}
if( nsolver == 0 )
{
printf("no instances found in log file\n");
exit 1;
}
# tex comparison file: either directly as 'texcmpfile' or as pair 'texcmpfiledir/texcmpfilename'
if( texcmpfile == "" && texcmpfiledir != "" && texcmpfilename != "" )
texcmpfile = texcmpfiledir "/" texcmpfilename;
# process exclude string
n = split(exclude, a, ",");
for( i = 1; i <= n; i++ )
excluded[a[i]] = 1;
# initialize means
for( s = 0; s < nsolver; ++s )
{
# cat: -1 - all within time limit, 0 - all, 1 - different path, 2 - equal path, 3 - all timeout
for( cat = -1; cat <= 3; cat++ )
{
nevalprobs[s,cat] = 0;
nprocessedprobs[s,cat] = 0;
timetotal[s,cat] = 0.0;
nodetotal[s,cat] = 0.0;
timegeom[s,cat] = 1.0;
nodegeom[s,cat] = 1.0;
timeshiftedgeom[s,cat] = timegeomshift;
timetofirstgeom[s,cat] = 1.0;
timetofirstshiftedgeom[s,cat] = timegeomshift;
timetobestgeom[s,cat] = 1.0;
timetobestshiftedgeom[s,cat] = timegeomshift;
nodeshiftedgeom[s,cat] = nodegeomshift;
reftimetotal[s,cat] = 0.0;
refnodetotal[s,cat] = 0.0;
reftimegeom[s,cat] = 1.0;
reftimetofirstgeom[s,cat] = 1.0;
reftimetobestgeom[s,cat] = 1.0;
refnodegeom[s,cat] = 1.0;
reftimeshiftedgeom[s,cat] = timegeomshift;
refnodeshiftedgeom[s,cat] = nodegeomshift;
reftimetofirstshiftedgeom[s,cat] = timegeomshift;
reftimetobestshiftedgeom[s,cat] = timegeomshift;
wins[s,cat] = 0;
nsolved[s,cat] = 0;
ntimeouts[s,cat] = 0;
nfails[s,cat] = 0;
better[s,cat] = 0;
worse[s,cat] = 0;
betterobj[s,cat] = 0;
worseobj[s,cat] = 0;
feasibles[s,cat] = 0;
score[s,cat] = 1.0;
}
}
besttimegeom = 1.0;
besttimetofirstgeom = 1.0;
besttimetobestgeom = 1.0;
bestnodegeom = 1.0;
besttimeshiftedgeom = timegeomshift;
besttimetofirstshiftedgeom = timegeomshift;
besttimetobestshiftedgeom = timegeomshift;
bestnodeshiftedgeom = nodegeomshift;
bestnsolved = 0;
bestntimeouts = 0;
bestnfails = 0;
bestbetter = 0;
bestbetterobj = 0;
bestfeasibles = 0;
# calculate the order in which the columns should be printed: firstsolver first, default < non-default
firstsolverlen = length(firstsolver);
for( s = 0; s < nsolver; ++s )
{
sname = solvername[s];
for( o = 0; o < s; ++o )
{
i = printorder[o];
iname = solvername[i];
if( nsetnames > 0 )
{
# use order given by =setname= entries
if( setorder[sname] < setorder[iname] )
break;
}
else
{
# use alphabetical order, but put firstsolver first and "default" before all others
if( substr(sname, 1, firstsolverlen) == firstsolver && substr(iname, 1, firstsolverlen) != firstsolver )
break;
if( substr(sname, 1, firstsolverlen) == substr(iname, 1, firstsolverlen) &&
match(sname, "default") != 0 && match(iname, "default") == 0 )
break;
if( substr(sname, 1, firstsolverlen) == substr(iname, 1, firstsolverlen) &&
(match(sname, "default") == 0) == (match(iname, "default") == 0) &&
sname < iname )
break;
}
}
for( j = s-1; j >= o; --j )
printorder[j+1] = printorder[j];
printorder[o] = s;
}
# print headers
for( o = 0; o < nsolver; ++o )
{
s = printorder[o];
sname = solvername[s];
if( o == 0 )
{
if( printsoltimes )
{
if ( length(sname) <= 58 )
printf(" %58s |", sname);
else
printf(" *%57s |", substr(sname, length(sname)-58));
}
else
{
if ( length(sname) <= 49 )
printf(" %49s |", sname)
else
printf(" *%48s |", substr(sname, length(sname)-39));
}
}
else
{
if( short )
{
if( length(sname) <= 19 )
printf("%19s |", sname);
else
printf("*%16s |", substr(sname, length(sname)-17));
}
else if( printsoltimes )
{
if( length(sname) <= 47 )
printf("%47s |", sname);
else
printf("*%46s |", substr(sname, length(sname)-47));
}
else
{
if( length(sname) <= 33 )
printf("%33s |", sname);
else
printf("*%30s |", substr(sname, length(sname)-31));
}
}
}
printf("\n");
printhline(nsolver,short, printsoltimes);
printf(" Name |");
for( s = 0; s < nsolver; ++s )
{
if( s == 0 || short )
printf("F| Nodes | Time |");
else
printf("F| Nodes | Time | NodQ | TimQ |");
if( printsoltimes )
{
if( s == 0 )
printf(" ToFirst | ToLast |");
else
printf(" FirQ | LasQ |");
}
}
printf(" bounds check\n");
printhline(nsolver,short, printsoltimes);
# tex comparison headers
if( texcmpfile != "" )
{
printf("{\\sffamily\n") > texcmpfile;
printf("\\scriptsize\n") > texcmpfile;
printf("\\setlength{\\extrarowheight}{1pt}\n") > texcmpfile;
printf("\\setlength{\\tabcolsep}{2pt}\n") > texcmpfile;
printf("\\newcommand{\\g}{\\raisebox{0.25ex}{\\tiny $>$}}\n") > texcmpfile;
printf("\\newcommand{\\spc}{\\hspace{2em}}\n") > texcmpfile;
# add names of solvers
for ( o = 0; o < nsolver; ++o )
{
s = printorder[o];
solverextension = solverextension "i";
printf("\\newcommand{\\solvername%s}{%s}\n", solverextension, solvername[s]) > texcmpfile;
}
printf("\\begin{tabular*}{\\columnwidth}{@{\\extracolsep{\\fill}}l") > texcmpfile;
for( s = 0; s < nsolver; ++s )
printf("@{\\spc}rr") > texcmpfile;
printf("@{}}\n") > texcmpfile;
printf("\\toprule\n") > texcmpfile;
solverextension = "";
for( o = 0; o < nsolver; ++o )
{
s = printorder[o];
solverextension = solverextension "i";
printf("& \\multicolumn{2}{@{\\spc}c%s}{\\solvername%s} ", o < nsolver-1 ? "@{\\spc}" : "", solverextension) > texcmpfile;
}
printf("\\\\\n") > texcmpfile;
for( o = 0; o < nsolver; ++o )
printf("& Nodes & Time ") > texcmpfile;
printf("\\\\\n") > texcmpfile;
printf("\\midrule\n") > texcmpfile;
}
# display the problem results and calculate mean values
for( i = 0; i < problistlen; ++i )
{
p = problist[i];
if( length(p) > 28 )
shortp = substr(p, length(p)-27, 28);
else
shortp = p;
line = sprintf("%-28s", shortp);
fail = 0;
readerror = 0;
unprocessed = 0;
mindb = +infinity;
maxdb = -infinity;
minpb = +infinity;
maxpb = -infinity;
itercomp = -1;
nodecomp = -1;
timecomp = -1;
timetofirstcomp = -1;
timetobestcomp = -1;
besttime = +infinity;
besttimetofirst = +infinity;
besttimetobest = +infinity;
bestnodes = +infinity;
worsttime = -infinity;
worstnodes = -infinity;
worstiters = -infinity;
worsttimetofirst = -infinity;
worsttimetobest = -infinity;
nthisunprocessed = 0;
nthissolved = 0;
nthistimeouts = 0;
nthisfails = 0;
ismini = 0;
ismaxi = 0;
mark = " ";
marker = " ";
notimeout = 1;
# check for exclusion
if( excluded[p] )
unprocessed = 1;
# find best and worst run and check whether this instance should be counted in overall statistics
for( s = 0; s < nsolver; ++s )
{
pidx = probidx[p,s];
processed = (pidx != "");
# make sure, nodes and time are non-zero for geometric means
nodes[s,pidx] = max(nodes[s,pidx], 1);
time[s,pidx] = max(time[s,pidx], mintime);
fulltotaltime += time[s,pidx];
# If we got a timeout although the time limit has not been reached (e.g., due to a memory limit),
# we assume that the run would have been continued with the same nodes/sec.
# Set the time to the time limit and increase the nodes accordingly.
# if( status[s,pidx] == "timeout" && time[s,pidx] < timelimit[s] )
# {
# nodes[s,pidx] *= timelimit[s]/time[s,pidx];
# time[s,pidx] = timelimit[s];
# }
# if the solver exceeded the timelimit, set status accordingly
if( (status[s,pidx] == "ok" || status[s,pidx] == "unknown") && timelimit[s] > 0.0 && time[s,pidx] > timelimit[s] )
{
status[s,pidx] = "timeout";
time[s,pidx] = timelimit[s];
}
# check if all solvers processed the problem
if( !processed )
{
marker = "?";
unprocessed = 1;
}
# check if solver ran successfully (i.e., no abort nor fail)
if( processed && (status[s,pidx] == "ok" || status[s,pidx] == "unknown" || status[s,pidx] == "timeout" || status[s,pidx] == "nodelimit" || status[s,pidx] == "memlimit") )
{
besttime = min(besttime, time[s,pidx]);
bestnodes = min(bestnodes, nodes[s,pidx]);
besttimetofirst = min(besttimetofirst, timetofirst[s,pidx]);
besttimetobest = min(besttimetobest, timetobest[s,pidx]);
worsttime = max(worsttime, time[s,pidx]);
worstnodes = max(worstnodes, nodes[s,pidx]);
worstiters = max(worstiters, iters[s,pidx]);
worsttimetofirst = max(worsttimetofirst, timetofirst[s, pidx]);
worsttimetobest = max(worsttimetobest, timetobest[s, pidx]);
}
}
worsttime = max(worsttime, mintime);
worsttimetofirst = max(worsttimetofirst, mintime);
worsttimetobest = max(worsttimetobest, mintime);
worstnodes = max(worstnodes, 1);
worstiters = max(worstiters, 0);
# check for each solver if it has same path as reference solver -> category
for( o = 0; o < nsolver; ++o )
{
s = printorder[o];
pidx = probidx[p,s];
processed = (pidx != "");
if( !processed )
{
notimeout = 0;
continue;
}
else
{
if ( status[s,pidx] == "timeout" )
{
# If memory limit was exceeded or we hit a hard time/memory limit,
# replace time and nodes by worst time and worst nodes of all runs.
# Note this also takes action if the time limits of the runs are
# different: in this case we set the values to the worst case.
# if ( time[s,pidx] < 0.99*worsttime || nodes[s,pidx] <= 1 )
# {
# iters[s,pidx] = worstiters+s; # make sure this is not treated as equal path
# nodes[s,pidx] = worstnodes;
# time[s,pidx] = worsttime;
# }
}
}
if( nodecomp == -1 )
{
itercomp = iters[s,pidx];
nodecomp = nodes[s,pidx];
timecomp = time[s,pidx];