1 | #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
2 | #* * |
---|
3 | #* This file is part of the test engine for MIPLIB2010 * |
---|
4 | #* * |
---|
5 | #* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
---|
6 | # $Id: run.sh 1854 2013-01-28 00:02:55Z tkr $ |
---|
7 | |
---|
8 | SHELL=$1 |
---|
9 | BINNAME=$2 |
---|
10 | TSTNAME=$3 |
---|
11 | TIMELIMIT=$4 |
---|
12 | HARDMEMLIMIT=$5 |
---|
13 | THREADS=$6 |
---|
14 | |
---|
15 | # construct paths |
---|
16 | MIPLIBPATH=`pwd` |
---|
17 | BINPATH=$MIPLIBPATH/bin |
---|
18 | CHECKERPATH=$MIPLIBPATH/checker |
---|
19 | RESULTSPATH=$MIPLIBPATH/results |
---|
20 | SCRIPTPATH=$MIPLIBPATH/scripts |
---|
21 | TSTPATH=$MIPLIBPATH/testset |
---|
22 | |
---|
23 | # check if the solver link (binary) exists |
---|
24 | if test ! -e $BINPATH/$BINNAME |
---|
25 | then |
---|
26 | echo "ERROR: solver link <$BINNAME> does not exist in <bin> folder; see bin/README" |
---|
27 | exit; |
---|
28 | fi |
---|
29 | |
---|
30 | # check if the test set file/link exists |
---|
31 | if test ! -e $TSTPATH/$TSTNAME.test |
---|
32 | then |
---|
33 | echo "ERROR: test set file/link <$TSTNAME.test> does not exist in <testset> folder" |
---|
34 | exit; |
---|
35 | fi |
---|
36 | |
---|
37 | # grep solver name |
---|
38 | SOLVER=`echo $BINNAME | sed 's/\([a-zA-Z0-9_-]*\).*/\1/g'` |
---|
39 | |
---|
40 | # check if the result folder exist. if not create the result folder |
---|
41 | if test ! -e $RESULTSPATH |
---|
42 | then |
---|
43 | mkdir $RESULTSPATH |
---|
44 | fi |
---|
45 | |
---|
46 | # construct name of output, results, and temporary solution file |
---|
47 | BASENAME=$RESULTSPATH/$TSTNAME.$BINNAME |
---|
48 | OUTFILE=$BASENAME.out |
---|
49 | RESFILE=$BASENAME.res |
---|
50 | SOLFILE=$BASENAME.sol |
---|
51 | |
---|
52 | # absolut tolerance for checking linear constraints and objective value |
---|
53 | LINTOL=1e-4 |
---|
54 | # absolut tolerance for checking integrality constraints |
---|
55 | INTTOL=1e-4 |
---|
56 | |
---|
57 | # Note that the MIP gap (gap between primal and dual solution) is not |
---|
58 | # uniqly defined through all solvers. For example, there is a difference |
---|
59 | # between SCIP and CPLEX. All solver, however, have the some behaviour in |
---|
60 | # case of a MIP gap of 0.0. |
---|
61 | MIPGAP=0.0 |
---|
62 | |
---|
63 | # post system information and current time into the output file |
---|
64 | uname -a > $OUTFILE |
---|
65 | date >> $OUTFILE |
---|
66 | |
---|
67 | # convert hard memory limit to kilo bytes and post it into the output file |
---|
68 | HARDMEMLIMIT=`expr $HARDMEMLIMIT \* 1024` |
---|
69 | echo "hard mem limit: $HARDMEMLIMIT k" >> $OUTFILE |
---|
70 | |
---|
71 | # loop over all instance names which are listed in the test set file name |
---|
72 | for i in `cat $TSTPATH/$TSTNAME.test` |
---|
73 | do |
---|
74 | # check if the current instance exists |
---|
75 | if test -f $i |
---|
76 | then |
---|
77 | echo @01 $i =========== |
---|
78 | echo ----------------------------- |
---|
79 | date |
---|
80 | echo ----------------------------- |
---|
81 | TIMESTART=`date +"%s"` |
---|
82 | echo @03 $TIMESTART |
---|
83 | $SHELL -c " ulimit -v $HARDMEMLIMIT k; ulimit -f 2000000; $SCRIPTPATH/run_$SOLVER.sh $SOLVER $BINPATH/$BINNAME $i $TIMELIMIT $SOLFILE $THREADS $MIPGAP" |
---|
84 | echo |
---|
85 | TIMEEND=`date +"%s"` |
---|
86 | echo @04 $TIMEEND |
---|
87 | echo @05 $TIMELIMIT |
---|
88 | # check if a solution file was written |
---|
89 | if test -e $SOLFILE |
---|
90 | then |
---|
91 | # check if the link to the solution checker exists |
---|
92 | if test -f "$CHECKERPATH/bin/solchecker" |
---|
93 | then |
---|
94 | echo |
---|
95 | $SHELL -c " $CHECKERPATH/bin/solchecker $i $SOLFILE $LINTOL $INTTOL" |
---|
96 | echo |
---|
97 | else |
---|
98 | echo WARNING: solution cannot be checked because solution checker is missing |
---|
99 | fi |
---|
100 | fi |
---|
101 | echo ----------------------------- |
---|
102 | date |
---|
103 | echo ----------------------------- |
---|
104 | echo |
---|
105 | echo =ready= |
---|
106 | else |
---|
107 | echo @02 FILE NOT FOUND: $i =========== |
---|
108 | fi |
---|
109 | done 2>&1 | tee -a $OUTFILE |
---|
110 | |
---|
111 | date >> $OUTFILE |
---|
112 | |
---|
113 | if test -e $SOLFILE |
---|
114 | then |
---|
115 | rm $SOLFILE |
---|
116 | fi |
---|
117 | |
---|
118 | awk -f $SCRIPTPATH/parse.awk -f $SCRIPTPATH/parse_$SOLVER.awk $OUTFILE | tee $RESFILE |
---|