Esempio n. 1
0
    y_cor = ([int(100*math.log(i+1)*math.cos(random.random()))
              for i in range(25)] +
             [int(1000*math.log(i+1)*math.sin(random.random()))
              for i in range(25)]
             + [int(1000*random.uniform(-0.5, 1)) for i in range(15)]
             + map(lambda x: x + int(random.random()*100),#pylint:disable=bad-builtin,deprecated-lambda
                   [linear[i] - 360 for i in range(40)]))

    return x_cor, y_cor

if __name__ == '__main__':
    PTS = test_data()

    RES1 = algorithm1_mod3(PTS[0], PTS[1])
    RES2 = algorithm1(PTS[0], PTS[1])
    RES3 = algorithm2(PTS[0], PTS[1])
    SCORE1 = delaycounter(PTS[0], PTS[1], (RES1[1], RES1[2]), 'waiting')
    SCORE2 = delaycounter(PTS[0], PTS[1], (RES2[1], RES2[2]), 'waiting')
    SCORE3 = delaycounter(PTS[0], PTS[1], (RES3[1], RES3[2]), 'blocking')
    print SCORE1
    print RES1
    print SCORE2
    print RES2
    print SCORE3
    print RES3
    scatter_trains(PTS[0], PTS[1], RES1)
    scatter_trains(PTS[0], PTS[1], RES2)
    scatter_trains(PTS[0], PTS[1], RES3, False)
    plt.show()
Esempio n. 2
0
from plot_trains import scatter_trains
from get_matching_delay import get_matching_delay
from train_algos import algorithm1_mod, algorithm1
from delaycounter import delaycounter
from new_alg1mod import algorithm1_mod2
delayer, victim = get_matching_delay('1619','45961', False, True)
import csv

algres = (90, -842, -72)

print delaycounter(delayer, victim, (algres[1], algres[2]), 
                   algtype = 'blocking')
scatter_trains(delayer, victim, algres, waiting = False, show = True)

Esempio n. 3
0
    y = [0, 3, 5, 3, 8, 2, 5, 5, 7, 2, 6, 4, 2]
    result = algorithm1_mod3(x, y)
    print result
    print delaycounter(x, y, (result[1], result[2]))

if __name__ == '__main__':
    delayer, victim = get_matching_delay(1052, 304, True, False)
    res1 = algorithm1_mod3(delayer, victim)
    res2 = algorithm1_mod2(delayer, victim)
    #res3 = algorithm1_mod(delayer, victim)
    res4 = algorithm1_mod4(delayer, victim)
    res5 = algorithm1_mod5(delayer, victim)
    #test()
    print res1 
    print delaycounter(delayer, victim, (res1[1], res1[2]))
    scatter_trains(delayer, victim, res1)
    print res2
    print delaycounter(delayer, victim, (res2[1], res2[2]))
    scatter_trains(delayer, victim, res2)
    #print res3
    #print delaycounter(delayer, victim, (res3[1], res3[2]))
    #scatter_trains(delayer, victim, res3)
    print res4
    print delaycounter(delayer, victim, (res4[1], res4[2]))
    scatter_trains(delayer, victim, res4)
    print res5
    print delaycounter(delayer, victim, (res5[1], res5[2]))
    scatter_trains(delayer, victim, res5, show = True)
    
    delayers = [274, 7215, 1614, 809, 1154, 2718, 3896, 3892, 12045, 5809, 2756]
    victims = [5559, 5559, 5559, 5559, 5559, 5559, 5559, 3721, 7120, 1666, 1128]