• 沒有找到結果。

National Sun Yat-sen University Institutional Repository:Item 987654321/38797

N/A
N/A
Protected

Academic year: 2021

Share "National Sun Yat-sen University Institutional Repository:Item 987654321/38797"

Copied!
5
0
0

加載中.... (立即查看全文)

全文

(1)

行政院國家科學委員會補助專題研究計畫成果報告

※※※※※※※※※※※※※※※※※※※※※※※※※

※ ※

※    廣播通訊模式下之排序演算法    ※

※       ※

※※※※※※※※※※※※※※※※※※※※※※※※※

計畫類別:

þ

個別型計畫  □整合型計畫

計畫編號:NSC 89-2213-E110-005

執行期間:88 年 08 月 01 日至 89 年 07 月 31 日

計畫主持人:楊昌彪

共同主持人:

本成果報告包括以下應繳交之附件:

□赴國外出差或研習心得報告一份

□赴大陸地區出差或研習心得報告一份

□出席國際學術會議心得報告及發表之論文各一份

□國際合作研究計畫國外研究報告書一份

執行單位:國立中山大學資訊工程學系

中 華 民 國  89 年  10 月  31 日

(2)

行政院國家科學委員會專題研究計畫成果報告

廣播通訊模式下之排序演算法

Sor ting Algor ithms based on Br oadcast Communications

計畫編號:NSC 89-2213-E110-005

執行期限:88 年 08 月 01 日至 89 年 07 月 31 日

主持人:楊昌彪 國立中山大學資訊工程學系

[email protected]

計畫參與人員:蕭學宏 國立中山大學資訊工程學系

一、中文摘要 在本成果報告中,我們將提出兩個在廣播通 訊模式下(BCM)快速的排序演算法。我們排序演 算法的主要關鍵,是利用一些成功的廣播,來建立 邏輯上的廣播階層,並將這些參與廣播的資料適當 地分配在這些邏輯階層上。因此,碰撞的次數可以 減少。假設在廣播通訊模式下,有n個處理器,各 自擁有一個資料,即有n個資料。我們證明此二個 排序演算法的時間複雜度皆是Θn)。此外,我們 更將此一結果,推廣到一般化排序,也就是在n個 資料中,僅排序較大的 k 個資料。我們的一般化排 序分析,為找尋最大資料與排序資料的這兩個極端 問題,建立起前後關連性。我們證明一般化排序方 法的時間複雜度是Θk+ log(n-k))。 關鍵詞:平行演算法、排序、廣播通訊、碰撞、一 般化 Abstr act

In this report, we shall propose two fast algorithms to solve the sorting problem under the

broadcast communication model (BCM). The key point of our sorting algorithms is to use successful broadcasts to build broadcasting layers logically and then to distribute the data elements into those logic layers properly. Thus, the number of broadcast conflicts can be reduced. Suppose that there are n input data elements and n processors under BCM are available. We show that the average time complexity of both our sorting algorithms is Θ(n). In addition, we expand this result to the generalized sorting, that is, finding the first k largest elements with the nondecreasing order among n elements. The analysis of the generalization builds up a connection between the two special cases which are maximum finding and sorting. We prove that the average time complexity for the generalized sorting is Θ( k+log(n-k)).

Keywor ds: Parallel Algorithm, Sorting, Broadcast

Communication, Conflict, Generalization

二、緣由與目的

