Commit 8d9ea887 authored by Jarrod Pas's avatar Jarrod Pas
Browse files

Replace hcbf example with example that runs 4 routers

parent 2063cfa7
from multiprocessing import Pool
from os import path
from pydtn import Network, csv_trace, random_traffic
from pydtn.community import HCBFNode, LouvainCommunity
from pydtn import Network, csv_trace, random_traffic, Node, EpidemicNode
from pydtn.community import BubbleNode, HCBFNode, LouvainCommunity
def task(spec):
seed, node_type = spec
def main():
shed1 = path.join('shed', 'data', 'pp_shed1_reduced.csv')
nodes = 39
seed = 42
epoch = 7*24*60*60 # 7 days
traffic_speed = 30 * 60 # 1 packet every 30 mins
nodes = 39
node_options = {
'tick_rate': 5 * 60, # 5 mins,
'tick_rate': 5 * 60, # 5 mins
'community': LouvainCommunity(epoch),
}
traffic_speed = 30 * 60 # 1 packet every 30 mins
nodes = {
node_id: HCBFNode(**node_options)
node_id: node_type(**node_options)
for node_id in range(nodes)
}
......@@ -28,7 +31,26 @@ def main():
network = Network(nodes, traffic=traffic, trace=trace)
network.run()
print(network.stats)
stats = {
'node_type': node_type.__name__,
'seed': seed,
}
stats.update(network.stats_summary)
return stats
def main():
pool = Pool()
tasks = []
for seed in range(1):
for node_type in [Node, EpidemicNode, BubbleNode, HCBFNode]:
tasks.append((seed, node_type))
for stats in pool.imap_unordered(task, tasks):
print(stats)
if __name__ == '__main__':
exit(main())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment