Exemple #1
0
		print "Scratch version set up.  Proceding..."
	
		# 1, update speed, recalculate cost 
		print "Update Speed..."
		inSpeed = "detspd" + str(currentIter - 1) + ".csv"
		ModJoinSpeed.joinSpeed(inSpace, inGdb, inSpeed)
	
		# 2, rebuild network dataset
		print "Speed updated. Rebuild Dataset..."
		ModBuild.build(inSpace, inGdb)
		
		print "Dataset rebuilt. Solve for TT, TD, DT"
		ModSolve.solve(inSpace, inGdb, fcTAZ, fcDet)
		
		print "Predicting flow from gravity equation"
		ModUpdateFlow.update(inSpace, currentIter, inTTp)
	
		print "Flow Allocation"
		inFlow = inSpace + "CSV/TTflow" + str(currentIter) + ".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")
Exemple #2
0
        print "Iteration", currentIter, "starts on ", time.strftime("%d/%m/%Y - %H:%M:%S")
        print inTTp, ", at", inSpace
        # 0, create temp scratch
        print "Setting up scratch version"
        tempP = temp[:-4] + "-P" + temp[-4:]
        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")
Exemple #3
0
            print "Iteration", currentIter, "starts on ", time.strftime("%d/%m/%Y - %H:%M:%S")
            print inTTp, ", at", inSpace

            # 0, create temp scratch
            print "Setting up scratch version"
            tempP = temp[:-4] + "-P" + temp[-4:]
            ModSetupWorker.clearOld(base,tempP)
            print "Scratch version set up.  Proceding..."

            print "GIS operations begins."
            ModGIS.GISops_1p(inSpace, inGdb, currentIter, fcTAZ, fcDet)
            print "GIS operations completed."

            print "Predicting flow from gravity equation"
#             Changed ModUpdateFlow line 300 to TTP for now
            ModUpdateFlow.update(inSpace, currentIter, inTTp)    # Gives TTflow1.csv from update (not 2p)

            print "Flow Allocation"
            inFlow = inSpace+"CSV/TTflow"+str(currentIter)+".csv"
            outCSV = inSpace+"CSV/xdetflow.csv"
            ModAlloc.alloc(inSpace, inFlow, outCSV, period="P") # Gives detflow
            
            alpha = 1
#            Loop through DTA:
            savepath = inSpace+"CSV/xdetflow-beforealpha-"+str(currentIter)+".csv"
            shutil.copy(outCSV, savepath)
            while alpha > 0.01:
                alpha = dta_1p(inSpace, inFlow, FL, LIMIT)
                print "alpha:", alpha
                if alpha > 0.999:
                    shutil.copy(inSpace+"CSV/xdetflow"+str(alpha)+".csv", inSpace+"CSV/xdetflow.csv")