• Tidak ada hasil yang ditemukan

A Simple Example

5.2 The Chinese Generals Problem

5.2.1 A Simple Example

Before proceeding to the next subsection for a full analysis of the CGP, recall that the definition includes the number of generalsS, their valencyγ, the initial conditionK(0) of the number of generals deciding on A1, and the two tunable parameters M andT denoting the number of messengers dispatched and the corresponding threshold value, respectively.

A B

C

FIGURE5.8 Three generals

In this section, we analyze a simple example of a CGP where we use fixed values of S=3,γ=1,M =2, andT =2. The problem involves three generals labeledA,B, and C, linked in a simple triangular network shown in Figure5.8above. First, att =0 each general can be either inG1(0) or not, depending on the value of its messagevi(0). There- fore, we have a total of eight possible message configurations as shown in Figure5.9.

For each of these configurations, the general withvi(0)=1 can dispatch two messen- gers each. With equal probability each messenger can then either go to the neighboring general in the clockwise direction, or stay withGi.

FIGURE5.9 Eight possible message configurations

For v(0) ={vA(0)vB(0)vC(0)}, we have eight equally likely message configurations that can be written as binary strings: {000}, {001}, {010}, {100}, {011}, {101}, {110}, and {111}. Notice that we sort the eight configurations according to the number of 1s in their strings. The reason is quite simple. The triangle in Figure 5.8is symmetrical, which means configurations having the same number of 1s in their strings should be mathe- matically identical.

Let us consider the highlighted configuration where two generals A andB, initially decide onA1and dispatch two messengers each. Although the messengers are identical, for illustration purpose, we label the messengers atA’s andB’s positions witha1,a2,b1, andb2. Let us devise a notation with two dots in which the messengers currently atA’s, B’s, andC’s positions are written before the first dot, between the dots, and after the second dot, respectively. Anoat any position indicates that there is no messenger. For the highlighted configuration, the messenger positions att=0 are denoted by:

a1a2.b1b2.o

For the highlighted message configuration shown on Figure5.9, there are 16 possi- ble ways with which the messengers can arrive at their destinations as shown in Figure

5.10below. We call each one of them a messenger configuration. Each dot represents a messenger at that particular position.

FIGURE5.10 Sixteen possible messenger configurations

With the exception of their labels, these messenger configurations are practically iden- tical to the ones produced in the cases where the message configurations have generals B andC in G1(0), or generalsC and A in G1(0). Using the same notation, all sixteen messenger configurations are listed below.

a1a2.b1b2.o a1a2.b1.b2 a1a2.b2.b1 a1a2.o.b1b2 a1.a2b1b2.o a1.a2b1.b2 a1.a2b2.b1 a1.a2.b1b2 a2.a1b1b2.o a2.a1b1.b2 a2.a1b2.b1 a2.a1.b1b2 o.a1a2b1b2.o o.a1a2b1.b2 o.a1a2b2.b1 o.a1a2.b1b2

From the above information, we can compute the message configuration at timet= 1. To determinev(t) att=1 ifv(0)={110}), first we have to compute the arrival func- tionsL(0)={LA(0),LB(0),LC(0)}that compute the number of messengers at each gen- eral at timet =0. Then we apply the threshold functionV on these messenger arrival values to obtain the value ofv(1).

First, we will remove the distinction between all messengers arriving at the same gen- eral. This is compatible with Figure5.10, where the messengers are unlabeled by their

source general. To do this, we denote the messengers currently at A’s,B’s, andC’s bya, b, andc. As a shorthand, we denoteaabya2(and likewise withb). In this notation, the dots ando’s are no longer needed and we have a more concise notation:

a2b2 a2bc a2bc a2c2 ab3 ab2c ab2c abc2 ab3 ab2c ab2c abc2 b4 b3c b3c b2c2

or, algebraically, as a multivariate polynomial where each term and its coefficient corre- sponds to a messenger configuration and its multiplicities,

F2a=b4+a2b2+b2c2+a2c2

+2a2bc+4ab2c+2abc2+2b3c+2ab3 . (5.2)

