[1540] | 1 | #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
| 2 | #* * |
---|
| 3 | #* This file is part of the test engine for MIPLIB2010 * |
---|
| 4 | #* * |
---|
| 5 | #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
[1555] | 6 | # $Id: run_cbc.sh,v 1.1 2010/12/09 22:22:28 bzfheinz Exp $ |
---|
[1540] | 7 | |
---|
| 8 | SOLVER=$1 |
---|
[1555] | 9 | BINNAME=$2 |
---|
[1540] | 10 | NAME=$3 |
---|
| 11 | TIMELIMIT=$4 |
---|
| 12 | SOLFILE=$5 |
---|
[1555] | 13 | THREADS=$6 |
---|
| 14 | MIPGAP=$7 |
---|
[1540] | 15 | |
---|
[1555] | 16 | TMPFILE=results/check.$SOLVER.tmp |
---|
[1540] | 17 | |
---|
[1555] | 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 | |
---|
[1540] | 25 | if test -f $SOLFILE |
---|
| 26 | then |
---|
[1555] | 27 | # translate CBC solution format into format for solution checker. |
---|
[1540] | 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. |
---|
[1555] | 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 |
---|
[1540] | 62 | fi |
---|