forked from iszczesniak/abcd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathabcd.cc
65 lines (47 loc) · 1.29 KB
/
abcd.cc
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
#include "graph.hpp"
#include "cli_args.hpp"
#include "sim.hpp"
#include "stats.hpp"
#include "utils_netgen.hpp"
#include <boost/random.hpp>
using namespace std;
void
simulate(const cli_args &args_para)
{
cli_args args = args_para;
// Set the routing type.
routing::set_rt(args.rt);
// Set the maximal length of a path.
routing::set_ml(args.ml);
// Set the K for the k-shortest paths.
routing::set_K(args.K);
// Set the spectrum selection type.
routing::set_st(args.st);
// This simulation object.
sim::rng().seed(args.seed);
// Generate the graph.
sim::mdl() = generate_graph(args, sim::rng());
// Make sure there is only one component.
assert(is_connected(sim::mdl()));
dbl_acc hop_acc;
dbl_acc len_acc;
calc_sp_stats(sim::mdl(), hop_acc, len_acc);
// Calculate the mean connection arrival time.
args.mcat = calc_mcat(args, sim::mdl(), ba::mean(hop_acc));
// Calculate the maximal length of a path.
if (args.mlc)
args.ml = args.mlc.get() * ba::max(len_acc);
// The traffic module.
traffic t(args.mcat, args.mht, args.mnsc);
// The stats module.
stats s(args, t);
// Run the simulation.
sim::run(args.sim_time);
}
int
main(int argc, const char* argv[])
{
cli_args args = process_cli_args(argc, argv);
simulate(args);
return 0;
}