def run(self, data): # set up global variables createGlobals() # read from inputs spreadsheet readGeneralInput(data) inputDict={} inputDict['_class']='Dream.Simulation' # set general attributes inputDict['general']={} inputDict['general']['maxSimTime']=G.planningHorizon inputDict['general']['numberOfReplications']=G.ReplicationNo inputDict['general']['_class']='Dream.Simulation' inputDict['edges']={} inputDict['nodes']={} inputDict['nodes']['AM']={} inputDict['nodes']['AM']['_class']='Dream.AllocationManagement' inputDict['nodes']['AM']['id']='AM1' inputDict['nodes']['AM']['name']='AM1' inputDict['nodes']['AM']['argumentDict']={} # set current PPOS attributes inputDict['nodes']['AM']['argumentDict']['currentPPOS']={} inputDict['nodes']['AM']['argumentDict']['currentPPOS']['id']=IG.TargetPPOS inputDict['nodes']['AM']['argumentDict']['currentPPOS']['quantity']=IG.TargetPPOSqty inputDict['nodes']['AM']['argumentDict']['currentPPOS']['targetWeek']=IG.TargetPPOSweek # set allocation attributes inputDict['nodes']['AM']['argumentDict']['allocationData']={} inputDict['nodes']['AM']['argumentDict']['allocationData']['maxEarliness']=IG.maxEarliness inputDict['nodes']['AM']['argumentDict']['allocationData']['maxLateness']=IG.maxLateness inputDict['nodes']['AM']['argumentDict']['allocationData']['minPackingSize']=IG.minPackingSize # set capacity attributes inputDict['nodes']['AM']['argumentDict']['capacity']=IG.CapacityDict # set MA attributes inputDict['nodes']['AM']['argumentDict']['MAList']=IG.RouteDict G.argumentDictString=json.dumps(inputDict, indent=5) G.demandFile = data['general']['ke_url'] out = json.loads(simulate_line_json(input_data=(G.argumentDictString))) output = writeOutput() out['demandPlannerOutput.xls'] = output.encode('base64') return [{'key': 'default', 'score':0, 'result': out}]
def runOneScenario(self, data): """default method for running one scenario """ return json.loads(simulate_line_json(input_data=json.dumps(data)))
def runOneScenario(self, data): """Run one scenario. To be reused by subclasses. """ return json.loads(simulate_line_json(input_data=json.dumps(data)))