mode(0); clear; // UVODNI NACTENI TABULEK Sheets=readxls("C:\Users\Matej\Documents\data_mpdt\mpdtn.xls"); // nactení souboru v Excelu linek=68; // soucet linek v obou smerech zastavek=1409; // celkem zastavek pro vypocet sheet = Sheets(1); zastavky = sheet (3:zastavek+2,1:2); // Cn a KVZ vsech zastavek kapacity = sheet (2,3:linek+2); // KL vsech linek poradi = sheet (3:zastavek+2,3:linek+2); // poradi jednotlivych zastavek na linkach sheet = Sheets(2); T51 = sheet (:,:); // linka 51 T sheet = Sheets(3); Z51 = sheet (:,:); // linka 51 Z sheet = Sheets(4); T52 = sheet (:,:); // linka 52 T sheet = Sheets(5); Z52 = sheet (:,:); // linka 52 Z sheet = Sheets(6); T53 = sheet (:,:); // linka 53 T sheet = Sheets(7); Z53 = sheet (:,:); // linka 53 Z sheet = Sheets(8); T54 = sheet (:,:); // linka 54 T sheet = Sheets(9); Z54 = sheet (:,:); // linka 54 Z sheet = Sheets(10); T55 = sheet (:,:); // linka 55 T sheet = Sheets(11); Z55 = sheet (:,:); // linka 55 Z sheet = Sheets(12); T56 = sheet (:,:); // linka 56 T sheet = Sheets(13); Z56 = sheet (:,:); // linka 56 Z sheet = Sheets(14); T58 = sheet (:,:); // linka 58 T sheet = Sheets(15); Z58 = sheet (:,:); // linka 58 Z sheet = Sheets(16); T59 = sheet (:,:); // linka 59 T sheet = Sheets(17); Z59 = sheet (:,:); // linka 59 Z sheet = Sheets(18); T501 = sheet (:,:); // linka 501 T sheet = Sheets(19); Z501 = sheet (:,:); // linka 501 Z sheet = Sheets(20); T502 = sheet (:,:); // linka 502 T sheet = Sheets(21); Z502 = sheet (:,:); // linka 502 Z sheet = Sheets(22); T503 = sheet (:,:); // linka 503 T sheet = Sheets(23); Z503 = sheet (:,:); // linka 503 Z sheet = Sheets(24); T504 = sheet (:,:); // linka 504 T sheet = Sheets(25); Z504 = sheet (:,:); // linka 504 Z sheet = Sheets(26); T505 = sheet (:,:); // linka 505 T sheet = Sheets(27); Z505 = sheet (:,:); // linka 505 Z sheet = Sheets(28); T506 = sheet (:,:); // linka 506 T sheet = Sheets(29); Z506 = sheet (:,:); // linka 506 Z sheet = Sheets(30); T507 = sheet (:,:); // linka 507 T sheet = Sheets(31); Z507 = sheet (:,:); // linka 507 Z sheet = Sheets(32); T508 = sheet (:,:); // linka 508 T sheet = Sheets(33); Z508 = sheet (:,:); // linka 508 Z sheet = Sheets(34); T509 = sheet (:,:); // linka 509 T sheet = Sheets(35); Z509 = sheet (:,:); // linka 509 Z sheet = Sheets(36); T510 = sheet (:,:); // linka 510 T sheet = Sheets(37); Z510 = sheet (:,:); // linka 510 Z sheet = Sheets(38); T511 = sheet (:,:); // linka 511 T sheet = Sheets(39); Z511 = sheet (:,:); // linka 511 Z sheet = Sheets(40); T512 = sheet (:,:); // linka 512 T sheet = Sheets(41); Z512 = sheet (:,:); // linka 512 Z sheet = Sheets(42); T514 = sheet (:,:); // linka 514 T sheet = Sheets(43); Z514 = sheet (:,:); // linka 514 Z sheet = Sheets(44); T515 = sheet (:,:); // linka 515 T sheet = Sheets(45); Z515 = sheet (:,:); // linka 515 Z sheet = Sheets(46); T516 = sheet (:,:); // linka 516 T sheet = Sheets(47); Z516 = sheet (:,:); // linka 516 Z sheet = Sheets(48); T517 = sheet (:,:); // linka 517 T sheet = Sheets(49); Z517 = sheet (:,:); // linka 517 Z sheet = Sheets(50); T601 = sheet (:,:); // linka 601 T sheet = Sheets(51); Z601 = sheet (:,:); // linka 601 Z sheet = Sheets(52); T602 = sheet (:,:); // linka 602 T sheet = Sheets(53); Z602 = sheet (:,:); // linka 602 Z sheet = Sheets(54); T603 = sheet (:,:); // linka 603 T sheet = Sheets(55); Z603 = sheet (:,:); // linka 603 Z sheet = Sheets(56); T604 = sheet (:,:); // linka 604 T sheet = Sheets(57); Z604 = sheet (:,:); // linka 604 Z sheet = Sheets(58); T605 = sheet (:,:); // linka 605 T sheet = Sheets(59); Z605 = sheet (:,:); // linka 605 Z sheet = Sheets(60); T606 = sheet (:,:); // linka 606 T sheet = Sheets(61); Z606 = sheet (:,:); // linka 606 Z sheet = Sheets(62); T607 = sheet (:,:); // linka 607 T sheet = Sheets(63); Z607 = sheet (:,:); // linka 607 Z sheet = Sheets(64); T608 = sheet (:,:); // linka 608 T sheet = Sheets(65); Z608 = sheet (:,:); // linka 608 Z sheet = Sheets(66); T609 = sheet (:,:); // linka 609 T sheet = Sheets(67); Z609 = sheet (:,:); // linka 609 Z sheet = Sheets(68); T610 = sheet (:,:); // linka 610 T sheet = Sheets(69); Z610 = sheet (:,:); // linka 610 Z // KONEC NACITANI // VYPOCET KPN KPNs = zeros(zastavek,linek); KPN = KPNs; // iniciace zatím prázdných matic for j = 1:zastavek for i = 1:linek if poradi(j,i)>0 then KPNs(j,i) = kapacity(1,i); // prepis poradi zastavek kapacitami linek end end end for j = 1:zastavek sumKPN = KPNs(j,:); sumKPN = sum(sumKPN); // suma kapacit for i = 1:linek if poradi(j,i)>0 then KPN(j,i) = KPNs(j,i) ./ sumKPN; // vypocet KPN end end end clear KPNs; clear sumKPN; //VYPOCET DPN DPNs = zeros(zastavek,linek); DPN = DPNs; // iniciace zatím prázdných matic for i = 1:linek select i // vyber matice prislusne linky case 1 then A = T51; case 2 then A = Z51; case 3 then A = T52; case 4 then A = Z52; case 5 then A = T53; case 6 then A = Z53; case 7 then A = T54; case 8 then A = Z54; case 9 then A = T55; case 10 then A = Z55; case 11 then A = T56; case 12 then A = Z56; case 13 then A = T58; case 14 then A = Z58; case 15 then A = T59; case 16 then A = Z59; case 17 then A = T501; case 18 then A = Z501; case 19 then A = T502; case 20 then A = Z502; case 21 then A = T503; case 22 then A = Z503; case 23 then A = T504; case 24 then A = Z504; case 25 then A = T505; case 26 then A = Z505; case 27 then A = T506; case 28 then A = Z506; case 29 then A = T507; case 30 then A = Z507; case 31 then A = T508; case 32 then A = Z508; case 33 then A = T509; case 34 then A = Z509; case 35 then A = T510; case 36 then A = Z510; case 37 then A = T511; case 38 then A = Z511; case 39 then A = T512; case 40 then A = Z512; case 41 then A = T514; case 42 then A = Z514; case 43 then A = T515; case 44 then A = Z515; case 45 then A = T516; case 46 then A = Z516; case 47 then A = T517; case 48 then A = Z517; case 49 then A = T601; case 50 then A = Z601; case 51 then A = T602; case 52 then A = Z602; case 53 then A = T603; case 54 then A = Z603; case 55 then A = T604; case 56 then A = Z604; case 57 then A = T605; case 58 then A = Z605; case 59 then A = T606; case 60 then A = Z606; case 61 then A = T607; case 62 then A = Z607; case 63 then A = T608; case 64 then A = Z608; case 65 then A = T609; case 66 then A = Z609; case 67 then A = T610; case 68 then A = Z610; else mprintf("Error"); end pom=A(:,1); celzas=length(pom); // zjisteni poctu zastavek na lince for j = 1:zastavek if poradi(j,i)>0 then for k = 1:zastavek if poradi(k,i)>poradi(j,i) then // kontrola, ze scitame KVZ nasledujicich zast. if A( poradi(k,i) , poradi (j,i) ) > -1; // kontrola, ze je splnena promost tr. DPNs(j,i)=DPNs(j,i)+zastavky(k,2); end end end end end clear A; clear pom; clear celzas; end for j = 1:zastavek sumDPN = DPNs(j,:); sumDPN = sum(sumDPN); // suma kapacit for i = 1:linek if poradi(j,i)>0 then if sumDPN > 0 then // kontrola deleni nulou DPN(j,i) = DPNs(j,i) ./ sumDPN; // vypocet DPN end end end end clear sumDPN; // VYPOCET CPN a jednotlivych nastupu Cn CPN = KPN + DPN; CPN = CPN ./ 2; Cn = zeros(zastavek,linek); for i = 1:linek Cn(:,i) = zastavky (:,1) .* CPN (:,i); end // VYPOCET VYSTUPUJICICH for i = 1:linek select i // vyber matice prislusne linky case 1 then A = T51; case 2 then A = Z51; case 3 then A = T52; case 4 then A = Z52; case 5 then A = T53; case 6 then A = Z53; case 7 then A = T54; case 8 then A = Z54; case 9 then A = T55; case 10 then A = Z55; case 11 then A = T56; case 12 then A = Z56; case 13 then A = T58; case 14 then A = Z58; case 15 then A = T59; case 16 then A = Z59; case 17 then A = T501; case 18 then A = Z501; case 19 then A = T502; case 20 then A = Z502; case 21 then A = T503; case 22 then A = Z503; case 23 then A = T504; case 24 then A = Z504; case 25 then A = T505; case 26 then A = Z505; case 27 then A = T506; case 28 then A = Z506; case 29 then A = T507; case 30 then A = Z507; case 31 then A = T508; case 32 then A = Z508; case 33 then A = T509; case 34 then A = Z509; case 35 then A = T510; case 36 then A = Z510; case 37 then A = T511; case 38 then A = Z511; case 39 then A = T512; case 40 then A = Z512; case 41 then A = T514; case 42 then A = Z514; case 43 then A = T515; case 44 then A = Z515; case 45 then A = T516; case 46 then A = Z516; case 47 then A = T517; case 48 then A = Z517; case 49 then A = T601; case 50 then A = Z601; case 51 then A = T602; case 52 then A = Z602; case 53 then A = T603; case 54 then A = Z603; case 55 then A = T604; case 56 then A = Z604; case 57 then A = T605; case 58 then A = Z605; case 59 then A = T606; case 60 then A = Z606; case 61 then A = T607; case 62 then A = Z607; case 63 then A = T608; case 64 then A = Z608; case 65 then A = T609; case 66 then A = Z609; case 67 then A = T610; case 68 then A = Z610; else mprintf("Error"); end pom=A(:,1); celzas=length(pom); // zjisteni poctu zastavek na lince for m = 1:celzas-1 // nastupni zastavka for n = m+1:celzas // vystupni zastavka if A(n,m) > -1 then // zjisteni splneni kriteria primosti trasy for j = 1:zastavek if poradi(j,i) == m then // nalezeni nastupni zastavky for k = 1:zastavek if poradi (k,i) == n then // nalezeni vystupni zastavky if DPNs(j,i) > 0 then A(n,m) = zastavky(k,2) ./ DPNs(j,i) .* Cn(j,i); end // vlastni vypocet vystupujicich cest. end end end end else A(n,m)=0; // prepsani relaci nesplnujici KPT nulou end end end select i // vyber prislusne linky a ulozeni matice case 1 then T51 = A; case 2 then Z51 = A; case 3 then T52 = A; case 4 then Z52 = A; case 5 then T53 = A; case 6 then Z53 = A; case 7 then T54 = A; case 8 then Z54 = A; case 9 then T55 = A; case 10 then Z55 = A; case 11 then T56 = A; case 12 then Z56 = A; case 13 then T58 = A; case 14 then Z58 = A; case 15 then T59 = A; case 16 then Z59 = A; case 17 then T501 = A; case 18 then Z501 = A; case 19 then T502 = A; case 20 then Z502 = A; case 21 then T503 = A; case 22 then Z503 = A; case 23 then T504 = A; case 24 then Z504 = A; case 25 then T505 = A; case 26 then Z505 = A; case 27 then T506 = A; case 28 then Z506 = A; case 29 then T507 = A; case 30 then Z507 = A; case 31 then T508 = A; case 32 then Z508 = A; case 33 then T509 = A; case 34 then Z509 = A; case 35 then T510 = A; case 36 then Z510 = A; case 37 then T511 = A; case 38 then Z511 = A; case 39 then T512 = A; case 40 then Z512 = A; case 41 then T514 = A; case 42 then Z514 = A; case 43 then T515 = A; case 44 then Z515 = A; case 45 then T516 = A; case 46 then Z516 = A; case 47 then T517 = A; case 48 then Z517 = A; case 49 then T601 = A; case 50 then Z601 = A; case 51 then T602 = A; case 52 then Z602 = A; case 53 then T603 = A; case 54 then Z603 = A; case 55 then T604 = A; case 56 then Z604 = A; case 57 then T605 = A; case 58 then Z605 = A; case 59 then T606 = A; case 60 then Z606 = A; case 61 then T607 = A; case 62 then Z607 = A; case 63 then T608 = A; case 64 then Z608 = A; case 65 then T609 = A; case 66 then Z609 = A; case 67 then T610 = A; case 68 then Z610 = A; else mprintf("Error"); end clear A; clear pom; clear celzas; end