Beispiel #1
0
def loadRoadPool(roadPath):
    datas = loadData.loadData(roadPath)
    roadPool = []
    for d in datas:
        road = Road.Road(d[0], d[1], d[2], d[3], d[4], d[5], d[6])
        roadPool.append(road)
    roadDic = {road.id: road for road in roadPool}
    return roadDic
Beispiel #2
0
def loadCrossPool(crossPath):
    datas = loadData.loadData(crossPath)
    crossPool = []
    for data in datas:
        cross = Cross.Cross(data[0], data[1], data[2], data[3], data[4])
        crossPool.append(cross)
    crossdict = {cross.id: cross for cross in crossPool}
    return crossdict
Beispiel #3
0
def loadRoadPool(roadPath,crossPool):
    datas=loadData.loadData(roadPath)
    roadPool=[]
    print(datas)
    for d in datas:
        road=Road.Road(d[0],d[1],d[2],d[3],d[4],d[5],d[6],crossPool)
        roadPool.append(road)
    return roadPool
Beispiel #4
0
def loadCrossPool(crossPath):
    datas=loadData.loadData(crossPath)
    crossPool=[]

    for data in datas:
        cross=Cross.Cross(data[0],data[1],data[2],data[3],data[4])
        crossPool.append(cross)
        #(self,id,nRoadId,eRoadId,sRoadId,wRoadId)
    return crossPool
Beispiel #5
0
def loadCar(carPath):
    datas = loadData.loadData(carPath)
    carPool = []
    print(datas)
    for d in datas:
        road = Car.Car(d[0], d[1], d[2], d[3], d[4])
        carPool.append(road)
    carDic = {car.id: car for car in carPool}
    return carDic
Beispiel #6
0
def loadCar(carPath, preset_answer_path):
    datas = loadData.loadData(carPath)
    answer = loadData.loadData(preset_answer_path)
    carPool = []
    for d in datas:
        car = Car.Car(d[0], d[1], d[2], d[3], d[4], d[5], d[6])
        carPool.append(car)
    #carPool.sort(key=lambda car: (car.fromCrossId, car.plantTime))
    carDic = {car.id: car for car in carPool}
    presetCarPool = {}
    for a in answer:
        id = a[0]
        best_time = a[1]
        path = a[2:]
        carDic[id].bestStartTime = best_time
        carDic[id].path = path
        # print("loadCar,path:",path)
        presetCarPool.update({id: carDic[id]})
        carDic.pop(id)
    return presetCarPool, carDic
Beispiel #7
0
def loadCrossPool(crossPath):
    global k
    datas = loadData.loadData(crossPath)
    crossPool = []

    for data in datas:
        cross = Cross.Cross(data[0], data[1], data[2], data[3], data[4])
        crossPool.append(cross)
        #(self,id,nRoadId,eRoadId,sRoadId,wRoadId)
    crossdict = {cross.id: cross for cross in crossPool}
    k = crossdict
    return crossdict