• 沒有找到結果。

提出方法與時間複雜度分析

3.1 分群

在這一小節中,我們將針對分群問題介紹所提出的最佳化與啟發式解 決方式,我們將提出並證明一些理論與定理,並且比較其時間複雜度。

3.1.1 最佳化分群法介紹

此最佳化演算法想法啟發自廣度搜尋法(breadth-first search, BFS),我 們使用廣度搜尋法來探索子圖,一但探索到其中一點將存在著兩種可能 性,”選”或”不選”,如果選擇了此點我們將此點的鄰居放入序列(Queue)中 並且繼續最佳化演算法,若不選,我們將完全捨棄此點並繼續直到序列中 全空為止。在選擇此點之前我們還須考量是否符合工作量負載的限制,假 如選擇此點將導致子群過載,我們將捨棄此點(如圖十一),整體詳細的虛 擬程式碼(pseudo code)如下所示。

19

1

5

3 1

Step 1: Choose non-clustered initial node and push neighbor into queue

Queue : 2

1 2

1

3

1

5 3

Step 2: Pop the neighbor form queue(node 2), Choose node 2(if not

cause overloading)and push neighbor(node 3) of node 2 into queue

Queue : 3 1 2 1

1

3

1

5

3 1

Step 2: Pop the neighbor form queue(node 2), Do not choose

node 2 Queue : Empty

1 2

1

3

1

3

Step 3: Pop the neighbor form queue(node 3), Choose node 3(If not

cause overloading) and push neighbor(NULL) of node 3 into queue

Queue : Empty

1 2 1

1

3 5 3

1

1 5

Step 3: Pop the neighbor form queue(node 3), Do not choose

node 3 Queue : Empty

1 2

1

3

1

5

3 1

Step 3: Queue empty, but still have non-clustered node, start next

cluster and go to step 1 Queue : Empty

1 2

1

3

1

3

Step 4: Queue empty, and all nodes are clustered. If this solution is optimal

solution , record it.

Queue : Empty

1 2 1

1

3 5 3

1

1 5

Step 4: Queue empty, but still have non-clustered node, start next

cluster and go to step 1 Queue : Empty

1 2

1

3

圖十一、最佳化分群演算法解析

20

BFS_Optimization(StartNodeNumber N, AdjacencyQueue Q , clusternum C ) If (Q is empty)

// this cluster’s process finish

• If( there is no non-clustered node)

– Check this solution is better than optimal or not – If yes renew the solution

• Else

– Set all the non-clustered node to white color – Find the not clustered node N’

– Push N’ to Q

– Start next cluster, BFS_Optimization(N’, Q , C+1 )

Else

// Find all BFS sub-graphs

• TargetNode T = Q’s front node, and pop this node form Q

• Color this node to black

• Record the condition of Queue and Color

• If(Select the node T will not cause overloading)

– Choose this node T , Set the cluster number of T = C

– Push all the neighbors of T into Q which are not already in Q and it has white color

– BFS_Optimization(N, Q , C )

• If( T != N)

– Recovery the condition of Queue and color and set the cluster number of T = non-clustered

– Not choose this node T – BFS_Optimization(N, Q , C )

Main()

Push initial node N into Q;

BFS_Optimization(StartNodeNumber N, AdjacencyQueue Q , clusternum C );

21

3.1.1.1 理論與證明

 理論 1.給一 N 個點的簡單圖(simple graph) G=(V,E),給任意起始輸入 點𝑣⃑, 此最佳化演算法可以找尋所有包含點𝑣⃑的連通子圖。

證明:

在這邊我們使用數學歸納法證明。

當 N=1 時,只有一種簡單圖的可能性:

給定任意起始點為點 1

我們的演算法必定會選擇第一點(因為我們不考慮空群)

可以,此演算法可以跑過所有包含點 1 的可能連通子圖當 N=1 時。

當 N=2 時有以下幾種可能的簡單圖:

我們不失一般性的假設任意起始輸入點為點 1

我們的演算法必定會選擇第一個點 1,並且循序的去探索序列中的鄰居並 跑兩種可能”選”或”不選”

種類一:

種類二:

可以,此演算法可以跑過所有包含點 1 的可能連通子圖當 N=2 時。

當 N=3 時有以下幾種可能的簡單圖:

我們不失一般性的假設任意起始輸入點為點 1

22

我們的演算法必定會選擇第一個點 1,並且循序的去探索序列中的鄰居並 跑兩種可能”選”或”不選”

種類一:

種類二:

種類三:

種類四:

種類五:

種類六:

種類七:

種類八:

可以,此演算法可以跑過所有包含點 1 的可能連通子圖當 N=3 時。

我們現在假設當 N=k 時可以,我們考慮當 N=k+1 時

23

給一簡單圖包含 k+1 個點,不失一般性的我們假設給任意起始點點 1,並 且假設點 1 存在鄰居 𝑣1, 𝑣2,…, 𝑣𝑖, 0 ≤ I ≤ k

我們的演算法必定會選擇第一個點 1

假如點 1 不存在鄰居,我們已經跑過所有可能,可以

否則,對於所有點 1 的鄰居我們將循序的去探索序列中的鄰居並跑兩種可 能”選”或”不選”,在這邊不失一般性的假設𝑣1是我們第一個探索的點 若選擇𝑣1,我們將會將𝑣1的鄰居放入序列中,此情況相當於我們將點 1 及 點𝑣1兩點整合,並且將其當作起始點在只有 k 點的環境下進行我們的演算 法如下圖所示

依照先前在 k 點環境成立的假設,此情況成立。

反之若不選𝑣1,此情形相當於我們直接將𝑣1從圖中刪除,並且把點一當作

24

起始點在只有 k 點的環境下進行我們的演算法如下圖所示

依照先前在 k 點環境成立的假設,此情況成立。

在這裡我們證明了當 N=k+1 時,此演算法可以跑過所有包含點 1 的可能連 通子圖。

 定理 1.給一 N 個點的簡單圖(simple graph) G=(V,E),此最佳化演算法 可以找尋所有可能子群,其中子群必為完全連通圖。

證明:

由理論 1 我們可以知道,給任意起始點𝑣⃑,最佳化演算法將會搜尋包含 點𝑣⃑的所有可能連通子圖,在演算法第一層將會定義被選擇到點的群集編 號為 C1,並且繼續找尋剩餘尚未被分群的點進行第二次分群,重覆著相同 動作並定義第二層所選點的群集編號為 C2,依此類推…直到所有點皆已被 分群。每一次做最佳化演算法皆是根據上一層所產生的分群的結果為先前 條件而繼續分群,然而每一層皆會跑過所有可能結果,因此我們的最佳化 演算法能夠找出所有可能子群,且其子群必為完全連通圖。

3.1.2 啟發式分群法介紹

在本篇論文中,我們提出三種啟發性的分群解法其中包含隨機分群法、

最大代價分群法以及負載平衡分群法,以子群內必須連通的本質為基準,

依據不同角度切入解決問題,以下將分別介紹。

25

Step 1: Random choose a non-clustered node

Step 3: Find the maximum penalty node which not cause overloading

and cluster this node

Step 2: Find the maximum penalty node which not cause overloading

and cluster this node

P = 3

Step 4: If all neighbors would cause overloading, start next cluster and

go to step 1

26

ThisRoundClusterNumber = Initial Cluster Number While (all the nodes are clustered)

{

– Random choose a node 𝑣 ;

– Set the cluster number of 𝑣 : ThisRoundClusterNumber;

– While (true) – {

• Choose the neighbor node of clustered node 𝑢 which has max penalty and not cause overloading ;

• If u != null

– Set cluster number of 𝑢 : ThisRoundClusterNumber;

• Else

– Break;

– }

– ThisRoundClusterNumber ++ ; }

27

Step 1: choose the node which has maximum corresponding penalty(CP)

Initial Step: Define the corresponding penalty(CP)

圖十三、最大代價分群法起始選點解析 ThisRoundClusterNumber = Initial Cluster Number

While (all the nodes are clustered) {

– Choose the node 𝑣 which has maximum ∑ 𝑃𝑗 𝑣,𝑗 ; – Set the cluster number of 𝑣 : ThisRoundClusterNumber;

– While (true) – {

• Choose the neighbor node of clustered node 𝑢 which has max penalty and not cause overloading ;

• If 𝑢 != null

– Set cluster number of 𝑢 : ThisRoundClusterNumber;

• Else

– Break;

– }

– ThisRoundClusterNumber ++ ; }

28

Step 1: Using the estimated loading constraint (8.6) to perform clustering

3

Step 2: If there is still non-cluster node, release estimated loading constraint to loading constraint(11),

and check again 3

2 1

圖十四、負載平衡分群法分群示意圖,假設附載限制為 11,整理環境總工 作量為 26 因此所需三台伺服器,因此每台伺服器平均負載為 8.6

29

While (all the nodes are clustered) {

• If(First Round Clustering)

– Set loading constraint = best balancing loading;

• Else

– Release loading constraint to max loading constraint μ;

– Estimated number of VM = infinity;

• ThisRoundClusterNumber = Initial Cluster Number;

• While(true)

• {

– If ThisRoundClusterNumber > Estimated number of VM;

• Break;

– Random choose a node 𝑣 ;

– Set the cluster number of 𝑣 : ThisRoundClusterNumber;

– While (true) – {

• Choose the neighbor node of clustered node 𝑢 which has max penalty and not cause overloading ;

• If 𝑢 != null

– Set cluster number of 𝑢 : ThisRoundClusterNumber;

• Else

– Break;

– }

– ThisRoundClusterNumber ++ ;

• } }

30

3.1.3 時間複雜度分析

首先我們分析最佳化分群演算法的時間複雜度,最佳化分群演算法為 窮舉演算法將會掃描所有分群可能,我們以下嘗試著為最佳化演算法找出 上界(Upper bound)。

我們定義符號𝐶𝑖 代表群集 i 內成員個數,N 代表所有成員總數,首先 我們假設每個群集內成員數固定,觀察在成員數固定的情況下有幾種存在 的可能。我們先觀察單一群集,群集 1 存在𝐶1個點,那其所有子圖的可能 數 必 小 於 1*8*7*…*7 ≅ 7𝑐1−1種 可 能 ( 如 圖 十 五 ) , i 個 群 集 種 共 有 7𝑐1−1*7𝑐2−1*…*7𝑐𝑖−1種可能,以上考慮為𝐶1,…, 𝐶𝑖成員數固定的情況下,

接下來我們將考慮𝐶1,…, 𝐶𝑖的成員數所有組合數,恰等於𝐶1 + 𝐶2 + … + 𝐶𝑖 = N , 𝐶1,…, 𝐶𝑖 ≧ 1 中求所有

𝐶1,…, 𝐶𝑖的組合的可能數,其解為 (𝑁−1)!

(𝑁−𝑖)!(𝑖−1)!。在群集數為 i 時,可能數必

小 於7𝑐1−1*7𝑐2−1 *…*7𝑐𝑖−1 * (𝑁−1)!

(𝑁−𝑖)!(𝑖−1)!, 所 以 所 有 可 能 數 必 小 於

∑ 7𝑁 𝑐1−1∗ 7𝑐2−1∗ … ∗ 7𝑐𝑖−1(𝑁−𝑖)!(𝑖−1)!(𝑁−1)!

𝑖=1 = ∑ 7𝑁 𝑁−𝑖 (𝑁−𝑖)!(𝑖−1)!(𝑁−1)!

𝑖=1 ,因此最

佳 化 分 群 演 算 法 的 時 間 複 雜 度 為 O( ∑ 7𝑁 𝑁−𝑖 (𝑁−𝑖)!(𝑖−1)!(𝑁−1)!

𝑖=1 )

圖十五、單群產生所有可能性示意圖

而啟發式演算法因每抓取一點皆搜尋本回合群集鄰居,鄰居不多於 N 個,共抓取 N 點,因此時間複雜度為 O(𝑁2),時間複雜度比較表如下圖。

31

表一、分群法時間複雜度比較

3.2 邊界點的頻譜資源分配

在這一小節中,我們將針對分群問題介紹所提出的最佳化與啟發式解 決方式,我們將證明一些理論與定理,並且比較其時間複雜度。

3.2.1 最佳化頻譜資源分配法介紹

此最佳化頻譜資源分配法想法於嘗試找尋所有頻譜分配可能,並由所 有可能中找尋最佳的分配方式,虛擬程式碼如下,其概念為針對每個環境 中的邊界無線感知網路基地台,我們找尋其所有小於需求數的頻譜配置可 能,針對每種配置方式,我們限制其鄰居不可配與相同頻譜,並繼續搜尋,

