1 | #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
2 | #* * |
---|
3 | #* This file is part of the test engine for MIPLIB2010 * |
---|
4 | #* * |
---|
5 | #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
6 | # $Id: run_cbc.sh,v 1.1 2010/12/09 22:22:28 bzfheinz Exp $ |
---|
7 | |
---|
8 | SOLVER=$1 |
---|
9 | BINNAME=$2 |
---|
10 | NAME=$3 |
---|
11 | TIMELIMIT=$4 |
---|
12 | SOLFILE=$5 |
---|
13 | THREADS=$6 |
---|
14 | MIPGAP=$7 |
---|
15 | |
---|
16 | TMPFILE=results/check.$SOLVER.tmp |
---|
17 | |
---|
18 | if test $THREADS != 0 |
---|
19 | then |
---|
20 | $BINNAME -import $NAME -sec $TIMELIMIT -threads $THREADS -ratio $MIPGAP -solve -solution $SOLFILE |
---|
21 | else |
---|
22 | $BINNAME -import $NAME -sec $TIMELIMIT -ratio $MIPGAP -solve -solution $SOLFILE |
---|
23 | fi |
---|
24 | |
---|
25 | if test -f $SOLFILE |
---|
26 | then |
---|
27 | # translate CBC solution format into format for solution checker. |
---|
28 | # The SOLFILE format is a very simple format where in each line |
---|
29 | # we have a <variable, value> pair, separated by spaces. |
---|
30 | # A variable name of =obj= is used to store the objective value |
---|
31 | # of the solution, as computed by the solver. A variable name of |
---|
32 | # =infeas= can be used to indicate that an instance is infeasible. |
---|
33 | awk ' |
---|
34 | BEGIN{ |
---|
35 | infeasible = 0; |
---|
36 | nointsol = 0; |
---|
37 | } |
---|
38 | ($3 != "objective" && $3 != "gap" && $3 != "time" && $2 != "infeasible"){ |
---|
39 | if (!infeasible){ |
---|
40 | printf ("%s %s \n", $2, $3); |
---|
41 | } |
---|
42 | } |
---|
43 | ($3 == "objective" && $1 != "Infeasible" && $2 != "infeasible"){ |
---|
44 | printf ("=obj= %s \n", $5); |
---|
45 | } |
---|
46 | ($3 == "gap"){ |
---|
47 | printf ("=obj= %s \n", $8); |
---|
48 | } |
---|
49 | ($3 == "time"){ |
---|
50 | if ($5 == "integer"){ |
---|
51 | printf ("=nointsol= \n"); |
---|
52 | nointsol = 1; |
---|
53 | }else{ |
---|
54 | printf ("=obj= %s \n", $7); |
---|
55 | } |
---|
56 | } |
---|
57 | ($1 == "Infeasible" || $2 == "infeasible"){ |
---|
58 | printf ("=infeas= \n"); |
---|
59 | infeasible = 1; |
---|
60 | }' $SOLFILE | tee $TMPFILE |
---|
61 | mv $TMPFILE $SOLFILE |
---|
62 | fi |
---|