-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathtest.sh
executable file
·85 lines (79 loc) · 2.7 KB
/
test.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
#!/bin/bash
echo "running $0 ..."
n_depot=1
n_car_each_depot=9
n_customer=120
#seed=0
#capa is float value
capa=3
if [ "$1" = "g" ]; then
for seed in $(seq 1 10)
do
python dataclass.py ${n_depot} ${n_car_each_depot} \
${n_customer} ${seed} ${capa}
done
elif [ "$1" = "rm" ]; then
for seed in $(seq 1 10)
do
echo "rm"
filename=n${n_customer}d${n_depot}c${n_car_each_depot}D${capa}s${seed}
rm -rf Torch/data/${filename}.json
rm -rf Ortools/data/${filename}.json
rm -rf GA/data/${filename}.txt
done
elif [ "$1" = "g1" ]; then
seed=1
python dataclass.py ${n_depot} ${n_car_each_depot} \
${n_customer} ${seed} ${capa}
elif [ "$1" = "ga" ]; then
write_csv="Csv/n${n_customer}d${n_depot}c${n_car_each_depot}D${capa}_ga.csv"
if [ -e ${write_csv} ]; then
rm -rf ${write_csv}
fi
for seed in $(seq 1 10)
do
filename=n${n_customer}d${n_depot}c${n_car_each_depot}D${capa}s${seed}
if [ -e "GA/data/${filename}.txt" ]; then
python GA/main.py GA/data/${filename}.txt ${write_csv}
fi
done
python Csv/get_mean.py ${write_csv}
elif [ "$1" = "or" ]; then
write_csv="Csv/n${n_customer}d${n_depot}c${n_car_each_depot}D${capa}_or.csv"
if [ -e ${write_csv} ]; then
rm -rf ${write_csv}
fi
for seed in $(seq 1 10)
do
filename=n${n_customer}d${n_depot}c${n_car_each_depot}D${capa}s${seed}
if [ -e "Ortools/data/${filename}.json" ]; then
python Ortools/solver.py -p Ortools/data/${filename}.json -c ${write_csv}
fi
done
python Csv/get_mean.py ${write_csv}
elif [ "$1" = "to" ]; then
write_csv="Csv/n${n_customer}d${n_depot}c${n_car_each_depot}D${capa}_to.csv"
write_csv_2opt="Csv/n${n_customer}d${n_depot}c${n_car_each_depot}D${capa}_to_2opt.csv"
if [ -e ${write_csv} ]; then
rm -rf ${write_csv}
rm -rf ${write_csv_2opt}
fi
for seed in $(seq 1 10)
do
filename=n${n_customer}d${n_depot}c${n_car_each_depot}D${capa}s${seed}
if [ -e "Torch/data/${filename}.json" ]; then
if [ "$n_customer" = "20" ]; then
python Torch/plot.py -p Torch/Weights/VRP20_epoch19.pt -t Torch/data/${filename}.json -wc ${write_csv} -wc2 ${write_csv_2opt} -b 512
elif [ "$n_customer" = "50" ]; then
# python Torch/plot.py -p Torch/Weights/VRP50_train_epoch66.pt -t Torch/data/${filename}.json -wc ${write_csv} -wc2 ${write_csv_2opt} -b 512
python Torch/plot.py -p Torch/Weights/VRP50_epoch18.pt -t Torch/data/${filename}.json -wc ${write_csv} -wc2 ${write_csv_2opt} -b 512
elif [ "$n_customer" = "100" -o "$n_customer" = "120" ]; then
python Torch/plot.py -p Torch/Weights/VRP100_epoch15.pt -t Torch/data/${filename}.json -wc ${write_csv} -wc2 ${write_csv_2opt} -b 512
fi
fi
done
python Csv/torch_mean.py ${write_csv}
python Csv/torch_mean.py ${write_csv_2opt}
else
echo "command: ${0} g or ${0} rm"
fi