-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtopic_swapping.sh
More file actions
49 lines (45 loc) · 1.21 KB
/
topic_swapping.sh
File metadata and controls
49 lines (45 loc) · 1.21 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
SCRIPT_DIR=$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
declare -a NUM_PEOPLE=(\
6 \
12 \
24 \
48)
declare -A NUM_TOPICS
NUM_TOPICS[0,0]=4
NUM_TOPICS[0,1]=6
NUM_TOPICS[1,0]=6
NUM_TOPICS[1,1]=8
NUM_TOPICS[1,2]=12
NUM_TOPICS[2,0]=12
NUM_TOPICS[2,1]=18
NUM_TOPICS[2,2]=24
NUM_TOPICS[3,0]=24
NUM_TOPICS[3,1]=36
NUM_TOPICS[3,2]=48
declare -A MAX_ROUNDS
MAX_ROUNDS[0,0]=6
MAX_ROUNDS[0,1]=9
MAX_ROUNDS[1,0]=5
MAX_ROUNDS[1,1]=11
MAX_ROUNDS[1,2]=18
MAX_ROUNDS[2,0]=11
MAX_ROUNDS[2,1]=23
MAX_ROUNDS[2,2]=36
MAX_ROUNDS[3,0]=23
MAX_ROUNDS[3,1]=47
MAX_ROUNDS[3,2]=72
TIME_LIMIT=3600000 # 1h
NUM_THREADS=16
for p in "${!NUM_PEOPLE[@]}"; do
for t in {0..3}; do
if [ -z ${NUM_TOPICS[$p,$t]+x} ]; then
continue
fi
TXT_FILE="${SCRIPT_DIR}/${NUM_PEOPLE[$p]}_${NUM_TOPICS[$p,$t]}_${MAX_ROUNDS[$p,$t]}.txt"
if [ ! -f ${TXT_FILE} ]; then
minizinc --solver cp-sat topic-swapping.mzn --time-limit ${TIME_LIMIT} -p ${NUM_THREADS} -f -i --json-stream --output-time --output-objective -o ${TXT_FILE} -D n_students=${NUM_PEOPLE[$p]} -D n_topics=${NUM_TOPICS[$p,$t]} -D max_rounds=${MAX_ROUNDS[$p,$t]}
else
echo "${TXT_FILE} already exists."
fi
done
done