Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pydtnsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
discus
pydtnsim
Commits
8d9ea887
Commit
8d9ea887
authored
7 years ago
by
Jarrod Pas
Browse files
Options
Downloads
Patches
Plain Diff
Replace hcbf example with example that runs 4 routers
parent
2063cfa7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!3
Version 0.2
,
!1
Full rewrite
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/shed1_all.py
+56
-0
56 additions, 0 deletions
examples/shed1_all.py
with
56 additions
and
0 deletions
examples/shed1_
hcbf
.py
→
examples/shed1_
all
.py
+
56
−
0
View file @
8d9ea887
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
:
HCBFNod
e
(
**
node_options
)
node_id
:
node_typ
e
(
**
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
())
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment