ta=[ 1 1 1 2 2 3 3 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 10 10 15 15 8 11 11 12 12 12 12 13 13 14 14 14 16 16 16 17 17 18 19 21 22 23 23 24]; he=[ 10 19 20 10 8 8 13 9 16 25 12 13 14 17 18 19 21 22 7 20 20 22 24 15 12 11 19 11 12 13 13 14 17 19 14 17 9 16 17 17 24 25 18 23 21 20 22 23 24 25 25]; dl=[40 10 27 22 14 11 4 16 10 28 11 33 24 27 11 20 11 13 25 40 35 8 8 18 42 10 40 5 11 10 21 30 32 36 18 30 10 13 20 10 42 38 12 20 8 38 10 10 11 33 27]; g1=make_graph('graf1',1,25,[ta he],[he ta]); g1=add_edge_data(g1,'length',[dl dl]); liczba_zlecen=4; zlecenia=[2 5; 6 8; 3 4; 9 7]; /// podejscie 1 baza=1; kurier=baza; dlug1=0; trasa1=[baza]; for k=1:liczba_zlecen [p,dl]=shortest_path(kurier,zlecenia(k,1),g1,'length'); // odbior dlug1=dlug1 + dl wierz=path_2_nodes(p,g1); trasa1=[trasa1 wierz(1,2:$)]; kurier=zlecenia(k,1); [p,dl]=shortest_path(kurier,zlecenia(k,2),g1,'length'); // dostarczenie dlug1=dlug1 + dl wierz=path_2_nodes(p,g1); trasa1=[trasa1 wierz(1,2:$)]; kurier=zlecenia(k,2); end [p,dl]=shortest_path(kurier,baza,g1,'length'); // powrót dlug1=dlug1 + dl wierz=path_2_nodes(p,g1); trasa1=[trasa1 wierz(1,2:$)] m2=zeros(9,9); for i=1:9 for j=1:9 if i<>j then [p,dl]=shortest_path(i,j,g1,'length'); m2(i,j)=dl; end end end m2 ta2=[1 1 1 1 1 1 3 3 3 3 3 4 4 4 5 5 5 5 6 6 7 8]; he2=[2 3 5 6 8 9 4 5 6 7 8 5 6 7 6 7 8 9 7 9 9 9]; dl2=[62 71 57 30 62 86 45 36 65 72 32 43 51 58 30 37 27 34 21 61 68 43]; g2=make_graph('graf2',1,9,[ta2 he2],[he2 ta2]); g2=add_edge_data(g2,'length',[dl2 dl2]);