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
a37d0114
Commit
a37d0114
authored
2 years ago
by
ArktikHunter
Browse files
Options
Downloads
Patches
Plain Diff
added batch mode, got rid of weird seed list bug
parent
44579cfb
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!21
pydtn agkmeans and version 1.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/shed.py
+15
-7
15 additions, 7 deletions
examples/shed.py
with
15 additions
and
7 deletions
examples/shed.py
+
15
−
7
View file @
a37d0114
...
...
@@ -3,6 +3,7 @@
__authors__
=
'
Jarrod Pas <j.pas@usask.ca>, Hunter McConnell <hunter.mcconnell@usask.ca>
'
import
os
from
random
import
randint
import
sys
import
csv
from
argparse
import
ArgumentParser
...
...
@@ -78,12 +79,17 @@ def main(args):
HCBFLouvainNode
,
]
for
seed
in
args
[
'
seeds
'
]:
if
seed
is
not
None
:
seed
=
seed
[
0
]
#hacky, gets rid of TypeError: unhashable type: 'list'
for
node_type
in
node_types
:
sim
=
Simulation
(
trace
=
trace
,
node_type
=
node_type
,
seed
=
seed
)
simulations
.
append
(
sim
)
if
args
[
'
batch
'
]
>
1
:
# batch mode with random seeds
for
_
in
range
(
args
[
'
batch
'
]):
seed
=
randint
(
0
,
500
)
for
node_type
in
node_types
:
sim
=
Simulation
(
trace
=
trace
,
node_type
=
node_type
,
seed
=
seed
)
simulations
.
append
(
sim
)
else
:
for
seed
in
args
[
'
seeds
'
]:
# seed mode with inputted seeds
for
node_type
in
node_types
:
sim
=
Simulation
(
trace
=
trace
,
node_type
=
node_type
,
seed
=
seed
)
simulations
.
append
(
sim
)
results
=
{}
...
...
@@ -117,8 +123,10 @@ def parse_args(args):
parser
.
add_argument
(
'
shed
'
)
parser
.
add_argument
(
'
--pretty
'
,
action
=
'
store_true
'
)
parser
.
add_argument
(
'
--quiet
'
,
'
-q
'
,
action
=
'
store_true
'
)
parser
.
add_argument
(
'
--batch
'
,
'
-b
'
,
metavar
=
'
BATCH
'
,
type
=
int
,
default
=
1
)
parser
.
add_argument
(
'
--seeds
'
,
'
-s
'
,
action
=
'
append
'
,
metavar
=
'
SEED
'
,
type
=
int
,
nargs
=
'
+
'
,
default
=
[
None
])
action
=
'
append
'
,
metavar
=
'
SEED
'
,
type
=
int
,
default
=
[
None
])
args
=
parser
.
parse_args
(
args
)
return
vars
(
args
)
...
...
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