1 | #!/usr/bin/awk -f |
---|
2 | #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
3 | #* * |
---|
4 | #* This file is part of the test engine for MIPLIB2010 * |
---|
5 | #* * |
---|
6 | #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
7 | # $Id: parse.awk 1854 2013-01-28 00:02:55Z stefan $ |
---|
8 | |
---|
9 | function abs(x) |
---|
10 | { |
---|
11 | return x < 0 ? -x : x; |
---|
12 | } |
---|
13 | function min(x,y) |
---|
14 | { |
---|
15 | return (x) < (y) ? (x) : (y); |
---|
16 | } |
---|
17 | function max(x,y) |
---|
18 | { |
---|
19 | return (x) > (y) ? (x) : (y); |
---|
20 | } |
---|
21 | BEGIN { |
---|
22 | printf("----------------------------+----------------+----------------+------+-------+-------+--------+---------\n"); |
---|
23 | printf("Name | Dual Bound | Primal Bound | Gap%% | Nodes | Time | Status | Solution \n"); |
---|
24 | printf("----------------------------+----------------+----------------+------+-------+-------+--------+---------\n"); |
---|
25 | |
---|
26 | infty = +1e+20; |
---|
27 | eps = 1e-04; |
---|
28 | largegap = 1e+04; |
---|
29 | |
---|
30 | # initialize summary data |
---|
31 | nsolved = 0; |
---|
32 | nstopped = 0; |
---|
33 | nfailed = 0; |
---|
34 | |
---|
35 | # initialize data to be set in parse_<solver>.awk |
---|
36 | solver = "?"; |
---|
37 | solverversion = "?"; |
---|
38 | solverremark = ""; |
---|
39 | } |
---|
40 | # instance name |
---|
41 | /^@01/ { |
---|
42 | n = split ($2, a, "/"); |
---|
43 | m = split(a[n], b, "."); |
---|
44 | prob = b[1]; |
---|
45 | if( b[m] == "gz" || b[m] == "z" || b[m] == "GZ" || b[m] == "Z" ) |
---|
46 | m--; |
---|
47 | for( i = 2; i < m; ++i ) |
---|
48 | prob = prob "." b[i]; |
---|
49 | |
---|
50 | # initialize data to be set in parse.awk |
---|
51 | timelimit = 0; |
---|
52 | starttime = 0.0; |
---|
53 | endtime = 0.0; |
---|
54 | time = 0.0; |
---|
55 | |
---|
56 | # initialize data to be set parse_<solver>.awk |
---|
57 | bbnodes = 0; |
---|
58 | pb = +infty; |
---|
59 | db = -infty; |
---|
60 | aborted = 1; |
---|
61 | timeout = 0; |
---|
62 | solstatus = "none"; |
---|
63 | read_error = 0; |
---|
64 | } |
---|
65 | # time |
---|
66 | /@03/ { starttime = $2; } |
---|
67 | /@04/ { endtime = $2; } |
---|
68 | /@05/ { timelimit = $2; } |
---|
69 | # solution status |
---|
70 | /Read SOL:/ { |
---|
71 | solstatus = "--"; |
---|
72 | } |
---|
73 | /Check SOL:/ { |
---|
74 | intcheck = $4; |
---|
75 | conscheck = $6; |
---|
76 | objcheck = $8; |
---|
77 | if( intcheck && conscheck && objcheck ) |
---|
78 | solstatus = "ok"; |
---|
79 | else |
---|
80 | solstatus = "fail"; |
---|
81 | } |
---|
82 | /^=ready=/ { |
---|
83 | # measure wallclock time externaly rounded up to the next second |
---|
84 | time = max(1, endtime - starttime); |
---|
85 | |
---|
86 | if( timelimit > 0 ) |
---|
87 | { |
---|
88 | # report time limit as time for instances stopped by time limit |
---|
89 | if( timeout ) |
---|
90 | time = timelimit; |
---|
91 | |
---|
92 | # report time limit as time for aborted instances |
---|
93 | if( aborted ) |
---|
94 | time = timelimit; |
---|
95 | |
---|
96 | # report time limit as time for instances that exceeded the time limit but did not stop |
---|
97 | time = min(time, timelimit); |
---|
98 | } |
---|
99 | |
---|
100 | # determine solving status |
---|
101 | status = ""; |
---|
102 | if( aborted && !read_error) |
---|
103 | status = "abort"; |
---|
104 | else if (aborted && read_error) |
---|
105 | status = "noread"; |
---|
106 | else if( timeout ) |
---|
107 | status = "stopped"; |
---|
108 | else |
---|
109 | status = "ok"; |
---|
110 | |
---|
111 | # determine overall status from solving status and solution status: |
---|
112 | |
---|
113 | # instance solved correctly (including case that no solution was found) |
---|
114 | if( status == "ok" && (solstatus == "ok" || solstatus == "--") ) |
---|
115 | nsolved++; |
---|
116 | # incorrect solving process or infeasible solution (including errors with solution checker) |
---|
117 | else if( status == "abort" || (solstatus == "fail" || solstatus == "error") ) |
---|
118 | nfailed++; |
---|
119 | # stopped due to imposed limits |
---|
120 | else if ( status == "stopped" ) |
---|
121 | nstopped++; |
---|
122 | else |
---|
123 | nnoread++; |
---|
124 | |
---|
125 | # compute gap |
---|
126 | temp = pb; |
---|
127 | pb = 1.0*temp; |
---|
128 | temp = db; |
---|
129 | db = 1.0*temp; |
---|
130 | |
---|
131 | if( abs(pb - db) < eps && pb < +infty ) |
---|
132 | gap = 0.0; |
---|
133 | else if( abs(db) < eps ) |
---|
134 | gap = -1.0; |
---|
135 | else if( pb*db < 0.0 ) |
---|
136 | gap = -1.0; |
---|
137 | else if( abs(db) >= +infty ) |
---|
138 | gap = -1.0; |
---|
139 | else if( abs(pb) >= +infty ) |
---|
140 | gap = -1.0; |
---|
141 | else |
---|
142 | gap = 100.0*abs((pb-db)/db); |
---|
143 | |
---|
144 | if( gap < 0.0 ) |
---|
145 | gapstr = " --"; |
---|
146 | else if( gap < largegap ) |
---|
147 | gapstr = sprintf("%6.1f", gap); |
---|
148 | else |
---|
149 | gapstr = " Large"; |
---|
150 | |
---|
151 | printf("%-28s %16.9g %16.9g %6s %7d %7d %8s %9s\n", prob, db, pb, gapstr, bbnodes, time, status, solstatus); |
---|
152 | } |
---|
153 | END { |
---|
154 | printf("----------------------------+----------------+----------------+------+-------+-------+--------+---------\n"); |
---|
155 | printf("\n"); |
---|
156 | printf("solved/stopped/noread/failed: %d/%d/%d/%d\n", nsolved, nstopped, nnoread, nfailed); |
---|
157 | printf("\n"); |
---|
158 | printf("@02 timelimit: %g\n", timelimit); |
---|
159 | printf("@01 %s(%s)%s\n", solver, solverversion, solverremark); |
---|
160 | } |
---|