def minimumCostPath(analyzer, destStation):
    """
    Retorna el camino de costo minimo desde initialStation a destStation
    """
    delta_time = -1.0
    start_time = getTime()

    answer = model.minimumCostPath(analyzer, destStation)

    stop_time = getTime()
    delta_time = stop_time - start_time

    return [answer, delta_time]
Exemplo n.º 2
0
def Rutas_edad(analyzer, opt):
    if opt == "1":
        menor = 0
        mayor = 10
    elif opt == "2":
        menor = 11
        mayor = 20
    elif opt == "3":
        menor = 21
        mayor = 30
    elif opt == "4":
        menor = 31
        mayor = 40
    elif opt == "5":
        menor = 41
        mayor = 50
    elif opt == "6":
        menor = 51
        mayor = 60
    elif opt == "7":
        menor = 61
        mayor = 200
    else:
        return ("opción no valida")
    cond = 'año_lleg'
    condt = 'año_sal'
    ruta = None
    inicial, num = model.Rutas_edad(analyzer, menor, mayor, cond)
    final, number = model.Rutas_edad(analyzer, menor, mayor, condt)
    model.minimumCostPaths(analyzer, inicial)
    if hasPath(analyzer, final) != False:
        ruta = model.minimumCostPath(analyzer, final)
        lista = []
        for i in ruta:
            for llave in ruta[i]:
                if ruta[i][llave] != None:
                    x = (ruta[i]["info"]['vertexA'],
                         ruta[i]["info"]['vertexB'])
                    lista.append(x)
                else:
                    ruta = lista
                    Rt = {
                        "e_i": inicial,
                        "e_f": final,
                        "n": num,
                        "num": number,
                        "ruta": ruta
                    }
                    return Rt
Exemplo n.º 3
0
def minimumCostPath(analyzer, destStation):
    """
    Retorna el camino de costo minimo desde initialStation a destStation
    """
    delta_time = -1.0

    tracemalloc.start()
    start_time = getTime()

    sol = model.minimumCostPath(analyzer, destStation)

    stop_time = getTime()
    tracemalloc.stop()

    delta_time = stop_time - start_time

    return delta_time, sol
def opc6(analyzer,valores):
    for valor in valores:

        delta_time = -1.0

        tracemalloc.start()
        start_time = getTime()
        
        #req
        narch = "bus_routes_"+str(valor)+".csv"

        loadServices(analyzer,narch)

        dest = "15151-10"

        model.minimumCostPaths(analyzer,"75009-10")

        #print(analyzer)
        path = model.minimumCostPath(analyzer,dest)

        #print("paso controller")
        if path is not None:
            pathlen = stack.size(path)
            print('El camino es de longitud: ' + str(pathlen))
            while (not stack.isEmpty(path)):
                stop = stack.pop(path)
                print(stop)
        else:
            print('No hay camino')

        numedges = totalConnections(analyzer)
        numvertex = totalStops(analyzer)


        stop_time = getTime()
        tracemalloc.stop()

        delta_time = stop_time - start_time
        print(" -- opc 6: -- ")
        print(str(valor)+".csv file:")
        print('El camino es de longitud: ' + str(pathlen))
        print("Tiempo: ", round(delta_time,3))
        print('Numero de vertices: ' + str(numvertex))
        print('Numero de arcos: ' + str(numedges))
Exemplo n.º 5
0
def minimumCostPath(analyzer, destStation):
    """
    Retorna el camino de costo minimo desde initialStation a destStation
    """
    delta_time = -1.0
    delta_memory = -1.0
    tracemalloc.start()
    start_time = getTime()
    start_memory = getMemory()

    res = model.minimumCostPath(analyzer, destStation)

    stop_memory = getMemory()
    stop_time = getTime()
    tracemalloc.stop()
    delta_time = stop_time - start_time
    delta_memory = deltaMemory(start_memory, stop_memory)

    return res, delta_time, delta_memory
Exemplo n.º 6
0
def minimumCostPath(analyzer, destStation):
    """
    Retorna el camino de costo minimo desde initialStation a destStation
    """
    return model.minimumCostPath(analyzer, destStation)
def getminimumCostPath(analyzer, destStation):    
    return model.minimumCostPath(analyzer, destStation)