在 眾 多 平 行 計 算 模 式 (parallel computation models)中﹐有多種簡單的模式﹐而廣播通訊模式 (broadcast communication mode)﹐就是其中的一種 [1,2,4-9,11-14,16-20]。在此模式下﹐全部的機器共 享唯一的通道﹐並藉由此一通道﹐進行訊號的連通 (如圖 1)。當有一部機器廣播(broadcast)訊號時﹐其 他的所有機器可藉此通道接收訊號。當有二部以上 的機器同時想要傳送消息時﹐就會發生廣播碰撞 (broadcast conflict)﹐此時就有一個機制(resolution scheme)來解決碰撞﹐使得只有一部機器可以傳播資 料。 圖 1. 廣播通訊模式 此種模式不僅是較簡單的模式﹐而且是較切 合實際。現今最普遍的區域網路架構﹐以乙太網路 (Ethernet)為主﹐其通訊模式就是一種廣播通訊模 式。此種模式最大的特徵﹐就是必須解決碰撞問 題。如果碰撞是無可避免的﹐那如何減少碰撞次數﹐ 將是關鍵性的問題。 此種模式下的演算法﹐所需花費的時間共分 三部分。第一部份是解決碰撞所需的時間﹐第二部 分是資料傳輸所需的時間﹐最後一部份是進行運算 所需的時間。若能減少此三部分時間之總和﹐就能 增進此演算法的執行效率。而其最具關鍵性的步 驟﹐是減少第一部份的時間﹐換言之﹐就是減少碰 撞次數。 目前所知有二種概念﹐可以減少碰撞次數。 第一種是﹐調整廣播機率的大小﹐以得到一個適當 機率,使其大約有一個資料可廣播成功。第二種是﹐ 逐一建立邏輯性的階層﹐在建立階層的過程﹐將資 料分配在每一個邏輯性的階層﹐達到分散資料﹐以 減少參加碰撞的資料個數。不論是第一或第二種概 念﹐皆能有效減少碰撞次數。第一種概念是由 Martel 所提出的[7]﹐雖然﹐此概念應用在尋找最大值的問 題上﹐能證明所需時間為O(ln n)﹐但是缺乏較嚴謹 的上下界限﹐可供參考比較。 第二種概念是由本計畫主持人楊昌彪教授所 提出的[18]。在廣播通訊模式下﹐將此概念運用在 尋找最大值的問題上﹐我們已證明[12]平均所需的 時間槽縫(time slots)﹐以 Tn 表示﹐則4*ln n < Tn < 1 2 3 4 5 6 7 8

(3)

5*ln n。而 Grabner 和 Prodinger[3]﹐則利用艱深的 數 學 ﹐ 精 準 地 證 出 Tn /ln n π2/(3*ln 2) = 4.746276… 。不論是何者﹐皆證明我們運用階層概 念的演算法﹐其平均時間複雜度為Θ(ln n)。如沒有 運用階層概念﹐或其他概念﹐而改以直覺方式來進 行尋找最大值﹐將會有何結果﹖兩者之間的差距﹐ 會有多大﹖經我們證明其結果是Θ(ln2 n)[13]﹐ 確 實比運用階層概念的演算法﹐差上一個級數。此一 結果證實運用階層概念有其效果﹐因此﹐在廣播通 訊模式下想要發展有效的演算法﹐階層概念是可考 慮的方向。 因此,本計畫在廣播通訊模式下﹐探討如何 運用階層概念﹐以減少碰撞次數,降低排序問題的 時間複雜度。我們提出兩種排序演算法[14,16],其 時間複雜度皆為Θ(n)。然後,我們再運用 quicksort 一般化的方式[15],將其中的一個排序演算法一般 化,也就是在n個資料中,僅排序較大的k個資料。 我 們 證 明 此 一 般 化 排 序 方 法 的 時 間 複 雜 度 是 Θ(k+ log(n-k))[16]。此一般化排序的分析,為找尋 最大資料與排序資料的這兩個極端問題,建立關連 性,使我們可以監控排序的整個過程。 三、結果與討論    在廣播通訊模式下,我們提出的第一個排序 演算法[14],是建立在”How to select a loser”[10]架 構之上。我們運用它先選出一個 loser,然後將大於 該 loser 的資料分到上階層,將小於該 loser 的資料 分到下階層,也就是形成上下兩個階層。接著我們 在上個階層繼續遞迴地進行相同的程序,然後再到 下階層遞迴地進行相同的程序。如此遞迴重複地進 行,直到每個階層僅餘一個資料或沒有資料,即可 完成排序。 令Tn代表將 n 個資料排序所需時間槽縫個數 數,其數學式如下:

(

)

(

)

(

)

+

+

+

+

+

+

+

+

=

− − − 0 1 2 1 1 0

...

1

1

T

T

T

T

T

T

n

S

T

n n n n n Sn:select a loser 經過推演可以得到以下結果: Lemma 1

