Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %% Plot function for TSP genetic algorithm.
- % Usage put
- % the wanted random city map as a filename to the RandomCiteis load function
- % Similarly put the wanted initial vectors filename to the initial vectors load function
- % and childVector filename to the load function of ChildVector
- %%
- %filename='D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_100\BestChildVec.dat'
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_100\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_100\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_100\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, Serial n=100')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, Serial n=100')
- hold off
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_200\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_200\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_200\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, Serial n=200')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, Serial n=200')
- hold off
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_300\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_300\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_300\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, Serial n=300')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, Serial n=300')
- hold off
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_400\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_400\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_400\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, Serial n=400')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, Serial n=400')
- hold off
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_500\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_500\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\Serial_500\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, Serial n=500')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, Serial n=500')
- hold off
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r100\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r100\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r100\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, 16 cores n = 100')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, 16 cores n = 100')
- hold off
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r200\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r200\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r200\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, 16 cores n = 200')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, 16 cores n = 200')
- hold off
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r300\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r300\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r300\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, 16 cores n = 300')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, 16 cores n = 300')
- hold off
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r400\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r400\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r400\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, 16 cores n = 400')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, 16 cores n = 400')
- hold off
- %%
- RandomCiteis = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r500\RandomCityMap.dat');
- ChildVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r500\BestChildVec.dat');
- InitialVector = load('D:\GoogleDrive\School Things (Current)\Tools of High Performance Computing\Datas\16Cores\r500\InitialVectors.dat');
- %close all;
- plotVector1 = [RandomCiteis(InitialVector(1,:)'+1,1);flip(RandomCiteis(InitialVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(InitialVector(1,:)'+1,2);flip(RandomCiteis(InitialVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- title('Initial situation, 16 cores n = 500')
- xticks([])
- yticks([])
- hold off
- plotVector1 = [RandomCiteis(ChildVector(1,:)'+1,1);flip(RandomCiteis(ChildVector(1,1)'+1,1))];
- plotVector2 = [RandomCiteis(ChildVector(1,:)'+1,2);flip(RandomCiteis(ChildVector(1,1)'+1,2))];
- figure;
- hold on
- plot(RandomCiteis(:,1),RandomCiteis(:,2),'O');
- plot(plotVector1,plotVector2,'-r');
- xticks([])
- yticks([])
- title('After GA, 16 cores n = 500')
- hold off
Advertisement