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
ff96d8e3
There was a problem fetching the pipeline summary.
Commit
ff96d8e3
authored
7 years ago
by
Jarrod Pas
Browse files
Options
Downloads
Patches
Plain Diff
Adds kclique to simulation
parent
5d02a193
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!8
Adds kclique to simulation
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/shed.py
+42
-4
42 additions, 4 deletions
examples/shed.py
with
42 additions
and
4 deletions
examples/shed.py
+
42
−
4
View file @
ff96d8e3
...
...
@@ -8,13 +8,42 @@ from collections import namedtuple
from
multiprocessing
import
Pool
from
pydtn
import
Network
,
RandomTraffic
,
Node
,
EpidemicNode
from
pydtn.community
import
BubbleNode
,
HCBFNode
,
LouvainCommunity
from
pydtn.community
import
BubbleNode
,
HCBFNode
from
pydtn.community
import
LouvainCommunity
,
KCliqueCommunity
from
pydtn.shed
import
ShedTrace
Simulation
=
namedtuple
(
'
Simulation
'
,
[
'
trace
'
,
'
node_type
'
,
'
seed
'
])
class
LouvainNode
(
Node
):
def
__init__
(
self
,
**
options
):
options
[
'
community
'
]
=
LouvainCommunity
(
options
[
'
epoch
'
])
super
().
__init__
(
**
options
)
class
LouvainHCBFNode
(
LouvainNode
,
HCBFNode
):
pass
class
LouvainBubbleNode
(
LouvainNode
,
BubbleNode
):
pass
class
KCliqueNode
(
Node
):
def
__init__
(
self
,
**
options
):
options
[
'
community
'
]
=
KCliqueCommunity
(
options
[
'
epoch
'
],
options
[
'
k
'
])
super
().
__init__
(
**
options
)
class
KCliqueHCBFNode
(
KCliqueNode
,
HCBFNode
):
pass
class
KCliqueBubbleNode
(
KCliqueNode
,
BubbleNode
):
pass
def
run_simulation
(
simulation
):
"""
Run a simulation.
"""
seed
=
simulation
.
seed
...
...
@@ -26,7 +55,8 @@ def run_simulation(simulation):
node_type
=
simulation
.
node_type
node_options
=
{
'
tick_rate
'
:
5
*
60
,
# 5 mins
'
community
'
:
LouvainCommunity
(
epoch
),
'
epoch
'
:
epoch
,
'
k
'
:
3
,
}
nodes
=
{
node_id
:
simulation
.
node_type
(
**
node_options
)
...
...
@@ -36,7 +66,7 @@ def run_simulation(simulation):
traffic_options
=
{
'
seed
'
:
seed
,
'
start
'
:
epoch
,
'
step
'
:
30
*
60
,
# 1 packet every
30
mins
'
step
'
:
1
*
60
,
# 1 packet every
1
mins
}
traffic
=
RandomTraffic
(
nodes
,
**
traffic_options
)
...
...
@@ -59,9 +89,17 @@ def main(args):
trace
=
args
[
'
shed
'
]
pool
=
Pool
()
simulations
=
[]
node_types
=
[
Node
,
EpidemicNode
,
KCliqueBubbleNode
,
KCliqueHCBFNode
,
LouvainBubbleNode
,
LouvainHCBFNode
,
]
for
seed
in
args
[
'
seeds
'
]:
for
node_type
in
[
N
ode
,
EpidemicNode
,
BubbleNode
,
HCBFNode
]
:
for
node_type
in
n
ode
_types
:
sim
=
Simulation
(
trace
=
trace
,
node_type
=
node_type
,
seed
=
seed
)
simulations
.
append
(
sim
)
...
...
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