Att =0, the configuration is alwaysa2b2becauseG1(0)={A,B}. Suppose after the first round, the configuration becomesab2c.F2acontains abundant information: there are four ways to achieve this configuration, and the value ofL(0) is{degadegbdegc}, which is{121}.

FIGURE5.11 Obtaining the new message configurations from the previous messenger

configurations by applying the threshold

With a little more work, we can get even more information. By applying the threshold functionV withT =2 onL(0), we obtainv(1)={010}. An element of this string is a zero if the degree of the corresponding variable is less thanT, and a one otherwise. In Figure5.11above, the generalsGi that satisfy the conditionvi(1)=1 are marked by the grey circles.

Finally, we can also computeK(0) andK(1) by counting the numbers of ones inv(0) andv(1), which are 2 and 1, respectively. CalculatingK(t) is of interest to us because it shows the evolution ofG1(t). Of course, in reality we can only compute an average value ofK(1) because the four messengers could just as well choose configurations other than ab2c. The average is:

K(1)=

PiKi(1)

κ (5.3)

where the indexiruns over all sixteen possible configurations att=1. In the numerator summand, the functionKi(t) counts the number of ones invi(t) from a configurationi at timet. The denumeratorκis simply the total number of configurations, which in our present case is sixteen.

Having discussedG1(0)={A,B}, we can now consider the other possible member- ships ofG1(0):{∅},{A},{B},{C},{A,B},{A,C},{B,C},{A,B,C}. To do this, we need a polynomial that is more general thanF2a.

Consider the following polynomialF(a,b,c;z) (orF(z), for short). The coefficientFkof zkcaptures all the possible configurations given that|G1(0)|=k, i.e.,kgenerals initially deciding onA1. Obviously,F(z) is more general thanF2a as all the configurations inF2a

can also be found inF2.

F(z)=(1+(a+b)2z) (1+(b+c)2z) (1+(c+a)2z)

=1+F1z+F2z2+F3z3 Fk=[zk]F(z)= 1

k!

k

∂zkF(z)|z=0

F1=2ab+2bc+2ca+2a2+2b2+2c2 F2=a4+b4+c4

+2ab3+2bc3+2ca3+2a3b+2b3c+2c3a

+3a2b2+3b2c2+3c2a2+8a2bc+8ab2c+8abc2 F3=10a2b2c2+2a3b3+2b3c3+2a3c3

+6a3b2c+6a3bc2+6a2b3c+6a2bc3 +6ab3c2+6ab2c3+2a4bc+2ab4c+2abc4

+a4b2+a2b4+b4c2+b2c4+c4a2+c2a4 (X1)

Let us first defineFkl as the number ofl-th power ofa,b, andc found in the mono- mials (i.e., terms, or configurations) ofFk. The index k restricts our count only toFk, which is described above, whilel restricts the count to only those generals having ex- actlyl messengers:Li(0)=l. For example, inF2, the formsa2,b2, orc2can be found in these terms:

3a2b2+3b2c2+3c2a2+8a2bc+8ab2c+8abc2 .

We can expand the above expression to count the number of monomials of degree 2, which is given by 3×3×2+3×8×1=42. Therefore,F22=42.

Having definedFkl, we can now computeKk(1), which is the average value of|G1(1)| over all configurations inFk.

K1(1)=F12/κ1=6/(3·22)

=6/12=0.5000 K2(1)=(F22+F23+F24)/κ2

=(42+12+3)/(3·24)

=57/48=1.1875 K3(1)=(F32+F33+F34)/κ3

=(72+48+12)/(1·26)

=132/64=2.0625,

or more generally, we can use (x∈ G \x):

Kk(1)= 1 κk

XMk

lTFkl (5.4)

Fkl =X

x∈G 1 k!

l

∂xlF(a,b,c;z)|x=0,x=1

κk=¡S

k

¢(γ+1)Mk