(

)

(

)

(

)

≤ ≤ −

+

+

+

+

+

=

n k k k n n

S

S

k

n

S

n

S

S

n

T

3 1 1 2

1

1

1

2

1

6

1

3

2

Lemma 2

3

,

2

1

1

for

n

n

S

S

n

k k Lemma 3

(

)

+

+

+

≤ ≤ −

1

1

3

1

2

1

1

1

1

3

1

3 1

n

S

S

k

n

k n k k Theor em 1

3

4

3

2

3

3

n

S

n

T

n

n

S

n

而其中的Sn=O(log n),所以,我們得到 Theor em 2 第一個排序演算法的時間複雜度是¨ 1(n) . 我們提出的第二個排序演算法[14],是建立在 我們以前提出的”Maximum finding”[12]架構之上。 我們不僅運用它先選出最大的資料,並且利用此過 程中,陸陸續續廣播成功的資料(資料越來越大, 直到最大的資料廣播成功),將尚未廣播的資料, 按照大小範圍分配在這一些廣播成功資料之間,亦 即形成多個階層。然後,每個階層再遞迴重複地進 行”Maximum finding”,直到排序結束。 其數學式如下: Mn:maximum finding 經過推演可以得到以下結果: Lemma 4 Lemma 5 Theor em 3 所以,我們得到 Theor em 4 第二個排序演算法的時間複雜度是¨ a(n) .

與 Martel and Moh [8]所提出的時間複雜度

O( n)相比,我們兩個結果È(n)不僅有嚴謹的上下界 限,而且未來分析一般化的過程要較為容易。 一般而言,如何將全部 n 個資料快速地加以 排序,是大部分排序演算法的目標,可是,並非所 有的應用,皆需要將全部n個資料排序,而可能僅 需要排序較大的k個資料。我們稱這種情形為一般 化排序。為了讓我們一般化的分析,有一個基石, 我們先對 quicksort,作一般化的分析[15]。

+

+

+

+

+

+

+

+

+

+

+

=

− − − − − −

]

[

1

]

[

1

]

[

1

]

[

1

]

[

1

0 1 1 3 2 2 0 1

T

R

n

T

R

n

T

R

n

T

T

n

T

n

M

T

n k n k n n n n n

Λ

Λ

(

)

      + − ≤ − + ≤       + −

≤ ≤ − 1 1 3 1 5 1 1 1 1 3 1 4 3 1

n

M

M

k

n

k n k k

6

7

6

23

2

1

2

7

T

n

n

n

(

1

)

3 2

1

1

3

1

1

1

− ≤ ≤

+

=

+

n n n k n

M

M

k

T

T

n

(4)

T

kn代表在 n 個資料中,將較大的 k 個資料 進行排序所需時間槽縫個數,數其數學式如下: 經過推演可以得到以下結果: Lemma 6

2

1 1

=

n n

T

T

. Lemma 7

n

T

1n

=

2

. Lemma 8 ( )

(

1)

)

1

2

2

=

+

n n k n k n k

T

H

H

T

. Hn:harmonic number Theor em 5

(

)

(

)

( )





+

=

− − = n k n m m n k

n

k

H

T

2

2

1

2

. Theor em 6 ( )

(

1

)

2

1) 1

=

− −

+ n k n k n k

T

H

T

. 最後我們運用 quicksort 一般化的分析過程與 方式,將我們第二個排序演算法予以一般化。 其數學式如下: 經過推演可以得到以下結果: Lemma 9 Let Ln= Mn–Mn-1 , then ) 1 ( 2 1 1

)

2

(

1

1

1

1

− − − − −

+

+

+

+

=

k n n n n n k n k

L

k

n

L

n

L

n

L

T

T

Λ

Lemma 10

[

]

n k k k

T

T

+

4

ln

(n

-

(k

-

2))

-

ln2

1))

