ModSetupWorker.clearOld(base,tempP) tempOP = temp[:-4] + "-OP" + temp[-4:] ModSetupWorker.clearOld(base,tempOP) print "Scratch version set up. Proceding..." print "GIS operations begins." ModGIS.GISops_2p(inSpace, inGdb, currentIter, fcTAZ, fcDet) print "GIS operations completed." print "Predicting flow from gravity equation" ModUpdateFlow.update_2p(inSpace, currentIter, inTTp, OPpenalty) print "Flow Allocation" inFlow = inSpace+"CSV/TTflow"+str(currentIter)+"-P.csv" flow_p = ModAlloc.alloc_2p(inSpace, currentIter, "P") inFlow = inSpace+"CSV/TTflow"+str(currentIter)+"-OP.csv" flow_op = ModAlloc.alloc_2p(inSpace, currentIter, "OP") print "Update Speed" ModSpeedCalc_avg10.flow2speed_2p_old(inSpace, currentIter, FL, LIMIT) print "Iteration", currentIter, "done on ", time.strftime("%d/%m/%Y - %H:%M:%S") currentIter += 1 print maxIter, "EVERYTHING COMPLETED on", time.strftime("%d/%m/%Y - %H:%M:%S") # Save TT cost calculated from speed0 # if currentIter == 1: # shutil.copyfile(inSpace+'CSV/TT.csv', inSpace+'CSV/TT0.csv')
flow = ModAlloc.alloc(inSpace, inFlow, currentIter) #Save TT cost calculated from speed0 if currentIter == 1: shutil.copyfile(inSpace+'CSV/TT.csv', inSpace+'CSV/TT0.csv') fd = open(outRelGap,"wb") fd.write("Iteration, Relative Gap") fd.close() #Calculate relative gap # relgap = ModRelgap.calc(inSpace, currentIter) # relgap = str(currentIter) + ', ' + str(relgap) + ' \n' # fd = open(outRelGap,"a") # fd.write(relgap) # fd.close() print "Update Speed" ssds = ModSpeedCalc_avg10.flow2speed(inSpace, flow, currentIter, FL, LIMIT) print "SSD from demand:", ssds[0] #(ssdsum, ssdmean, ssdsd, ssdmin, ssdmax) ssdPath[currentIter] = ssds if ssds[0] < threshDS: print "Demand met supply" break print "Iteration", currentIter, "done on ", time.strftime("%d/%m/%Y - %H:%M:%S") currentIter += 1 print maxIter, "EVERYTHING COMPLETED on", time.strftime("%d/%m/%Y - %H:%M:%S") print "SSD Evolution Path" print ssdPath