重覆已找尋所有可能(如圖十六),其最佳化頻譜資源分配法的正確性將在 下一小節說明證明。

Random choose O(𝑁2) Max Penalty O(𝑁2) Release Loading Constraint O(𝑁2)

Optimal O(∑ 7𝑁 𝑁−𝑖 (𝑁−𝑖)!(𝑖−1)!(𝑁−1)!

𝑖=1 )

32

33

Resource_Allocation_Optimization(Node N) {

If(N == total number of nodes) {

if this solution is better than optimal solution replace this solution to optimal solution;

} Else {

Find the power set of available channel of N;

For each set S of power set, which |S| < 𝑞

𝑁

Record the neighbor’s available channel set condition;

Disable the neighbor’s intersection available channel;

Resource_Allocation_Optimization(N+1);

Recovery the neighbor’s available channel set condition;

} }

Main() {

Resource_Allocation_Optimization(Node 0);

}

34

3.2.1.1 理論與證明

 理論 2. 最佳化頻譜資源分配法能搜尋所有可能的頻譜資源分配方式 證明:

最佳化頻譜資源分配法首先處理點 0,最佳化頻譜資源分配法基於點 0 可用頻譜集合找尋所有點 0 小於其需求數的可能頻譜分配情形,對於每種 分配情形我們都相先禁止鄰居被賦予相同頻譜(直接修改鄰居的可用頻譜 集合)而繼續,對於每種點 0 的可能分配情形我們都將接續著處理點 1,依 此類推…直到點 N(假設 N 為所有點數),因此,每一點都是基於其上一點 跑出的可能性修改頻譜可用集合來進行接下來所有可能性的搜尋,然而上 一點也找尋了所有可能分配情形,因此,最佳化頻譜資源分配法搜尋了所 有可能的頻譜資源分配方式。

3.2.2 啟發式頻譜資源分配法介紹

我們針對我們的頻譜資源分配目標設計了啟發性的頻譜資源分配法,

其概念為在盡可能的滿足頻譜需求數的前提之下找尋公平的分配頻譜資 源方式,其運作流程包含了選點及配置頻譜兩步驟。在這邊我們提出了許 多選點的頻估的方式,第一個為”最小干擾值”(Minimum interference value),

干擾值定義為頻譜影響的鄰居總數,而最小干擾值為該點所擁有的最小干 擾值,舉例來說(如圖十七),圖十七點 1 的紅色頻譜若配與將影響點 2 及 點 3,其干擾值為 2,而最小干擾值為 0 是因為其紫色頻譜若配與將不會 影響到任何人因此點 1、2、3、4 的最小干擾值分別為 0、1、0、0,我們 希望在環境中優先被置擁有最小干擾值的頻譜。

35

圖十七、干擾值定義

若存在多個具備有最小干擾值的點我們將進一步比較”頻譜飽和狀 況”(saturation degree),頻譜飽和狀況定義為所剩能被配與的可用頻譜總數,

我們期望給擁有較少可用頻譜的使用者優先配置的權力。若有存在多個點 具備相同的頻譜飽和狀況我們將比較誰能帶給網路最公平的結果(也就是 導致公平值(satisfaction ratio)的變異數最低),若是前述條件都相同,我們 最後將隨機取出一點配置,舉例來說,在圖十八的環境中首先選擇尚未被 著成黑色的點,由圖可知有 1、2、3、4 四點,接著再由四點中首先選擇 擁有最小干擾值的點,為 1、3、4 三點擁有最小干擾值 0,而其中 3、4 有 較小的頻譜飽和狀況(剩下兩條可用頻帶),我們接著觀察 3、4 兩點的公平

我們期望給擁有較少可用頻譜的使用者優先配置的權力。若有存在多個點 具備相同的頻譜飽和狀況我們將比較誰能帶給網路最公平的結果(也就是 導致公平值(satisfaction ratio)的變異數最低),若是前述條件都相同,我們 最後將隨機取出一點配置,舉例來說,在圖十八的環境中首先選擇尚未被 著成黑色的點,由圖可知有 1、2、3、4 四點,接著再由四點中首先選擇 擁有最小干擾值的點,為 1、3、4 三點擁有最小干擾值 0,而其中 3、4 有 較小的頻譜飽和狀況(剩下兩條可用頻帶),我們接著觀察 3、4 兩點的公平

相關文件