-(k

-(n

ln

5

+

k k n k

T

T

Theor em 7

Martel and Moh [8]指出這種情形的時間複雜 度是 O(k+ log n),而我們的結果Θ(k+ log(n-k))[16] 比他們的結論較為嚴謹。此外,我們的一般化排序 的分析,為找尋最大資料與排序資料的這兩個極端 問題,建立關連性,使我們可以監控排序的整個過 程。 四、計畫成果自評 由本計畫的成果撰寫成論文,並且已經發表 的研討會論文共計三篇[14,15,16],總述如下: (一) 在廣播通訊模式下(BCM)提出兩個更快的排 序演算法[14,16]。此兩個演算法的時間複雜度 為È(n),比 Martel and Moh [8]所提出的時間複 雜度O( n),不僅有嚴謹的上下界限,而且在一 般化的分析過程中較為容易。 (二) 探討並分析 quicksort 的一般化[15],成為一般 化排序分析的基石。 (三) 以 quicksort 一般化的分析為基石,將所提出排 序演算法的其中之一,加以一般化[16]。我們 的結果為Θ(k+ log(n-k)),比 Martel and Moh [8] 所提出的時間複雜度 O(k+ log n) 有較為嚴謹 的上下界限。此外,我們一般化排序的分析, 為找尋最大資料與排序資料的這兩個極端問 題,建立關連性,使我們可以監控排序的整個 過程。 未來我們將在此結果之上,繼續探討以下問 題 (一) 在廣播通訊模式下,解決其他的問題的時間複 雜度是否可以降一級? (二) 此兩個排序演算法是否還有改進的空間? (三) 在廣播通訊模式下,排序問題的底限為何? (四) 選擇的問題 (五) 在 multi-chanel 的應用 (六) 在 wireless 的應用 五、參考文獻

[1]. J. I. Capetanakis, "Tree algorithms for packet broadcast channels,'' IEEE Transactions on Information Theory, Vol. 25, No. 5, pp. 505-515, May 1979.

[2]. R. Dechter and L. Kleinrock, "Broadcast communications and distributed algorithms,'' IEEE Transactions on Computers, Vol. 35, No. 3, pp. 210-219, Mar. 1986.

[3]. P. Grabner and H. Prodinger, “An Asymptotic Study of Recursion Occurring in the Analysis of

(

)

(

)

(

)

(

)

(

)

(

)

(

)

+

+

+

+

+

+

+

+

+

+

+

+

+

+

+

=

− + − − − − − − −

0

0

0

1

1

1 1 0 1 1 2 2 1 1 1 1 0 0 n k k k k k k n k k n k n k n k

T

T

T

T

T

T

T

T

T

n

n

T

Λ

Λ

(

)

(

)

(

)

+

+

+

+

+

+

+

+

+

+

+

=

− − − − − − − − − − − − − −

]

[

1

]

[

1

]

[

1

]

[

1

]

[

1

0 0 1 1 1 1 1 1 3 3 2 2 2 2 2 0 0 1 1

T

M

T

n

T

M

T

n

T

M

T

n

T

T

n

T

n

M

T

n n n k n k n k k k n n n n n n n n n

Λ

Λ

n k

T

k

+

+

4

ln

2

)

2

1

(

-2))

-(k

-(n

ln

4

2

7

6

7

-1))

