Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
bfa2747f
Commit
bfa2747f
authored
Oct 22, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Geometric distribution fixed
parent
f0f4e5ea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
6 deletions
+8
-6
dream/simulation/Globals.py
dream/simulation/Globals.py
+2
-1
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+4
-2
dream/simulation/RandomNumberGenerator.py
dream/simulation/RandomNumberGenerator.py
+2
-3
No files found.
dream/simulation/Globals.py
View file @
bfa2747f
...
@@ -40,7 +40,8 @@ import simpy
...
@@ -40,7 +40,8 @@ import simpy
class
G
:
class
G
:
seed
=
1450
#the seed of the random number generator
seed
=
1450
#the seed of the random number generator
Rnd
=
Random
(
seed
)
#random number generator
Rnd
=
Random
(
seed
)
#random number generator
import
numpy
numpyRnd
=
numpy
ObjList
=
[]
#a list that holds all the CoreObjects
ObjList
=
[]
#a list that holds all the CoreObjects
EntityList
=
[]
#a list that holds all the Entities
EntityList
=
[]
#a list that holds all the Entities
...
...
dream/simulation/LineGenerationJSON.py
View file @
bfa2747f
...
@@ -529,9 +529,11 @@ def main(argv=[], input_data=None):
...
@@ -529,9 +529,11 @@ def main(argv=[], input_data=None):
G
.
Router
.
isInitialized
=
False
G
.
Router
.
isInitialized
=
False
if
G
.
seed
:
if
G
.
seed
:
G
.
Rnd
=
Random
(
'%s%s'
%
(
G
.
seed
,
i
))
G
.
Rnd
=
Random
(
'%s%s'
%
(
G
.
seed
,
i
))
G
.
numpyRnd
.
random
.
seed
(
G
.
seed
)
else
:
else
:
G
.
Rnd
=
Random
()
G
.
Rnd
=
Random
()
G
.
numpyRnd
.
random
.
seed
()
createWIP
()
createWIP
()
initializeObjects
()
initializeObjects
()
Globals
.
setWIP
(
G
.
EntityList
)
Globals
.
setWIP
(
G
.
EntityList
)
...
...
dream/simulation/RandomNumberGenerator.py
View file @
bfa2747f
...
@@ -25,6 +25,7 @@ Created on 14 Feb 2013
...
@@ -25,6 +25,7 @@ Created on 14 Feb 2013
'''
'''
holds methods for generations of numbers from different distributions
holds methods for generations of numbers from different distributions
'''
'''
class
RandomNumberGenerator
(
object
):
class
RandomNumberGenerator
(
object
):
def
__init__
(
self
,
obj
,
distributionType
,
mean
=
0
,
stdev
=
0
,
min
=
0
,
max
=
0
,
alpha
=
0
,
beta
=
0
,
def
__init__
(
self
,
obj
,
distributionType
,
mean
=
0
,
stdev
=
0
,
min
=
0
,
max
=
0
,
alpha
=
0
,
beta
=
0
,
logmean
=
0
,
logsd
=
0
,
probability
=
0
,
shape
=
0
,
scale
=
0
,
location
=
0
):
logmean
=
0
,
logsd
=
0
,
probability
=
0
,
shape
=
0
,
scale
=
0
,
location
=
0
):
...
@@ -43,8 +44,6 @@ class RandomNumberGenerator(object):
...
@@ -43,8 +44,6 @@ class RandomNumberGenerator(object):
self
.
location
=
float
(
location
or
0
)
self
.
location
=
float
(
location
or
0
)
self
.
obj
=
obj
self
.
obj
=
obj
def
generateNumber
(
self
):
def
generateNumber
(
self
):
from
Globals
import
G
from
Globals
import
G
if
(
self
.
distributionType
==
"Fixed"
):
#if the distribution is Fixed
if
(
self
.
distributionType
==
"Fixed"
):
#if the distribution is Fixed
...
@@ -76,7 +75,7 @@ class RandomNumberGenerator(object):
...
@@ -76,7 +75,7 @@ class RandomNumberGenerator(object):
else
:
else
:
continue
continue
elif
(
self
.
distributionType
==
"Geometric"
):
#if the distribution is Geometric
elif
(
self
.
distributionType
==
"Geometric"
):
#if the distribution is Geometric
return
1
return
G
.
numpyRnd
.
random
.
geometric
(
self
.
probability
)
elif
(
self
.
distributionType
==
"Lognormal"
):
#if the distribution is Lognormal
elif
(
self
.
distributionType
==
"Lognormal"
):
#if the distribution is Lognormal
# XXX from the files lognormvariate(mu, sigma)
# XXX from the files lognormvariate(mu, sigma)
# it would be better to use same mean,stdev
# it would be better to use same mean,stdev
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment