-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathevalcheck_gamscluster.sh
executable file
·204 lines (181 loc) · 5.06 KB
/
evalcheck_gamscluster.sh
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
#!/usr/bin/env bash
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
#* *
#* 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]. *
#* *
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
export LANG=C
REMOVE=0
AWKARGS=""
FILES=""
for i in $@
do
if test ! -e $i
then
if test "$i" = "-r"
then
REMOVE=1
else
AWKARGS="$AWKARGS $i"
fi
else
FILES="$FILES $i"
fi
done
for FILE in $FILES
do
DIR=`dirname $FILE`
EVALFILE=`basename $FILE .eval`
EVALFILE=`basename $EVALFILE .out`
OUTFILE=$DIR/$EVALFILE.out
ERRFILE=$DIR/$EVALFILE.err
TRCFILE=$DIR/$EVALFILE.trc
LSTFILE=$DIR/$EVALFILE.lst
RESFILE=$DIR/$EVALFILE.res
TEXFILE=$DIR/$EVALFILE.tex
PAVFILE=$DIR/$EVALFILE.pav
EXMFILE=$DIR/$EVALFILE.exm
# check if the eval file exists; if this is the case construct the overall solution files
if test -e $DIR/$EVALFILE.eval
then
# in case an output file exists, copy it away to save the results
DATEINT=`date +"%s"`
if test -e $OUTFILE
then
cp $OUTFILE $OUTFILE.old-$DATEINT
fi
if test -e $ERRFILE
then
cp $ERRFILE $ERRFILE.old-$DATEINT
fi
if test -e $TRCFILE
then
cp $TRCFILE $TRCFILE.old-$DATEINT
fi
if test -e $EXMFILE
then
cp $EXMFILE $EXMFILE.old-$DATEINT
rm $EXMFILE
fi
if test -e $LSTFILE
then
cp $LSTFILE $LSTFILE.old-$DATEINT
fi
echo > $OUTFILE
echo > $ERRFILE
# initialize gams trace file
echo "* Trace Record Definition" > $TRCFILE
echo "* GamsSolve" >> $TRCFILE
echo "* InputFileName,ModelType,SolverName,OptionFile,Direction,NumberOfEquations,NumberOfVariables,NumberOfDiscreteVariables,NumberOfNonZeros,NumberOfNonlinearNonZeros," >> $TRCFILE
echo "* ModelStatus,SolverStatus,ObjectiveValue,ObjectiveValueEstimate,SolverTime,ETSolver,NumberOfIterations,NumberOfNodes" >> $TRCFILE
echo "*" >> $TRCFILE
echo > $LSTFILE
echo "create overall output, error, and trace file for $EVALFILE"
for i in `cat $DIR/$EVALFILE.eval` DONE
do
if test "$i" = "DONE"
then
break
fi
case $i in SOLVER,* )
SOLVER=${i:7}
;;
esac
# pass auxiliary lines about solver and limits form eval file to trace file
case $i in *,* )
echo "* $i" >> $TRCFILE
continue
;;
esac
FILE=$i.out
if test -e $FILE
then
cat $FILE >> $OUTFILE
if test "$REMOVE" = "1"
then
rm -f $FILE
fi
else
echo Missing $i
fi
FILE=$i.err
if test -e $FILE
then
cat $FILE >> $ERRFILE
if test "$REMOVE" = "1"
then
rm -f $FILE
fi
fi
FILE=$i.trc
if test -e $FILE
then
grep -v "^*" $FILE | sed -e "s/EXAMINER2/$SOLVER/" >> $TRCFILE
if test "$REMOVE" = "1"
then
rm -f $FILE
fi
else
echo Missing $i
fi
FILE=$i.exm
if test -e $FILE
then
test -e $EXMFILE || grep "^*" $FILE > $EXMFILE
grep -v "^*" $FILE >> $EXMFILE
if test "$REMOVE" = "1"
then
rm -f $FILE
fi
fi
FILE=$i.lst
if test -e $FILE
then
cat $FILE >> $LSTFILE
if test "$REMOVE" = "1"
then
rm -f $FILE
fi
fi
done
if test "$REMOVE" = "1"
then
rm -f $DIR/$EVALFILE.eval
fi
fi
# check if the out file exists
if test -e $DIR/$EVALFILE.out
then
echo create results for $EVALFILE
# detect test set
TSTNAME=`echo $EVALFILE | sed 's/check.\([a-zA-Z0-9_-]*\).*/\1/g'`
echo "Testset " $TSTNAME
if test -f testset/$TSTNAME.test
then
TESTFILE=testset/$TSTNAME.test
else
TESTFILE=""
fi
if test -f testset/$TSTNAME.solu
then
SOLUFILE=testset/$TSTNAME.solu
else
if test -f testset/all.solu
then
SOLUFILE=testset/all.solu
else
SOLUFILE=""
fi
fi
awk -f check_gams.awk -v "TEXFILE=$TEXFILE" -v "PAVFILE=$PAVFILE" $AWKARGS $SOLUFILE $TRCFILE | tee $RESFILE
fi
done