Consider the case where all three generals are inG1(0). Not knowing each other’s deci- sions, they send their messengers out to notify their neighbors. FromKk(1), we predict that|G1(1)|=2.0625≈2. Likewise, in the next time step|G1(2)|=1.18751, and fi- nally, att=3, the generals no longer agree onA1as|G1(3)|=0.50<1. Therefore, with the givenM,T,γ, andS, a proper consensus reflecting the generals’ initial observations cannot be reached.

In Section5.2.2, we present the general results forγ-regular network for all possible parameter values and show that with an appropriate choice of parameters, a proper con-

sensus can be reached. In preparation for these general results, let us first generalize our triangular network into a ring networkG withSgenerals (shown below with eight gen- erals).

G

A

D F

E

C B H

FIGURE5.12 The networkGwith eight generals

In our analysis ofG, the values ofM,S, andT are no longer fixed. As a result, we can no longer count the results manually and have to resort to the mathematical formalism of multivariate generating function (mgf).

Let us denote the mgf forG by F(x;z), withx ={xi}={x0,x1, . . . ,xS1}andi ∈N modS(i.e.,i+Si modS) indexing theSgenerals inG. Denote by [zk] the operator that extracts the coefficient ofzkand by [xil] the operator that extracts the coefficient of xil. As before, letidenote any member of the index set that is different fromi which is {0, . . . ,S1}\i.

F(x;z)=QS

i=1

¡1+(xi+xi+1)Mz¢ Fk(x)=[zk]F(x;z)= 1

k!

k

∂zkF(z)|z=0

Fkl =PS

i=1[xil]Fk(x) (5.5)

=S1

k!

k

∂zk 1 l!

l

∂xilF(x;z)|xi=0,x

i=1

The formulas forKk(t) andκkare the same as the ones found in (5.4). The summands in (5.5) are identical due to the symmetry ofF(x;z) with respect to x. To derive the explicit formula forFkl, supposel ≥1. Although counterintuitive, it is easier to start

with [xli] instead of the standard operator [zk].

Fl(z)=S[xli]F(x;z)

=S 1

l!

l

∂xl

i

F(x;z)|xi=0,x

i=1

=SQi∈{2,S}¡1+(xi+xi+1)Mz¢|xi=1×

1 l!

l

∂xl1

¡1+(xS+x1)Mz¢ ¡1+(x1+x2)Mz¢|x1=0

Note that in the last equation above, we have chosen to extract thel-th coefficient ofx1, effectively choosingi =1. Due to symmetry, the expressions for otheri’s are the same, which allows us to use the multiplicative factor ofS.

=(1+2Mz)S2 1

l!

l

∂xl1

¡1+(1+x1)Mz¢2|x1=0

=(1+2Mz)S2[x1l](1+2(1+x1)Mz+(1+x1)2Mz2)

=(1+2Mz)S22

1

¢¡M l

¢(1)Mlz+¡2

2

¢¡2M l

¢(1)2Mlz2i

=PS2

i=0

¡S2 i

¢2Mizih 2¡M

l

¢z+¡2M

l

¢z2i

The value ofxi=1 is then substituted, before a tedious algebraic coefficient extraction procedure is run on the remaining polynomial that containsx1.

Fkl =[zk]Fl(z)= 1

k!

k

∂zkFl(z)|z=0 (5.6)

=2S¡M

l

¢¡S2

k1

¢2M(k1)+S¡2M

l

¢¡S2

k2

¢2M(k2)

At this point, recall that we haven’t considered the case wherel = 0, which requires a slightly different derivation because the term corresponding tol =0 is the constant term in the polynomial.

The derivation forFk0, is provided below. Again, we use the symmetry property of F(x;z). Note that at the first glance, the result forFk0below seems to be missing the¡i M

l

¢

factor when compared to Equation (5.6). However, recall that¡i M 0

¢≡1 for alli M.

Fl=0(z)=PS

i=1F(x;z)|xi=0,x

i=1

=S F(x;z)|xi=0,xi=1

=SQi∈{1,S}¡1+(xi+xi+1)Mz¢|xi=0,x

i=1

=S(1+2Mz)S2(1+z)2

Fk0=S[zk](1+2Mz)S2(1+z)2 (5.7)

=S 1

k!

k

∂zk

PS2 i=0

