-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
executable file
·55 lines (38 loc) · 2.91 KB
/
run.py
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
#!/usr/bin/env python3
import os
from common import bench_and_trace_file_name_range, working_directory, max_cycles, num_nodes, aco_selection_alpha_range, \
reinforcement_factor_range, ant_packet_injection_rate, trace_driven_data_packet_injection_rate_range, \
synthesized_data_packet_injection_rate_range, synthesized_traffic_range
from utils import add_experiment, run_experiments
def run(traffic, bench, trace_file_name, max_cycles, num_nodes, routing, selection, data_packet_injection_rate, aco_selection_alpha, reinforcement_factor):
dir = working_directory(traffic, bench, max_cycles, num_nodes, routing, selection, data_packet_injection_rate, aco_selection_alpha, reinforcement_factor)
stats_file_name = dir + '/stats.json'
if os.path.isfile(stats_file_name):
print('Stats file exists, skipped: ' + stats_file_name)
return
os.system('rm -fr ' + dir)
os.system('mkdir -p ' + dir)
cmd_run = '~/go/bin/heo -d=' + dir + ' -t=' + traffic + ' -tf=' + trace_file_name \
+ ' -c=' + str(max_cycles) + ' -n=' + str(num_nodes) + ' -r=' + routing + ' -s=' + selection \
+ ' -di=' + str(data_packet_injection_rate) + ' -ai=' + str(ant_packet_injection_rate) \
+ ' -sa=' + str(aco_selection_alpha) + ' -rf=' + str(reinforcement_factor)
print(cmd_run)
os.system(cmd_run)
def run_experiment(args):
run(*args)
experiments = []
for traffic in synthesized_traffic_range:
for data_packet_injection_rate in synthesized_data_packet_injection_rate_range:
add_experiment(experiments, traffic, '', '', max_cycles, num_nodes, 'XY', 'Random', data_packet_injection_rate, -1, -1)
add_experiment(experiments, traffic, '', '', max_cycles, num_nodes, 'OddEven', 'BufferLevel', data_packet_injection_rate, -1, -1)
for aco_selection_alpha in aco_selection_alpha_range:
for reinforcement_factor in reinforcement_factor_range:
add_experiment(experiments, traffic, '', '', max_cycles, num_nodes, 'OddEven', 'ACO', data_packet_injection_rate, aco_selection_alpha, reinforcement_factor)
for bench, trace_file_name in bench_and_trace_file_name_range:
for data_packet_injection_rate in trace_driven_data_packet_injection_rate_range:
add_experiment(experiments, 'Trace', bench, trace_file_name + '.combined', max_cycles, num_nodes, 'XY', 'Random', data_packet_injection_rate, -1, -1)
add_experiment(experiments, 'Trace', bench, trace_file_name + '.combined', max_cycles, num_nodes, 'OddEven', 'BufferLevel', data_packet_injection_rate, -1, -1)
for aco_selection_alpha in aco_selection_alpha_range:
for reinforcement_factor in reinforcement_factor_range:
add_experiment(experiments, 'Trace', bench, trace_file_name + '.combined', max_cycles, num_nodes, 'OddEven', 'ACO', data_packet_injection_rate, aco_selection_alpha, reinforcement_factor)
run_experiments(experiments, run_experiment)