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 = {
"_class": "Dream.Property",
"_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": {
"id": "batchNumberOfUnits",
"type": "number",
......@@ -309,6 +318,7 @@ class Simulation(object):
schema["processTimeout"],
schema["currentDate"],
schema["trace"],
schema["seed"],
],
"gui": {
'debug_json': 1,
......
......@@ -121,6 +121,7 @@ def readGeneralInput():
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.confidenceLevel=float(general.get('confidenceLevel', '0.95')) # get the confidence level
G.seed = general.get('seed')
# ===========================================================================
# creates the simulation objects
......@@ -1263,12 +1264,15 @@ def main(argv=[], input_data=None):
readGeneralInput()
createObjects()
createObjectInterruptions()
setTopology()
setTopology()
#run the experiment (replications)
for i in xrange(G.numberOfReplications):
#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
createWIP()
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