Commit 32110ef4 authored by Jérome Perrin's avatar Jérome Perrin

Allow to configure the seed in the GUI

parent 8001ef44
...@@ -142,6 +142,15 @@ schema = { ...@@ -142,6 +142,15 @@ schema = {
"_class": "Dream.Property", "_class": "Dream.Property",
"_default": 10 "_default": 10
}, },
"seed": {
"id": "seed",
"name": "Seed for random number generator",
"description": "When using the same seed, the random number generator"
" produce the same sequence of numbers",
"type": "string",
"_class": "Dream.Property",
"_default": "",
},
"batchNumberOfUnits": { "batchNumberOfUnits": {
"id": "batchNumberOfUnits", "id": "batchNumberOfUnits",
"type": "number", "type": "number",
...@@ -309,6 +318,7 @@ class Simulation(object): ...@@ -309,6 +318,7 @@ class Simulation(object):
schema["processTimeout"], schema["processTimeout"],
schema["currentDate"], schema["currentDate"],
schema["trace"], schema["trace"],
schema["seed"],
], ],
"gui": { "gui": {
'debug_json': 1, 'debug_json': 1,
......
...@@ -121,6 +121,7 @@ def readGeneralInput(): ...@@ -121,6 +121,7 @@ def readGeneralInput():
G.maxSimTime=float(general.get('maxSimTime', '100')) # get the maxSimTime / default 100 G.maxSimTime=float(general.get('maxSimTime', '100')) # get the maxSimTime / default 100
G.trace=general.get('trace', 'No') # get trace in order to check if trace is requested G.trace=general.get('trace', 'No') # get trace in order to check if trace is requested
G.confidenceLevel=float(general.get('confidenceLevel', '0.95')) # get the confidence level G.confidenceLevel=float(general.get('confidenceLevel', '0.95')) # get the confidence level
G.seed = general.get('seed')
# =========================================================================== # ===========================================================================
# creates the simulation objects # creates the simulation objects
...@@ -1268,7 +1269,10 @@ def main(argv=[], input_data=None): ...@@ -1268,7 +1269,10 @@ def main(argv=[], input_data=None):
#run the experiment (replications) #run the experiment (replications)
for i in xrange(G.numberOfReplications): for i in xrange(G.numberOfReplications):
#logger.info("start run number "+str(i+1)) #logger.info("start run number "+str(i+1))
G.Rnd=Random(G.seed + i) if G.seed:
G.Rnd=Random('%s%s' % (G.seed, i))
else:
G.Rnd=Random()
initialize() #initialize the simulation initialize() #initialize the simulation
createWIP() createWIP()
initializeObjects() initializeObjects()
......
Markdown is supported
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