-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbatch-large
More file actions
executable file
·60 lines (52 loc) · 2.48 KB
/
Copy pathbatch-large
File metadata and controls
executable file
·60 lines (52 loc) · 2.48 KB
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
#!/usr/bin/env bash
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# batch-large : a large-scale stress run for FrankWolfeSolver on big MCFBlock
# instances (the "goto" family, ~8k-65k arcs). Cross-check vs a :MILPSolver for
# the DQuad/Quad father. Expect this to take a while (tens of minutes): each
# goto10_8 run is several minutes, goto10_64 considerably more.
#
# usage: ./batch-large [ <exe> ] ( default ./FWS_test )
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
set -u
EXE=${1:-./FWS_test}
DATA=../../MCFBlock/data/nc4
CFG=FWCfg.txt
SAVE=$( cat "$CFG" )
trap '[ -n "$SAVE" ] && printf "%s\n" "$SAVE" > "$CFG"' EXIT
setpar() { sed -i.bak "s/^$1 *[0-9-][0-9]*/$1 $2/" "$CFG" && rm -f "$CFG.bak"; }
algo() { setpar intAlgorithm "$1"; CUR_ALGO=$1; }
atoms() { setpar intMaxAtoms "$1"; CUR_ATOMS=$1; }
threads() { setpar intMaxThread "$1"; CUR_THREADS=$1; }
CUR_ALGO=0 ; CUR_ATOMS=0 ; CUR_THREADS=1
pass=0 ; fail=0
run() { # $1 = description ; rest = tester arguments
local desc=$1 ; shift
echo "=== $desc ==="
# exact command line + the in-place FWCfg.txt overrides, so a failing run can
# be reproduced verbatim (FWCfg.txt is mutated in place and restored on exit)
printf " [%s %s]\n" "$EXE" "$*"
printf " [FWCfg.txt: intAlgorithm=%s intMaxAtoms=%s intMaxThread=%s]\n" \
"$CUR_ALGO" "$CUR_ATOMS" "$CUR_THREADS"
local t0=$( date +%s )
local out ; out=$( "$EXE" "$@" 2>&1 )
local t1=$( date +%s )
printf "%s\n" "$out" | grep -E "FW val|passed|Shit|S0 =" | tail -3 | sed 's/^/ /'
printf " elapsed: %ds\n" "$(( t1 - t0 ))"
if printf "%s" "$out" | grep -q "passed" ; then pass=$(( pass + 1 ))
else fail=$(( fail + 1 )) ; fi
}
# run the LMO of the (2) sub-Block in parallel
threads 4
echo "########## goto10_8 ( ~8k arcs/child ) ##########"
algo 0
run "goto10_8_1 DQuad k=2 vanilla" -S BSPar.txt -o 0 -k 2 -e 1 $DATA/goto10_8_1.nc4
run "goto10_8_2 DQuad k=2 vanilla" -S BSPar.txt -o 0 -k 2 -e 1 $DATA/goto10_8_2.nc4
run "goto10_8_1 Quad k=2 vanilla" -S BSPar.txt -o 1 -k 2 -e 1 $DATA/goto10_8_1.nc4
algo 1
run "goto10_8_1 DQuad k=2 away" -S BSPar.txt -o 0 -k 2 -e 1 $DATA/goto10_8_1.nc4
echo "########## goto10_64 ( ~65k arcs/child, slow ) ##########"
algo 0
run "goto10_64_1 DQuad k=2 vanilla" -S BSPar.txt -o 0 -k 2 -e 1 $DATA/goto10_64_1.nc4
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
printf "BATCH-LARGE: %d passed, %d failed\n" "$pass" "$fail"
[ "$fail" -eq 0 ]