¡S2 i

¢2Mizi(1+2z+z2)|z=0

=SP2i=0¡2

i

¢¡S2

ki

¢2M(ki)

This last observation suggests a formula forFkl that is valid forγ=1 and all values of kandl, that can be used in Equation (5.4):

Fkl =

2

X

i=0

S Ãi M

l

!Ã2 i

S2 ki

!

2M(ki)

To conclude our analysis on this example, we consider the other extreme value forλ.

Now, instead of settingλ=1 and working with a ring network, we setλ=S1 and work with a complete graph, which is somewhat simpler to analyze. The steps of derivingFkl are identical:

F(x;z)=QS

i=1(1+(PS

j=1xj)Mz)

=(1+(PS

j=1xj)Mz)S Fl(z)=S[xl](1+(S1+x)Mz)S

=S[xl]PS

i=0

¡S

i

¢(S1+x)Mizi

=S[xl]PS

i=0

¡S

i

¢ PMi j=0

¡Mi

j

¢(S1)Mijxjzi

=SPS

i=0

¡S i

¢¡Mi l

¢(S1)Milzi Fkl =S[zk]PSi=0¡S

i

¢¡Mi

l

¢(S1)Milzi (5.8)

=S¡S

k

¢¡Mk l

¢(S1)Mkl .

As we mentioned previously, calculatingKk(t) is important because the function al- lows us to learn about the evolution ofG1(t) and whether consensus is possible under the threshold functionV. In our analysis of the triangular network, we manually calcu- latedKk(t) for different values ofkand learned that a proper consensus is not possible.

Obviously, for the ring and complete network with variable parameters, a manual and exhaustive analysis ofKk(t) is not an option. One feasible way would be a numerical evaluation of the values ofKk(t) as a function of its parameters.

However, all is not lost. LetMkbe the number of messengers dispatched bykgenerals inG1, andλ= Mk

S . If we fixλandMk ≫1, (5.8) becomes simple, and the qualitative behaviors ofKk(t) and the consensus become clear.

Pkl = Fkl k = S

¡S k

¢¡Mk l

¢(S1)Mkl S¡S

k

¢SMkλ

l

l!eλ Kk(1)=SPMk

lTPklSPMklT λl

l!eλ=S(1(TΓ(T,λ)1)!)

Perhaps not surprisingly, forMk1 andγ=S−1, each term in the summation in Equation (5.4) is the mathematical expression for a Poisson densityPkl with parameter λ=Mk

S and argumentl, and thereforeKk(1) can be expressed in terms of the incomplete

gamma functionΓ.

Figure5.13is a plot ofKk(t+1) againstKk(t), which is actually the plot ofKk(1) against k =|G1(0)|for M =2 (the lower curve) andM =4 (the upper curve) compared to the diagonal lineKk(t+1)=Kk(t). For both curves, we have set the parametersγ=S1, T =2, andS =100. These curves can be used to describe the time evolution ofKk(t), and the existence of a consensus.

0 20 40 60 80 100

20 40 60 80 100

FIGURE 5.13 The plot ofKk(t+1) versusKk(t)

For example, supposeKk(0)=72. For theM =2 curve,Kk(1)42, andKk(2)20, before eventually reachingKk(t)= 0 (the dashed path with an arrowhead). In other words, all generals would eventually settle onA0no matter how many of them initially agreed on A1. In contrast, theM =4 curve intersects the diagonal line atk22 and k≈85. These points define two possible steady-state behaviors ofKk(t). IfKk(0)<22, then as t → ∞Kk(t) settles at the stable fixed point atk =0. Otherwise, it settles at k85.

Denote byF(k) the function that mapsKk(t) toKk(t+1). The properties ofΓrequire thatF(k)→0 ask0 andF(k)Sast → ∞, and in addition, the slopes ∂F∂k(k)1S and ∂F∂k(k)S1 ast0 andt → ∞, respectively. Due to space limitation, we do not analyze the effects of changing M and T on F(k), or proofs to the above claims. We do, however, provide in the next section a sketch of the analysis of errors caused by the generals themselves.