Esempio n. 1
0
def greedy_ric_loc():

    from greedy_velocita_distanze_movimento import Greedy
    from ricercalocale import RicercaLocale

    tmov = int(request.vars.tmov)
    tpresa = int(request.vars.tpresa)
    npacchi = int(request.vars.npacchi)
    vel = int(request.vars.vel)
    dim = int(request.vars.dim)

    # eseguo greedy
    greedy = Greedy(tmov, tpresa, npacchi, vel, dim, True)
    (sol, dist) = greedy.run()

    # provo a migliorare usando la ricerca locale
    ricerca = RicercaLocale(100, dist, tmov, tpresa, vel, dim, npacchi)
    # eseguo ricerca locale prima a destra
    ricerca.run(sol)
    best = ricerca.find()

    return dict(status="OK",
                pacchi=best,
                distanze=greedy.intertempo,
                tmov=tmov,
                tpresa=tpresa,
                vel=vel,
                dim=dim)
Esempio n. 2
0
def grasp():

    from grasp import Greedy
    from ricercalocale import RicercaLocale

    tmov = int(request.vars.tmov)
    tpresa = int(request.vars.tpresa)
    npacchi = int(request.vars.npacchi)
    vel = int(request.vars.vel)
    dim = int(request.vars.dim)

    greedy = Greedy(tmov, tpresa, npacchi, vel, dim, True)
    (pright, dist) = greedy.run(2)
    (pleft, dist) = greedy.run(1)

    ricerca = RicercaLocale(100, dist, tmov, tpresa, vel, dim, npacchi)

    # eseguo ricerca locale prima a destra
    ricerca.run(pright)
    best1 = ricerca.find()
    # .. poi a sinistra
    ricerca.run(pleft)
    best2 = ricerca.find()

    # a questo punto cerco la soluzione migliore tra queste due
    SOL = best1 if best1.count(5) < best2.count(5) else best2

    return dict(status="OK",
                pacchi=SOL,
                distanze=greedy.intertempo,
                tmov=tmov,
                tpresa=tpresa,
                vel=vel,
                dim=dim)
Esempio n. 3
0
def grasp():

    from grasp import Greedy
    from ricercalocale import RicercaLocale

    tmov = int(request.vars.tmov)
    tpresa = int(request.vars.tpresa)
    npacchi = int(request.vars.npacchi)
    vel = int(request.vars.vel)
    dim = int(request.vars.dim)

    greedy  = Greedy(tmov, tpresa, npacchi, vel, dim, True)
    (pright, dist) = greedy.run(2)
    (pleft, dist) = greedy.run(1)

    ricerca = RicercaLocale(100, dist, tmov, tpresa, vel, dim, npacchi)
    
    # eseguo ricerca locale prima a destra
    ricerca.run(pright)
    best1 = ricerca.find()
    # .. poi a sinistra
    ricerca.run(pleft)
    best2 = ricerca.find()

    # a questo punto cerco la soluzione migliore tra queste due
    SOL = best1 if best1.count(5) < best2.count(5) else best2

    return dict(status="OK", pacchi=SOL, distanze=greedy.intertempo, tmov=tmov, tpresa=tpresa, vel=vel, dim=dim)
Esempio n. 4
0
def greedy_ric_loc():
    
    from greedy_velocita_distanze_movimento import Greedy
    from ricercalocale import RicercaLocale

    tmov = int(request.vars.tmov)
    tpresa = int(request.vars.tpresa)
    npacchi = int(request.vars.npacchi)
    vel = int(request.vars.vel)
    dim = int(request.vars.dim)

    # eseguo greedy
    greedy  = Greedy(tmov, tpresa, npacchi, vel, dim, True)
    (sol, dist) = greedy.run()

    # provo a migliorare usando la ricerca locale
    ricerca = RicercaLocale(100, dist, tmov, tpresa, vel, dim, npacchi)
    # eseguo ricerca locale prima a destra
    ricerca.run(sol)
    best = ricerca.find()

    return dict(status="OK", pacchi=best, distanze=greedy.intertempo, tmov=tmov, tpresa=tpresa, vel=vel, dim=dim)
from greedy_velocita_distanze_movimento import Greedy
from ricercalocale import RicercaLocale

if __name__ == '__main__':
    tmov = 5
    tpresa = 5
    npacchi = 15
    dim = 10
    V = 10

    # eseguo greedy
    greedy = Greedy(tmov, tpresa, npacchi, V, dim, False)
    (sol, dist) = greedy.run()

    # provo a migliorare usando la ricerca locale
    ricerca = RicercaLocale(100, dist, tmov, tpresa, V, dim, npacchi)
    # eseguo ricerca locale prima a destra
    ricerca.run(sol)
    best = ricerca.find()

    # possiamo stampare la soluzione
    print best
Esempio n. 6
0
    tmov = 5
    tpresa = 5
    npacchi = 15
    dim = 10
    V = 10

    greedy  = Greedy(tmov, tpresa, npacchi, V, dim, False)
    (pright, dist) = greedy.run(2)
    (pleft, dist) = greedy.run(1)

    print "PRIGHT ", pright
    print "PLEFT ", pleft
    print "DIST ", dist

    ricerca = RicercaLocale(100, dist, tmov, tpresa, V, dim, npacchi)
    # eseguo ricerca locale prima a destra
    ricerca.run(pright)
    best1 = ricerca.find()
    # .. poi a sinistra
    ricerca.run(pleft)
    best2 = ricerca.find()

    print "BEST 1 ", best1
    print "BEST 2", best2

    # a questo punto cerco la soluzione migliore tra queste due
    SOL = best1 if best1.count(5) < best2.count(5) else best2

    # possiamo stampare la maledetta soluzione
    print SOL
Esempio n. 7
0
    tmov = 5
    tpresa = 5
    npacchi = 15
    dim = 10
    V = 10

    greedy = Greedy(tmov, tpresa, npacchi, V, dim, False)
    (pright, dist) = greedy.run(2)
    (pleft, dist) = greedy.run(1)

    print "PRIGHT ", pright
    print "PLEFT ", pleft
    print "DIST ", dist

    ricerca = RicercaLocale(100, dist, tmov, tpresa, V, dim, npacchi)
    # eseguo ricerca locale prima a destra
    ricerca.run(pright)
    best1 = ricerca.find()
    # .. poi a sinistra
    ricerca.run(pleft)
    best2 = ricerca.find()

    print "BEST 1 ", best1
    print "BEST 2", best2

    # a questo punto cerco la soluzione migliore tra queste due
    SOL = best1 if best1.count(5) < best2.count(5) else best2

    # possiamo stampare la maledetta soluzione
    print SOL
from greedy_velocita_distanze_movimento import Greedy
from ricercalocale import RicercaLocale

if __name__ == '__main__':
    tmov = 5
    tpresa = 5
    npacchi = 15
    dim = 10
    V = 10

    # eseguo greedy
    greedy  = Greedy(tmov, tpresa, npacchi, V, dim, False)
    (sol, dist) = greedy.run()

    # provo a migliorare usando la ricerca locale
    ricerca = RicercaLocale(100, dist, tmov, tpresa, V, dim, npacchi)
    # eseguo ricerca locale prima a destra
    ricerca.run(sol)
    best = ricerca.find()

    # possiamo stampare la soluzione
    print best