Пример #1
0
def annealing_general(runTime, stations, timeTotal, startTimeOneTour,
                      startTimeTwoTour, startTimeOneRetour, startTimeTwoRetour,
                      frequencyOne, frequencyTwo, trainTime, numTrainTour,
                      numTrainRetour):
    T = [100, 1000, 10000]
    k = [0.7, 0.8, 0.9, 0.99]
    type = 1
    for j in T:
        plt.figure()
        for l in k:
            x, y = en.run(runTime, stations, timeTotal, startTimeOneTour,
                          startTimeTwoTour, startTimeOneRetour,
                          startTimeTwoRetour, frequencyOne, frequencyTwo,
                          trainTime, j, numTrainTour, numTrainRetour, l, type)
            plt.plot(x, y, label="k=" + str(l))
        plt.legend()
        plt.title("Annealing, T=" + str(j) + ", type=1")
        plt.xlabel("Seconds")
        plt.ylabel("Fitness")
        plt.savefig("Annealing.T=" + str(j) + ", type=1.pdf")
        # plt.show()

    T = [100, 1000, 10000]
    k = [0.001, 0.01, 0.1]
    type = 2
    for j in T:
        plt.figure()
        for l in k:
            x, y = en.run(runTime, stations, timeTotal, startTimeOneTour,
                          startTimeTwoTour, startTimeOneRetour,
                          startTimeTwoRetour, frequencyOne, frequencyTwo,
                          trainTime, j, numTrainTour, numTrainRetour, l, type)
            plt.plot(x, y, label="k=" + str(l))
        plt.legend()
        plt.title("Annealing, T=" + str(j) + ", type=2")
        plt.xlabel("Seconds")
        plt.ylabel("Fitness")
        plt.savefig("Annealing.T=" + str(j) + ", type=2.pdf")
Пример #2
0
def plot_k_alpha2_analysis(runTime, stations, timeTotal, startTimeOneTour,
                           startTimeTwoTour, startTimeOneRetour,
                           startTimeTwoRetour, frequencyOne, frequencyTwo,
                           trainTime, numTrainTour, numTrainRetour):
    T = 50000
    k = [0.001, 0.01, 0.05, 0.1, 0.2, 0.4]
    type = 2
    plt.figure()
    for i in k:
        xi = 0
        for j in range(5):
            x, y = en.run(runTime, stations, timeTotal, startTimeOneTour,
                          startTimeTwoTour, startTimeOneRetour,
                          startTimeTwoRetour, frequencyOne, frequencyTwo,
                          trainTime, T, numTrainTour, numTrainRetour, i, type)
            xi += y
        xi /= 5
        plt.plot(x, y, label="k=" + str(i))
    plt.legend()
    plt.title("Annealing, T=5000, Type=2")
    plt.xlabel("Seconds")
    plt.ylabel("Fitness")
    plt.savefig("k2.pdf")
Пример #3
0
def plot_T_alpha2_analysis(runTime, stations, timeTotal, startTimeOneTour,
                           startTimeTwoTour, startTimeOneRetour,
                           startTimeTwoRetour, frequencyOne, frequencyTwo,
                           trainTime, numTrainTour, numTrainRetour):
    T = [100, 500, 1000, 5000, 10000, 50000]
    k = 0.1
    type = 2
    plt.figure()
    for i in T:
        xi = 0
        for j in range(5):
            x, y = en.run(runTime, stations, timeTotal, startTimeOneTour,
                          startTimeTwoTour, startTimeOneRetour,
                          startTimeTwoRetour, frequencyOne, frequencyTwo,
                          trainTime, i, numTrainTour, numTrainRetour, k, type)
            xi += y
        xi /= 5
        plt.plot(x, y, label="T=" + str(i))
    plt.legend()
    plt.title("Annealing, k=0.1, Type=2")
    plt.xlabel("Seconds")
    plt.ylabel("Fitness")
    plt.savefig("T2.pdf")