$B%5%s%W%kL>(B | SAMPLE A $B edge[8][8]=
|
{{0,1,0,0,1,0,0,0}, | {1,0,0,0,0,0,1,0}, {0,0,0,1,0,0,1,0}, {0,0,1,0,0,0,0,1}, {1,0,0,0,0,1,0,0}, {0,0,0,0,1,0,1,0}, {0,1,1,0,0,1,0,1}, {0,0,0,1,0,0,1,0}}
{{0,1,0,0,1,0,1,0}, | {1,0,1,0,1,1,0,0}, {0,1,0,1,0,0,1,0}, {0,0,1,0,0,0,0,0}, {1,1,0,0,0,0,0,0}, {0,1,0,0,0,0,0,0}, {1,0,1,0,0,0,0,1}, {0,0,0,0,0,0,1,0}} $B=PNONc(B | $B!J$3$NDL$j$G$"$kI,MW$OA4$/$J$$!K(B
0 -> 1 -> 6 -> 2 -> 3 -> 7 | (6)-> 5 -> 4
0 -> 1 -> 2 -> 3 | (2)-> 6 -> 7 (1)-> 4 (1)-> 5 |
SAMPLE | weight matrix | cost[i,j] | div[i,j] | $B7PO)I=<(Nc(B | |||||
A (N=6) | #define NC 999999 // Infinitely big number int w[N][N] = { { 0, NC, NC, 8, 15, NC}, { 10, 0, 24, NC, 8, NC}, { NC, NC, 0, NC, NC, 6}, { NC, NC, NC, 0, 5, NC}, { NC, NC, 12, NC, 0, 7}, { NC, NC, 3, NC, NC, 0}}; | * - 23 8 13 20 10 * 18 18 8 15 - - * - - 6 - - 15 * 5 12 - - 10 - * 7 - - 3 - - * | 0 -1 5 0 3 4 1 1 5 0 1 4 -1 -1 2 -1 -1 2 -1 -1 5 3 3 4 -1 -1 5 -1 4 4 -1 -1 5 -1 -1 5 | 0 => 1 [--] 0 => 2 [23] 0 3 4 5 2 0 => 3 [ 8] 0 3 0 => 4 [13] 0 3 4 0 => 5 [20] 0 3 4 5 1 => 0 [10] 1 0 1 => 2 [18] 1 4 5 2 $B!J0J2 |
SAMPLE | weight matrix | cost[i,j] | div[i,j] | $B7PO)I=<(Nc(B |
A (N=6) | #define NC 0.0 float w[N][N] = { { 1.00, NC, NC, 0.08, 0.15, NC}, { 0.10, 1.00, 0.24, NC, 0.80, NC}, { NC, NC, 1.00, NC, NC, 0.60}, { NC, NC, NC, 1.00, 0.50, NC}, { NC, NC, 0.12, NC, 1.00, 0.70}, { NC, NC, 0.30, NC, NC, 1.00}}; | ****** ------ 0.0315 0.0800 0.1500 0.1050 0.1000 ****** 0.2400 0.0080 0.8000 0.5600 ------ ------ ****** ------ ------ 0.6000 ------ ------ 0.1050 ****** 0.5000 0.3500 ------ ------ 0.2100 ------ ****** 0.7000 ------ ------ 0.3000 ------ ------ ****** | 0 -1 5 0 0 4 1 1 1 0 1 4 -1 -1 2 -1 -1 2 -1 -1 5 3 3 4 -1 -1 5 -1 4 4 -1 -1 5 -1 -1 5 | 0 => 1 [------] 0 => 2 [0.0315] 0 4 5 2 0 => 3 [0.0800] 0 3 0 => 4 [0.1500] 0 4 0 => 5 [0.1050] 0 4 5 1 => 0 [0.1000] 1 0 1 => 2 [0.2400] 1 2 1 => 3 [0.0080] 1 0 3 $B!J0J2 |
$B2]Bj#4!'(B
$B9TNs$N>h;;2s?t$N:G>.2=$r9T$$!"$=$N1i;;2aDx$r<($;!JI,=$!K(B
$B!Z(B
$B#2#0#0#4G/EY%7%i%P%9$N%3%T!<(B(PDF)$B![(B
$B>h;;=g=x$NI=<($O!"(B((A(BC))((DE)F))$B!"$^$?$O(B
((1(23))((45)6))$B$N$h$&$K$9$k$3$H!#$?$@$7!"$3$N$h$&$K3g8L(B
$B$GI=8=$9$k$3$H$,:$Fq$G$"$l$P!"1i;;=g=x$,2?$i$+$N7A$GJ,$+(B
$B$k$h$&$K=PNO$9$k$h$&$K$7$F$b$h$$!#(B
$B:n@.$7$?%W%m%0%i%`$KN as[...]
Amount
Operation
6 30, 35, 15, 5, 10, 20, 25
15125
((A(BC))((DE)F))
7 20, 15, 30, 5, 300, 80, 21, 18
135840
((A(BC))(((DE)F)G))
11 20, 22, 31, 800, 15, 1700, 50, 20, 11, 2, 30, 400
339284
((A(B(C(D(E(F(G(HI))))))))(JK))
18 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11, 2, 11
694
(A(((BC)((DE)((FG)((HI)((JK)((LM)((NO)(PQ))))))))R))
$B!Z=PBj![(B2004/06/22(Tue)
$B!ZDy@Z![(B2004/07/02(Fri),17:00 JST ($BE~CeI,?\(B)
$B!ZBjL\![2<5-;2>H(B
$B!Z7oL>(B:Subject$B![(BAlgorithm Report 5.1
$B?<$5M%@hC5:w%"%k%4%j%:%`$r$b$H$K$7$F!"=d2s%;!<%k%9%^%sLd(B
$BBj$r2r$/%W%m%0%i%`$r:n@.$;$h!#(B
$B!Z7oL>(B:Subject$B![(BAlgorithm Report 5.2
$B:G>.%3%9%H%9%Q%K%s%0LZ$rMxMQ$7$?#26a;w%"%k%4%j%:%`$K$h$k(B
$B%W%m%0%i%`$r:n@.$;$h!#(B
$BC10L
12-15$BD:E@$K$h$k40A4%0%i%U$NNc$r5s$2$F$*$-$^$9!#(B
14$BD:E@0J>e$K$D$$$F$O!";X?t;~4V%W%m%0%i%`$N$[$&$N$B2]Bj(B5.1/5.2$BN>MQ(B SAMPLE_A
#define N 12
int w[N][N] = {
A B C D E F G H I J K L
A { 0, 205, 241, 32, 253, 27, 89, 280, 163, 189, 105, 130 },
B { 205, 0, 144, 16, 212, 133, 101, 272, 52, 295, 120, 67 },
C { 241, 144, 0, 295, 30, 156, 42, 192, 259, 224, 126, 166 },
D { 32, 16, 295, 0, 283, 180, 43, 186, 195, 180, 30, 59 },
E { 253, 212, 30, 283, 0, 162, 96, 191, 90, 168, 3, 156 },
F { 27, 133, 156, 180, 162, 0, 164, 152, 174, 207, 226, 235 },
G { 89, 101, 42, 43, 96, 164, 0, 55, 160, 86, 158, 200 },
H { 280, 272, 192, 186, 191, 152, 55, 0, 114, 249, 292, 8 },
I { 163, 52, 259, 195, 90, 174, 160, 114, 0, 295, 241, 246 },
J { 189, 295, 224, 180, 168, 207, 86, 249, 295, 0, 209, 234 },
K { 105, 120, 126, 30, 3, 226, 158, 292, 241, 209, 0, 37 },
L { 130, 67, 166, 59, 156, 235, 200, 8, 246, 234, 37, 0 }
};
$B2]Bj(B5.1/5.2$BN>MQ(B SAMPLE_12
#define N 12
int w[N][N] = {
{ 0, 122, 73, 54, 50, 140, 130, 100, 36, 85, 139, 73 },
{ 122, 0, 50, 70, 108, 28, 14, 89, 100, 100, 32, 166 },
{ 73, 50, 0, 20, 72, 73, 61, 81, 51, 81, 67, 127 },
{ 54, 70, 20, 0, 63, 92, 81, 85, 32, 81, 85, 114 },
{ 50, 108, 72, 63, 0, 117, 112, 54, 71, 36, 135, 58 },
{ 140, 28, 73, 92, 117, 0, 14, 85, 124, 100, 51, 175 },
{ 130, 14, 61, 81, 112, 14, 0, 86, 112, 99, 40, 170 },
{ 100, 89, 81, 85, 54, 85, 86, 0, 108, 20, 121, 100 },
{ 36, 100, 51, 32, 71, 124, 112, 108, 0, 98, 112, 108 },
{ 85, 100, 81, 81, 36, 100, 99, 20, 98, 0, 130, 81 },
{ 139, 32, 67, 85, 135, 51, 40, 121, 112, 130, 0, 192 },
{ 73, 166, 127, 114, 58, 175, 170, 100, 108, 81, 192, 0 }
};
$B2]Bj(B5.1/5.2$BN>MQ(B SAMPLE_13
#define N 13
int w[N][N] = {
{ 0, 120, 136, 91, 22, 32, 42, 104, 110, 108, 128, 120, 81 },
{ 120, 0, 91, 36, 130, 136, 98, 127, 10, 197, 92, 89, 100 },
{ 136, 91, 0, 73, 156, 130, 94, 197, 90, 240, 10, 173, 166 },
{ 91, 36, 73, 0, 104, 102, 63, 125, 28, 180, 71, 100, 94 },
{ 22, 130, 156, 104, 0, 50, 64, 89, 120, 86, 149, 114, 71 },
{ 32, 136, 130, 102, 50, 0, 40, 136, 126, 130, 121, 150, 112 },
{ 42, 98, 94, 63, 64, 40, 0, 130, 89, 150, 86, 130, 100 },
{ 104, 127, 197, 125, 89, 136, 130, 0, 120, 91, 193, 51, 32 },
{ 110, 10, 90, 28, 120, 126, 89, 120, 0, 188, 91, 85, 92 },
{ 108, 197, 240, 180, 86, 130, 150, 91, 188, 0, 233, 140, 102 },
{ 128, 92, 10, 71, 149, 121, 86, 193, 91, 233, 0, 171, 162 },
{ 120, 89, 173, 100, 114, 150, 130, 51, 85, 140, 171, 0, 45 },
{ 81, 100, 166, 94, 71, 112, 100, 32, 92, 102, 162, 45, 0 }
};
$B2]Bj(B5.1/5.2$BN>MQ(B SAMPLE_14
#define N 14
int w[N][N] = {
{ 0, 73, 156, 130, 94, 197, 90, 240, 10, 173, 166, 175, 227, 234 },
{ 73, 0, 104, 102, 63, 125, 28, 180, 71, 100, 94, 140, 170, 170 },
{ 156, 104, 0, 50, 64, 89, 120, 86, 149, 114, 71, 50, 71, 85 },
{ 130, 102, 50, 0, 40, 136, 126, 130, 121, 150, 112, 45, 112, 133 },
{ 94, 63, 64, 40, 0, 130, 89, 150, 86, 130, 100, 82, 135, 148 },
{ 197, 125, 89, 136, 130, 0, 120, 91, 193, 51, 32, 136, 95, 70 },
{ 90, 28, 120, 126, 89, 120, 0, 188, 91, 85, 92, 161, 180, 175 },
{ 240, 180, 86, 130, 150, 91, 188, 0, 233, 140, 102, 100, 20, 22 },
{ 10, 71, 149, 121, 86, 193, 91, 233, 0, 171, 162, 166, 219, 228 },
{ 173, 100, 114, 150, 130, 51, 85, 140, 171, 0, 45, 164, 141, 120 },
{ 166, 94, 71, 112, 100, 32, 92, 102, 162, 45, 0, 120, 100, 85 },
{ 175, 140, 50, 45, 82, 136, 161, 100, 166, 164, 120, 0, 81, 110 },
{ 227, 170, 71, 112, 135, 95, 180, 20, 219, 141, 100, 81, 0, 36 },
{ 234, 170, 85, 133, 148, 70, 175, 22, 228, 120, 85, 110, 36, 0 }
};
$B2]Bj(B5.1/5.2$BN>MQ(B SAMPLE_15
#define N 15
int w[N][N] = {
{ 0, 50, 64, 89, 120, 86, 149, 114, 71, 50, 71, 85, 22, 73, 86 },
{ 50, 0, 40, 136, 126, 130, 121, 150, 112, 45, 112, 133, 63, 76, 54 },
{ 64, 40, 0, 130, 89, 150, 86, 130, 100, 82, 135, 148, 63, 42, 92 },
{ 89, 136, 130, 0, 120, 91, 193, 51, 32, 136, 95, 70, 73, 104, 175 },
{ 120, 126, 89, 120, 0, 188, 91, 85, 92, 161, 180, 175, 102, 51, 180 },
{ 86, 130, 150, 91, 188, 0, 233, 140, 102, 100, 20, 22, 92, 150, 140 },
{ 149, 121, 86, 193, 91, 233, 0, 171, 162, 166, 219, 228, 142, 89, 163 },
{ 114, 150, 130, 51, 85, 140, 171, 0, 45, 164, 141, 120, 92, 92, 198 },
{ 71, 112, 100, 32, 92, 102, 162, 45, 0, 120, 100, 85, 50, 73, 156 },
{ 50, 45, 82, 136, 161, 100, 166, 164, 120, 0, 81, 110, 72, 110, 41 },
{ 71, 112, 135, 95, 180, 20, 219, 141, 100, 81, 0, 36, 81, 139, 120 },
{ 85, 133, 148, 70, 175, 22, 228, 120, 85, 110, 36, 0, 86, 141, 151 },
{ 22, 63, 63, 73, 102, 92, 142, 92, 50, 72, 81, 86, 0, 58, 106 },
{ 73, 76, 42, 104, 51, 150, 89, 92, 73, 110, 139, 141, 58, 0, 130 },
{ 86, 54, 92, 175, 180, 140, 163, 198, 156, 41, 120, 151, 106, 130, 0 }
};
$B
$B9pCN(B
$B2]Bj$=$N$b$N$KD>@\$*Ez$($O$G$-$^$;$s$,!"2]BjDs=P$K4X$o$k#C8@8l(B
$B$N%W%m%0%i%_%s%0AjCL$r!"ITDj4|$J$,$i3+:E$7$^$9!#(BTA$B$,AjCL$K$N$j$^$9!#(B
$B;~4V8BDj$G$9$N$GCm0U$7$F$/$@$5$$!#(B
$B4uK>
$B!!!!>l=j!'(B3L302$B!JI,MW$,$"$l$P(B5L502$B$K0\F0$9$k$3$H$b$"$j$^$9!K(B
$B!!!!#T#A!'@>:j!JM}9)3X8&5f2J#1G/!KC4EvM=Dj(B
$B!!!!>l=j!'(B3L302$B!JI,MW$,$"$l$P(B5L502$B$K0\F0$9$k$3$H$b$"$j$^$9!K(B
$B!!!!#T#A!';3K\!J%7%9%F%`>pJs3X8&5f2J#1G/!KC4EvM=Dj(B
$B
2004/08/16$B8=:_!#(B
$B2JL\HV9f(B/$BCNE*9)3X(B 3206/S513111
$B2JL\HV9f(B/$B5!G=9)3X(B 3240/S613111
$B1QL>(B Data Structure and Algorithm
$BC4Ev6541(B $B55EDG=@.(B
$B8&5f<<(B 3M304
$BEEOC(B 5256
Office Hour Weekday 10:00-18:00
e-mail [email protected]
$B4XO"2JL\(B $B7W;;5!=xO@(BII(S511024/S611024)
$B%W%m%0%i%_%s%0=xO@(B(S511034/S611034)
$B%0%i%UM}O@(B(S512041/S612041)
$B
<[email protected]>