-(k

-(n

ln

5

6

23

+

k

T

kn

(5)

an Algorithm on Broadcast Communication,” Information Processing Letters, Vol. 65, iss2, 1998, pp. 89-93

[4]. J. H. Huang and L. Kleinrock, "Distributed selectsort sorting algorithm on broadcast communication,'' Parallel Computing, Vol. 16, pp. 183-190, 1990.

[5]. S. Levitan, "Algorithms for broadcast protocol multiprocessor,'' Proc. of 3rd International Conference on Distributed Computing Systems, pp. 666-671, 1982.

[6]. S. P. Levitan and C. C. Foster, "Finding an extremum in a network,'' Proc. of 1982 International Symposium on Computer Architechure, pp. 321-325, 1982.

[7]. C. U. Martel, "Maximum finding on a multi access broadcast network,'' Information Processing Letters, Vol. 52, pp. 7-13, 1994. [8]. C. U. Martel and W. M. Moh, ” Optimal

Prioritized Conflict Resolution on a Multiple Access Channel,” IEEE Transactions on Computers, Vol. 40, No. 10, pp.1102-1108, 1991

[9]. W. M. Moh, C. U. Martel, and T. S. Moh, "A dynamic solution to prioritized conflict resolution on a multiple access broadcast channel,'' Proc. of 1993 International Conference on Parallel and Distributed Systems, pp. 414-418, 1993.

[10]. H. Prodinger, "How to select a loser,'' Discrete Mathematics, Vol. 120, pp. 149-159, 1993. [11]. K. V. S. Ramarao, "Distributed sorting on local

area network,'' IEEE Transactions on Computers, Vol. C-37, No. 2, pp. 239-243, Feb. 1988. [12]. S. H. Shiau and C. B. Yang, "A fast maximum

finding algorithm on broadcast communication,'' Information Processing Letters, Vol. 60, pp. 81-96, 1996.

[13]. S. H. Shiau and C. B. Yang, "The layer concept and conflicts on broadcast communication,'' Journal of Chang Jung Christian University, Vol. 2, No. 1, pp. 37-46, June 1998.

[14]. S. H. Shiau and C. B. Yang. “A Fast Sorting Algorithm on Broadcast Communications,“ In Proc. of Second International Conference on Parallel Computing Systems(PCS99), pages 87-92, Ensenada, Baja California, Mexico, August 16-20, 1999.

[15]. S. H. Shiau and C. B. Yang. The Generalization of Quicksort. In Proc. of 2000 Workshop on Internet and Distributed Systems(WIND'2000), Vol. 2, pages 94-99, Tainan, Taiwan, May 2000. [16]. S. H. Shiau and C. B. Yang. “ A Fast Sorting

Algorithm and Its Generalization on Broadcast Communications“ In Proc. of Sixth Annual International Computing and Combinatorics Conference (COCOON'2000), pages 252-261, Sydney , Australia, July 26-28, 2000. Springer. [17]. C. Y. Tang and M. J. Chiu, "Distributed sorting

on the serially connected local area networks,'' Proc. of 1989 Singapore International

Conference on Networks, pp. 458-462, 1989. [18]. C. B. Yang, "Reducing conflict resolution time

for solving graph problems in broadcast communications,'' Information Processing Letters, Vol. 40, pp. 295-302, 1991.

[19]. C. B. Yang, R. C. T. Lee, and W. T. Chen, "Parallel graph algorithms based upon broadcast communications,'' IEEE Transactions on Computers, Vol. 39, No. 12, pp. 1468-1472, Dec. 1990.

[20]. C. B. Yang, R. C. T. Lee, and W. T. Chen, "Conflict-free sorting algorithm broadcast under single-channel and multi-channel broadcast communication models,'' Proc. of International Conference on Computing and Information, pp. 350-359, 1991.

參考文獻

相關文件

&#34;Extensions to the k-Means Algorithm for Clustering Large Data Sets with Categorical Values,&#34; Data Mining and Knowledge Discovery, Vol. “Density-Based Clustering in

Wallace (1989), &#34;National price levels, purchasing power parity, and cointegration: a test of four high inflation economics,&#34; Journal of International Money and Finance,

Wolfgang, &#34;The Virtual Device: Expanding Wireless Communication Services through Service Discovery and Session Mobility&#34;, IEEE International Conference on

Soille, “Watershed in Digital Spaces: An Efficient Algorithm Based on Immersion Simulations,” IEEE Transactions on Pattern Analysis and Machine Intelligence,

Menz-Ru Huang, Ruey-Gwo Chung, Tung-Shou Chen, Hsuan-Yi Cheng, Yung-Ching Lin (2007), “An Analysis of Government Subsidies Enterprise Training Based On CDC Algorithm,”

F., “A neural network structure for vector quantizers”, IEEE International Sympoisum, Vol. et al., “Error surfaces for multi-layer perceptrons”, IEEE Transactions on

Jones, &#34;Rapid Object Detection Using a Boosted Cascade of Simple Features,&#34; IEEE Computer Society Conference on Computer Vision and Pattern Recognition,

Gen, &#34;Minmax earliness/tardiness scheduling in identical parallel machine system using genetic algorithms,&#34; Computers &amp; Industrial Engineering, vol. Cheng,