Documente Academic
Documente Profesional
Documente Cultură
Facultatea de INFORMATICĂ
REFERAT
Algoritmica Grafurilor
Student:
Iordache I. Alexandru
Anul I ID
Centrul Călăraşi
1
Probleme Modulul 1
Testul nr. 1
1. Să se demonstreze relaţiile:
k 1 k 1 k 1
a) Cn Cn 1 Cn 2 ... Ck 1 ;
k
k 1
b) Cn m Cn Cm CnCm ... Cnk Cm0 ;
k 0 k 1
1 n n
c) Cn Cn Cn ... ... 2 2cos
0 3 6
.
3 3
k 1 k 1 k 1
a) Cn Cn 1 Cn 2 ... Ck 1
k
k 1
b) Cn m Cn Cm CnCm ... Cnk Cm0
k 0 k 1
Să considerăm egalitatea:
1 x n 1 x m 1 x nm
Vom folosi formula binomului lui Newton:
a b n Cn0a n Cn1a n 1b ... Cnma n mbm ... Cnnbn şi obţinem:
1 x n Cn01n Cn11n 1 x ... Cnk 1n k xk ... Cnn xn
1 m 1
1 x m Cm0 1m Cm1 x ... Cmk 1mk xk ... Cmm xm
1 x n m Cn0 m1n m Cn1 m1n m1 x ... Cnk m1n mk xk ... Cnnmm xn m
k k
Coeficientul lui x din membrul drept al acestei egalităţi este Cn m .
k
Coeficientul lui x din membrul stâng al egalităţii este:
Cn0Cmk Cn1Cmk 1 ... Cnk Cm0
k
Egalând coeficienţii lui x obţinem egalitatea din enunţ:
Cnk m Cn0Cmk Cn1Cmk 1 ... Cnk Cm0 .
2
Un caz particular îl reprezintă situaţia în care n m k . Atunci:
C2nn Cn0Cnn Cn1Cnn 1 Cn2Cnn 2 ... CnnCn0
Dar:
Cn0 Cnn
Cn1 Cnn 1
Cn2 Cnn 2 şi relaţia devine:
C C
2 1 2 2 2 2
C2nn Cn0 n n ... Cnn - rezolvarea pentru punctul 1.a de la
Tema de control.
1 n n
c) Cn Cn Cn ... ... 2 2cos .
0 3 6
3 3
Rădăcinile de ordinul n ale unităţii sunt soluţiile ecuaţiei:
z n 1 z n cos0 i sin 0
2k 2k
Aceste soluţii sunt : k cos i sin , unde k 0,1,..., n 1 şi verifică
n n
relaţiile:
nk 1
1 k k2 ... kn 1 0
2 2 1 i 3 1 3
Fie cos i sin i o rădăcină cubică complexă a
3 3 2 2 2
unităţii.
Avem deci 1 şi 1 0 .
3 2
3
obţinem:
1 2 n
Cn0 2Cn1 4Cn2 6Cn3 8Cn4 ...
n
2 1 n
1
2 n
Cn Cn Cn Cn Cn ... Cn Cn Cn Cn
0 1 2 3 4 0 1 2 2 3
n
2 1 n
1
2 n
3Cn Cn 1 Cn 1 3Cn
0 1 2 2 2 3
Cn4 1 2 Cn5 1 2 3Cn6 ...
Dar 1
2
0 şi împărţind egalitatea la 3 obţinem:
1 n
3
2 1 n
1
2 n
Cn0 Cn3 Cn6 ...
1 3 1 3
Deci 1 1 i i cos i sin
2
2 2 2 2 3 3
4
2. Să se calculeze sumele:
Avem:
Sn Cn1 2Cn2 3Cn3 ... nCnn şi totodată
Sn nCnn n 1 Cnn 1 ... 2Cn2 Cn1 (scriind termenii în ordine inversă).
nk
Folosind formula combinărilor complementare Cn Cn
k
, prin adunarea celor
două sume obţinem:
2Sn nCnn 1 n 1 Cn1 2 n 2 Cn2... n 1 1 Cnn 1 nCnn
2Sn n n Cn1 Cn2 Cn3... Cnn 1 Cnn
Cn0 Cn1 Cn2 Cn3... Cnn 1 Cnn 2n
Cn1 Cn2 Cn3... Cnn 1 Cnn 2n Cn0 2n 1
Înlocuind obţinem:
2 S n n n 2n 1 n n 2n n n 2n
n 2n
Sn n 2n 1
2
În mod asemănător se rezolvă şi următoarele exerciţii:
punctul 2.a de la Tema de control: Cn 2Cn 3Cn ... n 1 Cn
0 1 2 n
Avem:
Sn Cn0 2Cn1 3Cn2 4Cn3 ... n 1 Cnn şi totodată:
Sn n 1 Cnn nCnn 1 ... 4Cn3 3Cn2 2Cn1 Cn0 (scriind termenii în ordine
inversă).
nk
Folosim formula combinărilor complementare Cn Cn
k
, adică:
Cn0 Cnn
Cn1 Cnn 1
Cn2 Cnn 2
5
Adunăm cele două sume de mai sus şi obţinem:
2Sn n 1 1 Cn0 n 2 Cn1 3 n 1 Cn2 .... n 2 Cnn 1 n 1 1 Cnn
2Sn n 2 Cn0 Cn1 Cn2 ... Cnn 1 Cnn
Dar:
Cn0 Cn1 Cn2 Cn3... Cnn 1 Cnn 2n
Înlocuind obţinem:
2 S n n 2 2n
Sn n 2 2n 1
Avem:
Sn 3Cn1 7Cn2 11Cn3 ... 4n 9 Cnn 2 4n 5 Cnn 1 4n 1 Cnn şi
totodată:
Sn 4n 1 Cnn 4n 5 Cnn 1 4n 9 Cnn 2 ... 11Cn3 7Cn2 3Cn1 (scriind
termenii în ordine inversă).
nk
Folosim formula combinărilor complementare Cn Cn
k
, adică:
Cn0 Cnn
Cn1 Cnn 1
Cn2 Cnn 2
…………………………………….
6
1 2 Cn2 3Cn3 ... n Cnn
2 2 2 2
punctul 2.d de la Tema de control: Cn
Avem:
Sn Cn1 2 Cn2 3 Cn3 ... n 2 Cnn 2 n 1 Cnn 1 n Cnn
2 2 2 2 2 2
şi totodată:
Sn n Cnn n 1 Cnn 1 n 2 Cnn 2 ... 3Cn3 2 Cn2 Cn1
2 2 2 2 2 2
Dar, de la exerciţiul anterior ştim că:
C C ... C
2 1 2 2 2 n 2
C2nn Cn0 n n n
C C ... C C 1
1 2
n
2 2
n
n 2
n
n
2n
2S n C n C 1
n 2 n
n n 2n
2S n n C 1 nC
n
n
2n
n
2n
C2nn
2 n ! 2 n !
n! 2n n ! n! n!
Deci suma respectivă este:
2Sn nC2nn
n n n 2n ! 1 2n !
Sn C2n
2 2 n! n! 2 n 1! n!
7
n
Cn0 Cn1 Cn2 Cnn Cnk
b)
1
2
3
...
n 1 k 0 k 1
Sn
1
Suma se transformă în Sn Cnk11
n 1 k 0
n
Dar Cnk11 Cn11 Cn21 .... Cnn1 Cnn11
k 0
Ştim însă că
Cn0 Cn1 Cn2 Cn3... Cnn 1 Cnn 2n Cn01 Cn11 Cn21 .... Cnn1 Cnn11 2n 1
8
Testul nr. 2
1. Să se demonstreze relaţiile:
1 n 1 n
n
b) Cn0 Cn4 Cn8 ... ... 2 2 cos
2
2 4
n
n
0
c) Cn Cn2 Cn4 Cn6 ... ... 22 cos .
4
n
n
0
c) Cn Cn2 Cn4 Cn6 ... ... 22 cos
4
Considerăm un număr complex z a bi scris sub această formă algebrică. El
poate fi scris şi sub formă trigonometrică astfel:
z r cos i sin unde r a 2 b2 este modulul numărului complex z , iar
b
arctg este argumentul numărului complex z .
a
În cazul nostru pentru a b 1 rezultă numărul complex z 1 i .
Conform binomului lui Newton obţinem următoarea dezvoltare a acestui număr
complex:
n
1 i i
n k
Cnk Cn0 iCn1 i 2Cn2 ... i nCnn Cn0 iCn1 Cn2 iCn3
k 0 (1)
Cn4 ... i nCnn Cn0 Cn2 Cn4 Cn6 .... i Cn1 Cn3 Cn5 Cn7 ...
Puterile lui i sunt următoarele:
i 4k 1 i
i 4k 2 1
i 4k 3 i
i 4k 1
Notăm cu S următorul şir: Cn Cn Cn Cn ... şi cu T şirul Cn1 Cn3 Cn5 Cn7 ...
0 2 4 6
9
n
n n
2
n
1 i n
2 cos i sin cos i sin
4 4 4 4 (2)
n
n n
22 cos i sin
4 4
Egalând părţile reale şi imaginare din relaţiile (1) şi (2) avem:
n
n
S 22 cos Cn0 Cn2 Cn4 Cn6 ...
4
n
n
T 22 sin Cn1 Cn3 Cn5 Cn7 ...
4
(aceasta fiind demonstraţia şi pentru punctul 1.d din Tema de control).
1 n 1 n
n
b) Cn0 Cn4 Cn8 ... ... 2 2 cos
2
2 4
Din exerciţul c) pe care l-am demonstrat la punctul anterior ştim că:
n
n
Cn0 Cn2 Cn4 Cn6 ... 2 2 cos 1
4
De asemenea ştim că suma coeficienţilor binomiali ai termenilor de rang par este
agală cu suma coeficienţilor binomiali ai termenilor de rang impar, adică:
Cn0 Cn2 Cn4 Cn6 ... Cn1 Cn3 Cn5 Cn7 ... 2n 1 2
Dacă adunăm relaţiile (1) cu (2), după reducerea termenilor obţinem:
n
2 Cn0 Cn4 Cn8
n
... 2
4
n 1
, adică 22 cos
1 n 1 n
n
Cn Cn Cn ... 2 2 cos
0 4 8 2
2 4
De asemenea, tot de la demonstraţia anterioară ştim că:
n
n
Cn1 Cn3 Cn5 Cn7 ... 2 2 sin
4
Cn1 Cn3 Cn5 Cn7 ... 2n 1
10
1 n 1 n
n
Cn1 Cn5 ... 2 2 2 sin , aceasta fiind demonstraţia pentru
Cn9
2 4
punctul 1.c de la Tema de control.
11
Probleme Modulul 2
Problema nr. 1
Fie graful G X ,U a cărui matrice booleană asociată este:
0 1 1 0
0 0 1 1
A
0 0 0 1
0 0 0 0
x2
x1
x1
x4
x3
Pasul 1) Fie a1i1 , a1i2 ,..., a1im elementele diferite de zero de pe linia 1 a matricei A.
Adunăm boolean liniile i1, i2 ,..., im la linia 1.
Pasul 2) Dacă în urma efectuării operaţiilor de la pasul 1 au apărut alte elemente
diferite de zero pe linia 1, fie acestea a1 j1 , a1 j2 ,..., a1 jk . Adunăm boolean liniile
j1, j2 ,..., jk la linia 1.
Pasul 3) Se repetă pasul 2 până când se ajunge la una din următoarele situaţii:
toate elementele liniei 1 sunt egale cu 1;
nu se mai pot genera alte elemente diferite de zero pe linia 1.
Pasul 4) Paşii 1, 2 şi 3 se repetă pentru fiecare linie.
12
În final se obţine matricea conexă terminală T. Dacă în matricea conexă terminală T
ataşată unui graf toate elementele tii , i 1,2,..., n de pe diagonala principală sunt egale
cu 0, atunci graful respectiv este fără circuite, iar dacă există cel puţin două elemente t jj
şi t egale cu 1 pe diagonala principală, graful are cel puţin un circuit care conţine
vârfurile x j şi x . Dacă există un singur element tkk 1 pe diagonala principală a matricei
T, atunci există o buclă în vârful xk .
0 1 1 0
0 0 1 1
A=
0 0 0 1
0 0 0 0
0 1 1 1
0 0 1 1
0 0 0 1
0 0 0 0
Continuăm cu linia 2 care are elementele nenule a23 şi a24 , dar prin adunarea liniilor
3 şi 4 la linia 2 nu se mai pot genera alte elemente nenule pe această linie. La fel şi pentru
linia 3, deci matricea conexă terminală este:
0 1 1 1
0 0 1 1
T=
0 0 0 1
0 0 0 0
d) Conform teoremei lui Chen, un graf orientat şi fără circuite conţine un drum
hamiltonian, dacă şi numai dacă numărul elementelor diferite de 0 din matricea
n (n 1)
conexă terminală T este egal cu , unde n este numărul de vârfuri al
2
grafului.
În cazul nostru numărul elementelor din matricea T care sunt diferite de 0 este 6, iar
numărul vârfurilor este 4.
n (n 1) 4 3
Avem deci 6 , deci graful conţine un drum hamiltonian care este
2 2
unic.
13
Fiind un drum hamiltonian acesta trece prin toate vârfurile grafului: x1 , x2 , x3 , x4 .
x1 x2 x3 x4 P ( xi )
0 1 1 1 3
T= 0 0 1 1 2
0 0 0 1 1
0 0 0 0 0
0 1 1 1
0 0 1 1
În cazul de faţă T’ = T = , care este o matrice superior triunghiulară.
0 0 0 1
0 0 0 0
14
Problema nr. 2
Prelucrarea unui produs poate trece prin 6 faze distincte notate într-un model de
graf prin xi , i 1, 2,...,6 , iar posibilităţile de trecere de la o fază de prelucrare la alta se
reprezintă prin arce orientate. Matricea booleană asociată acestui graf este următoarea:
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 0 0 0
A ;
1 1 0 0 1 0
0 1 1 0 0 1
1 0 1 0 0 0
x2 x3
x1 x6
x4 x5
este matricea T tij , i, j 1,2,..., n , definită prin:
1,dacă există în graf un drum de la xi la x j
tij
0,dacă nu există în graf un drum de la xi la x j
15
Dacă matricea booleană A asociată unui graf G determină în mod unic graful,
aceeaşi matrice conexă terminală T poate fi ataşată la mai multe grafuri diferite.
0 1 1 0 0 0
0 0 1 0 0 0
0 0 0 0 0 0
Conform definiţiei T =
1 1 1 0 1 1
1 1 1 0 0 1
1 1 1 0 0 0
n (n 1) 6 5
Avem conform teoremei lui Chen 15 , deci există un drum
2 2
hamiltonian. Pentru a-l determina urmăm paşii:
x1 x2 x3 x4 x5 x6 P ( xi )
0 1 1 0 0 0 2
0 0 1 0 0 0 1
T= 0 0 0 0 0 0 0
1 1 1 0 1 1 5
1 1 1 0 0 1 4
1 1 1 0 0 0 3
x1 x2 x3 x4 x5 x6
1 1 1 0 1 1
1 1 1 0 0 1
T’ = 1 1 1 0 0 0
0 1 1 0 0 0
0 0 1 0 0 0
0 0 0 0 0 0
16
x4 x5 x6 x1 x2 x3
0 1 1 1 1 1
0 0 1 1 1 1
0 0 0 1 1 1
T’ =
0 0 0 0 1 1
0 0 0 0 0 1
0 0 0 0 0 0
17
Problema nr. 3
Într-o hală a unei întreprinderi industriale procesul de producţie se desfăşoară la 6
puncte de lucru legate printr-un sistem de benzi rulante. Fiecare punct de lucru execută
câte o anumită operaţie. Întreprinderea asimilează la un moment dat un produs nou care
trebuie să treacă prin toate cele 6 operaţii, deci pe la toate punctele de lucru. Matricea
booleană asociată grafului sistemului de transport cu benzi rulante dintre cele 6 puncte de
lucru este:
0 0 0 0 0 0
1 0 1 0 0 1
1 0 0 1 1 1
A ;
0 0 0 0 1 0
0 0 0 0 0 0
0 0 0 1 0 0
x2 x3
x6
x1
x4 x5
este matricea T tij , i, j 1,2,..., n , definită prin:
18
1,dacă există în graf un drum de la xi la x j
tij
0,dacă nu există în graf un drum de la xi la x j
Dacă matricea booleană A asociată unui graf G determină în mod unic graful,
aceeaşi matrice conexă terminală T poate fi ataşată la mai multe grafuri diferite.
0 0 0 0 0 0
1 0 1 1 1 1
1 0 0 1 1 1
Conform definiţiei T =
0 0 0 0 1 0
0 0 0 0 0 0
0 0 0 1 1 0
0 0 0 0 0 0
1 0 1 1 1 1
1 0 0 1 1 1
T=
1 0 0 0 1 0
1 0 0 0 0 0
1 0 0 1 1 0
Conform teoremei lui Chen numărul de elemente nenule din noua matrice T este:
15.
Numărul de vârfuri al grafului este 6.
n (n 1) 6 5
Avem 15 , deci în graf există acum un drum hamiltonian.
2 2
Pentru a-l determina urmăm paşii:
Pasul 1) Se calculează puterile de atingere ale vârfurilor grafului însumând (sau
numărând) elementele nenule de pe liniile corespunzătoare matricei T, astfel:
19
x1 x2 x3 x4 x5 x6 P ( xi )
0 0 0 0 0 0 0
1 0 1 1 1 1 5
1 0 0 1 1 1 4
T=
1 0 0 0 1 0 2
1 0 0 0 0 0 1
1 0 0 1 1 0 3
20
Probleme Modulul 3
a) Teste de autoevaluare
Problema nr. 1
Într-o întreprindere există 7 secţii între care se face permanent un schimb de
produse sub diferite forme (componente, subansamble, ansamble, etc.). Posibilităţile de
transport între cele 7 secţii sunt reprezentate printr-un graf cu arce valorizate cu 7 vârfuri,
având matricea conexiunilor următoare:
x1 x2 x3 x4 x5 x6 x7
0 1 0 1 0 0 0 x1
0 0 1 0 0 1 0 x2
1 0 0 0 1 1 1 x3
A .
1 0 1 0 1 0 0 x4
0 0 0 0 0 1 1 x5
0 1 0 0 0 0 1 x6
0 0 0 0 1 0 0 x7
x1 x2 x3 x4 x5 x6 x7
0 3 6 x1
0 2 4 x2
3 0 5 1 4 x3
C .
1 1 0 4 x4
0 3 2 x5
2 0 2 x6
1 0 x7
21
1) Cunoscând matricea conexiunilor A şi matricea valorilor arcelor C, obţinem
următoarea reprezentare sagitală:
x1 x2 x3 x4 x5 x6 x7 x1 x2 x3 x4 x5 x6 x7
0 1 0 1 0 0 0 x1 0 3 6 x1
0 0 1 0 0 1 0 x2 0 2 4 x2
1 0 0 0 1 1 1 x3 3 0 5 1 4 x3
A C
1 0 1 0 1 0 0 x4 1 1 0 4 x4
0 0 0 0 0 1 1 x5 0 3 2 x5
0 1 0 0 0 0 1 x6 x1 2 0 2 x6
0 0 0 0 1 0 0 x7 1 0 x7
2
x3 1
x2
x4
1
3 6
4
3
x1 5
1 x7
2
4
4 1
2
x5
3 x6
2
3) Cum trebuie organizat transportul între oricare dintre cele 7 secţii ale
întreprinderii, astfel încât timpul total de transport să fie minim ?
22
x1 x2 x3 x4 x5 x6 x7
0 3 6 x1
0 2 4 x2
C C = 3 0 5 1 4 x3
1
1 1 0 4 x4
0 3 2 x5
2 0 2 x6
1 0 x7
C = C C
2
x1 x2 x3 x4 x5 x6 x7 x1 x2 x3 x4 x5 x6 x7
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4 2 4 x4
10 5 7 16 0 3 2 x5
7 2 4 13 3 0 2 x6
11 6 8 17 1 4 0 x7
C = C C
16 8 8
x1 x2 x3 x4 x5 x6 x7 x1 x2 x3 x4 x5 x6 x7
0 3 x1
5 6 9 6 8 x1 0 3 5 6 9 6 8
5 0 2 11 6 3 5 x2 5 0 2 11 6 3 5 x2
3 3 0 9 4 1 3 x3 3 3 0 9 4 1 3 x3
16
x4 1 4 x4
C 1 4 1 0 4 2 4
1 0 4 2 4
10 5 7 16 0 3 2 x5 10 5 7 16 0 3 2 x5
7 2 x6
4 13 3 0 2 x6 7 2 4 13 3 0 2
x7 11 6 8 17 1 4 0 x7
11 6 8 17 1 4 0
x1 x2 x3 x4 x5 x6 x7
0 3 5 6 9 6 8 x1
5 0 2 11 6 3 5 x2
16 3 3 0 9 4 1 3 x3
C C
8
1 4 1 0 4 2 4 x4
10 5 7 16 0 3 2 x5
7 2 4 13 3 0 2 x6
11 6 8 17 1 4 0 x7
25
Dacă pe drumul optim vârful xi este succesorul lui x1 , atunci indicele i se va
determina din relaţia:
c1i vi5 v15 9 .
Rezultă i 2 .
Analog, din aproape în aproape, se obţine drumul de valoare minimă între x1 şi
x5 ca fiind x1, x2 , x3 , x6 , x7 , x5 .
x1 x2 x3 x4 x5 x6 x7
0 3 6 x1
0 2 2 x2
C C = 3 0 5 1 4 x3
1
1 1 0 4 x4
0 3 2 x5
2 0 2 x6
1 0 x7
C = C C
2
x1 x2 x3 x4 x5 x6 x7 x1 x2 x3 x4 x5 x6 x7
0 3 6 x1 0 3 6 x1
0 2 2 x2 0 2 2 x2
3 0 5 1 4 x3 3 0 5 1 4 x3
2
C =
1 1 0 4 x4 1 1 0 4 x4
0 3 2 x5 0 3 2 x5
2 0 2 x6 2 0 2 x6
1 0 x7 1 0 x7
26
x1 x2 x3 x4 x5 x6 x7
0 3 5 6 10 5 x1
5 0 2 7 2 4 x2
3 3 0 9 5 1 3 x3
C =
2
1 4 1 0 4 2 5 x4
5 0 3 2 x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3 2 x5
7 2 4 13 9 0 8 x6
11 6 8 17 1 4 0 x7
32
b) Tema de control
Problema nr. 1
O companie de transport mărfuri trebuie să efectueze transportul unor produse între
şapte puncte economice notate cu x1, x2 ,..., x7 , acestea fiind întreprinderi, depozite,
magazine de desfacere, etc. Reţeaua de transport este un graf cu 7 vârfuri, x1, x2 ,..., x7 şi
având matricele A a conexiunilor, respectiv C a valorilor arcelor, următoare:
x1 x2 x3 x4 x5 x6 x7
0 1 0 0 1 1 1 x1
0 0 1 1 0 0 0 x2
1 0 0 1 0 0 0 x3
A ;
0 1 0 0 0 1 0 x4
0 0 1 1 0 1 0 x5
1 0 1 0 1 0 0 x6
1 0 0 1 0 1 0 x7
x1 x2 x3 x4 x5 x6 x7
0 3 3 2 1 x1
0 2 4 x2
3 0 2 x3
C .
4 0 2 x4
3 4 0 2 x5
2 3 2 0 x6
1 3 2 0 x7
Valoarea arcului xi , x j reprezintă valoarea cheltuielilor de transport pe unitatea
de produs între vârfurile xi şi x j ale reţelei formate din cele 7 puncte economice.
33
1) Reprezentarea sagitală a grafului este următoarea:
x3 x7
1
1
3 3
2
3
3 x6
x1 2
3 2 2 2
2 2
3
x1 2 x5
4
x2 4 x4
x1 x2 x3 x4 x5 x6 x7
0 3 3 2 1 x1
0 2 4 x2
3 0 2 x3
C C
1
4 0 2 x4
3 4 0 2 x5
2 3 2 0 x6
1 3 2 0 x7
34
C = C C
2 1 1
x1 x2 x3 x4 x5 x6 x7 x1 x2 x3 x4 x5 x6 x7
0 3 3 2 1 x1 0 3 3 2 1 x1
0 2 4 x2 0 2 4 x2
3 0 2 x3 3 0 2 x3
C
2
4 0 2 x4 4 0 2 x4
3 4 0 2 x5 3 4 0 2 x5
2 3 2 0 x6 2 3 2 0 x6
1 3 2 0 x7 1 3 2 0 x7
x1 x2 x3 x4 x5 x6 x7
0 3 5 4 3 2 1 x1
5 0 2 4 6 x2
3 6 0 2 6 4 4 x3
4 4 5 0 4 2 x4
4 8 3 4 0 2 x5
2 5 3 5 2 0 3 x6
1 4 5 3 4 2 0 x7
C = C C
4 2 2
x1 x2 x3 x4 x5 x6 x7 x1 x2 x3 x4 x5 x6 x7
0 3 5 4 3 2 1 x1 0 3 5 4 3 2 1 x1
5 0 2 4 6 x2 5 0 2 4 6 x2
3 6 0 2 6 4 4 x3 3 6 0 2 6 4 4 x3
C
4
4 4 5 0 4 2 x4 4 4 5 0 4 2 x4
4 8 3 4 0 2 x5 4 8 3 4 0 2 x5
2 5 3 5 2 0 3 x6 2 5 3 5 2 0 3 x6
1 4 5 3 4 2 0 x7 1 4 5 3 4 2 0 x7
35
x1 x2 x3 x4 x5 x6 x7
0 3 5 4 3 2 1 x1
5 0 2 4 8 6 6 x2
3 6 0 2 6 4 4 x3
4 4 5 0 4 2 5 x4
4 7 3 4 0 2 5 x5
2 5 3 5 2 0 3 x6
1 4 5 3 4 2 0 x7
C = C C
8 4 4
x1 x2 x3 x4 x5 x6 x7 x1 x2 x3 x4 x5 x6 x7
0 3 5 4 3 2 1 x1 0 3 5 4 3 2 1 x1
5 0 2 4 8 6 6 x2 5 0 2 4 8 6 6 x2
3 6 0 2 6 4 4 x3 3 6 0 2 6 4 4 x3
C
8
4 4 5 0 4 2 5 x4 4 4 5 0 4 2 5 x4
4 7 3 4 0 2 5 x5 4 7 3 4 0 2 5 x5
2 5 3 5 2 0 3 x6 2 5 3 5 2 0 3 x6
1 4 5 3 4 2 0 x7 1 4 5 3 4 2 0 x7
x1 x2 x3 x4 x5 x6 x7
0 3 5 4 3 2 1 x1
5 0 2 4 8 6 6 x2
3 6 0 2 6 4 4 x3
C 4
4 4 5 0 4 2 5 x4
4 7 3 4 0 2 5 x5
2 5 3 5 2 0 3 x6
1 4 5 3 4 2 0 x7
36
3) Să se determine modificările soluţiei problemei de transport de la punctul 2) în
ipoteza că nu mai poate fi utilizată legătura de la punctul x1 la punctul x6 .
x1 x2 x3 x4 x5 x6 x7
0 3 3 1 x1
0 2 4 x2
3 0 2 x3
C C
1
4 0 2 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 0 3 x6 2 5 3 5 2 0 3 x6
1 4 5 3 4 2 0 x7 1 4 5 3 4 2 0 x7
38
x1 x2 x3 x4 x5 x6 x7
0 3 5 4 3 3 1 x1
5 0 2 4 8 6 6 x2
C
3 6 0 2 6 4 4 x3 4
4 4 5 0 4 2 5 x4
4 7 3 4 0 2 5 x5
2 5 3 5 2 0 3 x6
1 4 5 3 4 2 0 x7
39
Problema nr. 3
Între opt puncte de lucru ale unui sistem economic există o reţea de transport al
cărui graf este dat prin matricea A a conexiunilor dintre vârfurile x1, x2 ,..., x8 ale sale,
unde:
x1 x2 x3 x4 x5 x6 x7 x8
0 1 0 0 0 1 0 1 x1
0 0 1 0 1 0 0 0 x2
0 0 0 1 0 0 0 0 x3
A 0 0 0 0 0 1 0 1 x4 .
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
Valorile asociate fiecărui arc xi , x j reprezintă cheltuielile de transport
corespunzătoare, pe unitatea de produs transportată, de la punctul xi la punctul x j al
reţelei. Matricea valorilor arcelor grafului este următoarea:
x1 x2 x3 x4 x5 x6 x7 x8
0 3 2 1 x1
0 5 3 x2
0 3 x3
C 0 3 2 x4 .
3 4 0 x5
6 0 2 x6
4 2 2 0 x7
2 3 0 x8
40
1) Reprezentarea sagitală a grafului este:
x3
x2 5 3 x4
2 2
3 3
3 2
2
4 2
x1
1 x8
2
4 3
3
6 2
x5 x6 x7
41
În cazul de faţă avem:
x1 x2 x3 x4 x5 x6 x7 x8
0 1 0 0 0 1 0 1 x1
0 0 1 0 1 0 0 0 x2
0 0 0 1 0 0 0 0 x3
T0 0 0 0 0 1 0 1 x4
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
x1 x2 x3 x4 x5 x6 x7 x8
0 1 1 0 1 1 1 1 x1
0 0 1 0 1 0 0 0 x2
0 0 0 1 0 0 0 0 x3
T0 0 0 0 0 1 0 1 x4
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
0 0 1 0 1 0 0 0 x2
0 0 0 1 0 0 0 0 x3
T0 0 0 0 0 1 0 1 x4
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
0 0 0 1 0 0 0 0 x3
T0 0 0 0 0 1 0 1 x4
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
0 0 0 1 0 1 0 1 x3
T0 0 0 0 0 1 0 1 x4
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
S-au generat noi elemente nenule pe linia 3. Adunăm boolean liniile L3 L6 L8.
43
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
0 1 0 1 1 1 1 1 x3
T0 0 0 0 0 1 0 1 x4
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
Aşa cum se observă mai sus s-au generat elemente noi nenule pe linia 3.
Continuăm adunând boolean liniile L L L L şi obţinem următoarea matrice:
3 2 5 7
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
1 1 1 1 1 1 1 1 x3
T0 0 0 0 0 1 0 1 x4
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
Nu se mai pot genera elemente noi diferite de zero pe linia 3. Continuăm cu linia 4,
adunând boolean liniile L4 L6 L8.
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
1 1 1 1 1 1 1 1 x3
T0 1 0 0 1 1 1 1 x4 .
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
44
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
1 1 1 1 1 1 1 1 x3
T1 1 1 1 1 1 1 1 x4
1 0 0 1 0 0 0 0 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
1 1 1 1 1 1 1 1 x3
T1 1 1 1 1 1 1 1 x4
1 1 1 1 1 1 1 1 x5
0 0 0 0 1 0 1 0 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
1 1 1 1 1 1 1 1 x3
T1 1 1 1 1 1 1 1 x4
1 1 1 1 1 1 1 1 x5
1 1 1 1 1 1 1 1 x6
1 1 0 1 0 0 0 0 x7
0 1 0 0 0 0 1 0 x8
45
Nu mai pot fi generate alte elemente nenule pe linia 6 şi continuăm cu linia 7,
adunând boolean liniile L7 L1 L2 L4 .
Obţinem:
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
1 1 1 1 1 1 1 1 x3
T1 1 1 1 1 1 1 1 x4
1 1 1 1 1 1 1 1 x5
1 1 1 1 1 1 1 1 x6
1 1 1 1 1 1 1 1 x7
0 1 0 0 0 0 1 0 x8
x1 x2 x3 x4 x5 x6 x7 x8
1 1 1 1 1 1 1 1 x1
1 1 1 1 1 1 1 1 x2
1 1 1 1 1 1 1 1 x3
T1 1 1 1 1 1 1 1 x4
1 1 1 1 1 1 1 1 x5
1 1 1 1 1 1 1 1 x6
1 1 1 1 1 1 1 1 x7
1 1 1 1 1 1 1 1 x8
4) Să se determine cum trebuie organizat transportul între oricare două puncte ale
sistemului, astfel încât costul total de transport între aceste puncte să fie minim.
46
Trebuie în acest caz să determinăm matricea valorilor minime.
Matricea C a valorilor drumurilor dintre oricare două vârfuri xi şi x j , i, j 1,2,...,8 ,
este următoarea:
x1 x2 x3 x4 x5 x6 x7 x8
0 3 2 1 x1
0 5 3 x2
0 3 x3
C C
1
0 3 2 x4
3 4 0 x5
6 0 2 x6
4 2 2 0 x7
2 3 0 x8
C C C ;
4 2 2
C C C ;
8 4 4
…………………………..
x1 x2 x3 x4 x5 x6 x7 x8 x1 x2 x3 x4 x5 x6 x7 x8
0 3 2 1 x1 0 3 2 1 x1
0 5 3 x2 0 5 3 x2
0 3 x3 0 3 x3
C
2
0 3 2 x4 0 3 2 x4
3 4 0 x5 3 4 0 x5
6 0 2 x6 6 0 2 x6
4 2 2 0 x7 4 2 2 0 x7
2 3 0 x8 2 3 0 x8
47
x1 x2 x3 x4 x5 x6 x7 x8
0 3 8 6 2 4 1 x1
6 0 5 7 3 x2
0 3 6 5 x3
2
C 4 0 9 3 5 2 x4
3 6 4 0 5 4 x5
6 4 4 6 0 2 4 x6
4 2 7 2 5 5 0 4 x7
7 2 7 5 5 3 0 x8
x1 x2 x3 x4 x5 x6 x7 x8 x1 x2 x3 x4 x5 x6 x7 x8
0 3 8 6 2 4 1 x1 0 3 8 6 2 4 1 x1
6 0 5 7 3 x2 6 0 5 7 3 x2
0 3 6 5 x3 0 3 6 5 x3
4
C
4 0 9 3 5 2 x4 4 0 9 3 5 2 x4
3 6 4 0 5 4 x5 3 6 4 0 5 4 x5
6 4 4 6 0 2 4 x6 6 4 4 6 0 2 4 x6
4 2 7 2 5 5 0 4 x7 4 2 7 2 5 5 0 4 x7
7 2 7 5 5 3 0 x8 7 2 7 5 5 3 0 x8
x1 x2 x3 x4 x5 x6 x7 x8
0 3 8 6 6 2 4 1 x1
6 0 5 7 3 8 10 7 x2
12 7 0 3 10 6 8 5 x3
C 9 4 9 0 7 3 5
4
2 x4
3 6 11 4 0 5 7 4 x5
6 4 9 4 6 0 2 4 x6
4 2 7 2 5 5 0 4 x7
7 2 7 5 5 8 3 0 x8
48
x1 x2 x3 x4 x5 x6 x7 x8 x1 x2 x3 x4 x5 x6 x7 x8
0 3 8 6 6 2 4 1 x1 0 3 8 6 6 2 4 1 x1
6 0 5 7 3 8 10 7 x2 6 0 5 7 3 8 10 7 x2
12 7 0 3 10 6 8 5 x3 12 7 0 3 10 6 8 5 x3
C 9 4 9 0 7 3 5 9 4 9 0 7 3 5
8
2 x4 2 x4
3 6 11 4 0 5 7 4 x5 3 6 11 4 0 5 7 4 x5
6 4 9 4 6 0 2 4 x6 6 4 9 4 6 0 2 4 x6
4 2 7 2 5 5 0 4 x7 4 2 7 2 5 5 0 4 x7
7 2 7 5 5 8 3 0 x8 7 2 7 5 5 8 3 0 x8
x1 x2 x3 x4 x5 x6 x7 x8
0 3 8 6 6 2 4 1 x1
6 0 5 7 3 8 10 7 x2
12 7 0 3 10 6 8 5 x3
C 9 4 9 0 7 3 5 2 x4 C
8 4
3 6 11 4 0 5 7 4 x5
6 4 9 4 6 0 2 4 x6
4 2 7 2 5 5 0 4 x7
7 2 7 5 5 8 3 0 x8
Se constată că pentru k 8 s-a obţinut C
8 C 4 , deci s-a realizat condiţia de
8
oprire a algoritmului matriceal. Matricea C C
4 este matricea valorilor minime
(optime) ale drumurilor de la orice vârf xi la orice vârf x j al grafului, i, j 1,2,...,8 .
x1 x2 x3 x4 x5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