• 沒有找到結果。

0hr 4hr 8hr 12hr 16hr 20hr

Sur viv al R at e (%)

Severe wound with communication Severe wound without communication Light wound with communication Light wound without communication

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

41

3.2、問題定義

3.2.1、救災效益定義

當一個孤立台建構完加入 CCN 應急通訊系統時所能帶給其服務範圍內人員的救 災幫助稱為救災效益(profit),一個簡單的定義是「倖存者的存活率」。隨著時間 增加,倖存者的存活率會跟著下降,救災效益也同步下降,但由於各個地方災情 不一,倖存者所需要的幫助也不大一樣,因此各基地台會有不同的救災效益函數,

稱之為 profit function,將建構時間代入其各自的救災效益函數,加總此些計算出 來的各基地台救災效益可得到一個排程的總救災效益,由總救災效益來決定最終 採用的 CCN 應急通訊系統建構排程。但由於災區的情況通常由國家救災單位收 集整合,工程人員並無能力定義救災效益函數,因此必頇由國家救災單位定義。

3.2.2、問題描述

給予一確定 CCN 應急通訊系統網路樹狀拓樸 T,此樹狀拓墣內有 i 個節點( ),

i-1 條鏈結( ), 代表節點 , 的鏈結, 則是代表建構排程,由於此問題模 型中所有節點所需的建構時間都不一樣,因此用 代表建構此節點所需花費的時 間,問題模型一時同時間只會有一組工作組進行建構 CCN 應急通訊系統,問題 模型二時同時間會有多組工作組進行建構 CCN 應急通訊系統,借由增加工作組 組數來模擬現實情況。

在問題描述中所使用到的名詞定義如下:

◦ Schedule: CCN 應急通訊系統建構順序。

◦ 節點:基地台在本章節的數學代號。

◦ 轉送拓樸 (Forwarding Tree):CCN 應急通訊系統中串聯各節點之拓樸連線。

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

42

◦ 候選節點:所有尚未排入建構 CCN 應急通訊系統排程孤立台中的合法(可行) 選擇,合法選擇是指此候選節點的父節點已被排入排程中,一但此節點(孤 立台)建構完成即能提供服務產生救災效益。

 問題模型一:

• Given a forwarding tree, T(V,E) , where

• V = { | i=1,…,n} is the set of survival base stations.

• is the root node that has an external link(連網台)

• E = { | , V , is the link of ( , ) }

• R = { | i=1,…,n, }, is the construction time of isolated station .

• , is a CCN construction schedule.

• = { }

• P = { | i=1,…,n , }, is the profit of , if node is constructed at time .

• S = { | is a permutation of , i=1,…,n, k=1,…,n!} is the set of CCN construction schedules.

• q( ) is the total profit of schedule

• The CCN deployment scheduling problem is to find , such that q( ) is maximized

 問題模型二:

• Given forwarding a tree, T(V,E) , where

• V = { | i=1,…,n} is the set of survival base stations

• is the root node that has an external link(連網台)

• E = { | , V , is the link of ( , ) }

• R = { | i=1,…,n, }, is the construction time of isolated station .

• , a CCN construction schedule.

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

43

• = { }

• P = { | i=1,…,n , }, pi t is the profit of vi, if node vi is constructed at time t.

• n :the number of CCN construction working team

• S={ sk| sk is a permutation of vi, i=1,…,n, k=1,…,n!} is the set of CCN construction schedules.

• q(sk) is the total profit of schedule sk

• The CCN deployment scheduling problem is to find sk , such that q(sk) is maximized

3.3、複雜度分析

在這一節中,我們將對單機排程問題(Single machine scheduling problem)和應急通 訊網路排程問題(CCN deployment scheduling problem)做問題分析,並證明應急通 訊網路排程問題為一 NP-Hard 問題。

Single machine scheduling problem (SMS):

The nonpreemptive single machine scheduling problems is as follows. A set J of n jobs has to be scheduled on a single machine. Each job i requires uninterrupted processing for a period of length pi and weights wi, where pi、wi is positive integer.

Let (P, W) denote the set of (pi wi). And the machine can handle no more than one job at a time. The goal is to find a schedule (i.e. permutation : N -> {1,…, n}) such that the sum i wi Ci , where Ci is the time at which job i completes in the given schedule , is minimized.

CCN Deployment Scheduling problem (CCN-DS):

The nonpreemptive CCN deployment scheduling problem is as follows. A set N of n

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

44

nodes organized in a tree structure has to be fixed by work teams. A parent node must be fixed before its child nodes. Each node i requires uninterrupted deployment processing for a period of length i and weights wi , where i、wi is positive integer. And the work team can handle no more than one job at a time. The goal is to find a schedule such that the sum i wi Ci , where Ci is the time at which node i completes in the given schedule , is maximized.

CCN-DS is in NP:

We first show that CCN-DS NP. Assuming that we are given a forwarding tree T(V,E), as well as a schedule, we can use a double loop to verify that a parent node must be fixed before its child nodes in T. The verification algorithm can affirm the schedule is a valid CCN-DS schedule within O( ) time.

CCN-DS is NP-Hard:

We now prove that CCN-DS problem can be reduced to SMS problem straightforwardly. Given an instance A:[J,P,W] in SMS, we can find an instance B:[N,L,W,E,n] in CCN-DS such that an optimal solution for B is also an optimal solution for A. Let = , L=P, ’= , E={eroot i|vroot,vi V}, n(work teams)=1. The verification can be performed in polynomial time. Let total weighted completion time of SMS for is T.W.C( ), total weighted profit of CCN-DS for is T.W.P( ). We prove 3 Lemmas first:

Lemma 1: Any valid schedule for B(CCN-DS) is a valid solution for A(SMS).

Proof: Any permutation of J is valid schedule for A, and is a permutation of N, which is J. Therefore is a valid solution for A. Q.E.D.

Lemma 2: Any valid schedule a for A is also a valid schedule for B.

Proof: A valid schedule a for A is a permutation of J. Since each node in B can

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

45

directly connect to the root of B, therefore any permutation of N, which is J, is a valid schedule of B. Thus a is also a valid schedule for B. Q.E.D.

Lemma 3: If T.W.C( a) < T.W.C( ) then T.W.P( a) > T.W.P( )

Proof: If i wi Ci a < i wi Ci , by Equal Division Theorem ,we can get i wi Ci a )> i wi Ci . Q.E.D.

Next, We prove by contradiction that an optimal solution to B must be an optimal solution to A. By Lemma 1, we know is also a valid schedule for A, whose total weight completion time is T.W.C( ). Assume is not an optimal schedule for A, there must be another schedule a, whose total weight completion time T.W.C( a) is smaller than T.W.C( ). By Lemma 2, a is also a valid schedule for B, whose total profit is T.W.P( a). By Lemma 3, we can obtain T.W.P( a) is bigger than T.W.P( ). This contradicts to the fact that is an optimal solution for B.

Therefore, must be an optimal solution for A. Q.E.D.

3.4、啟發式排程演算法

3.4.1、演算法設計

修復排程為一 NP Hard 問題,礙於時間急迫,當基地台數量多的時候,無法在限 定時間內,找出一組最佳解。因此,本論文提出了一個方法,分兩步驟運算得出 一接近最佳解的建構 CCN 應急通訊系統排程:(1)使用貪婪式演算法計算得到一 個初始解;(2)給予一個調整指引,根據此指引反覆運算調整初始解的基地台建 構順序逐步找出更佳的解,如圖 11 所示。基地台修復排程依照基地台重要性排 定修復順序。其規劃重要原則為父節點(Parent node)修復順序需早於子節點(Child node),以確保基地台修復後,可立即恢復正常運作,否則頇等父節點基地台修

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

46

復才能運作。

在使用貪婪式演算法時,考量周圍孤立台個數以及包含自己本身與周圍孤立 台的救災效益下,每一步皆選取當時總效益最高的基地台,快速找出一組解作為 初始的修復排程,且由於各災區環境狀況不一,並沒有固定的最佳考量孤立台(子 樹) 階層數,因此在此階段將會對不同子樹階層都納入進行計算,此計算範圍分 類為周圍孤立台距離候選節點的階層數,不同的考量階層都會得出一組排程,再 從中選擇一組總救災效益最高的排程當做初始解。

第二階段演算法以初始的修復排程為基礎,考慮救災效益變化的速度,給予 一個變化指引,根據此指引反覆運算逐步找出更佳的解。如此,在限定時間內即 可提供一組不錯的修復排程,並且每當災區情況發生改變時能快速的重新運算修 改建構排程。

圖 11、提出之兩階段建構排程演算法

3.4.2、CCN-DS 演算法

各基地台 Profit 會隨著救災效益函數變化,而父節點必頇在子節點建構前被建構,

因此在選擇下一個被修復節點時,同時要考慮到更後面的子節點,以此為基礎 CCN-DS 第一階段貪婪演算法在選擇候選節點時,候選節點之預估 profit 為其本 身以及子樹(子節點)在此時間的 profit 總和,被加總的子樹 profit 會隨著與此候 選節點距離之增加而減輕比重,意即考慮周邊孤立台對此候選節點的重要性影響,

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

47

子樹階層越多的候選結點其重要性越高,而子樹階層權重越小代表子樹對此候選 節點影響越小,以圖 12 為例,假設距離 root 每增加 1 長度,權重即減 0.1,此 設定下節點 A 的預估 Profit:Profit(A)=1+(7+2)*0.9+(10+3+20+15)*0.8。

圖 12、加權 profit 計算示意圖

尋找周圍可連通的孤立台之中 profit 最高的節點當作下一修復基地台,以圖 13 為例,目前 schedule 為[A, B],候選節點:C=20, D=5, E=12,我們將選擇候選解 中加總預估 profit 最大的 C 加入 schedule 中得到新 schedule [A, B, C]。當所有孤 立台排入 schedule 第一階段貪婪演算法結束。

圖 13、候選節點示意圖

第二階段演算法是對每個救災效益函數給與一個優先權,考慮各孤立台對應的救 災效益函數優先權並與初始 profit 兩者進行計算得出一個孤立台優先權值,以此 優先權值為依據對初始 schedule 進行調整,期望得到更佳建構 CCN 排程,將於 4.2.3 節詳細介紹。

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

48

CCN-DS 演算法流程

第一階 CCN-DS 段演算法中之 Greedy Algorithm 設計

圖 14、第一階段 CCN-DS 演算法中 Greedy Algorithm 設計

◦ 第一階段CCN-DS貪婪演算法

圖 15、第一階段 CCN-DS 貪婪演算法設計

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

49

第二階 CCN-DS 段演算法

圖 16、第二階段 CCN-DS 演算法設計

CCN-DS 演算法虛擬碼 (Pseudo Code)

Algorithm(CCN_TreeData){

if(countTreeLevel < considnerTreeLevel){

if(LevelDecreasesWeight < 1){

initialSchedule = FirstPhase(TreeData, countTreeLevel, LevelDecreasesWeight);

} }

finalSchedule = SecondPhase(initialSchedule);

}

FirstPhase (TreeData, countTreeLevel, LevelDecreases){

while(NodeIsLegal && AllLegalNode!=null){

maxProfitNode = compare( countProfit(AllLegalNode) );

initialSchedule.add(maxProfitNode);

} }

if(nodeLevel < countTreeLevel && nodeLevelWeight > 0){

nodeProfit = profit(node,time) + profit(childrenNode, time)*childrenNodeLevelWeight;

} }

profit(node, time){

profit = nodeMathFunction(time);

}

SecondPhase (initialSchedule){

start with the lowest priority node;

while(the current node is not updated){

if(exists lower priority node preceding current node in the current Schedule){

update current schedule(move current node forward to the place preceding the highest among lower priority nodes) ;

} profit 分別為 21.9、15.6,使用 CCN-DS 演算法直到時間點四(圖 24)時, Schedule 為[A, B, E, C],候選節點:D、F、G,預估 profit 分別為 8、2、4,選 D 當下一 建構節點。

1. 時間點一,目前 Schedule : [A],候選節點 : [B,C],如圖 17

Profit(B)=10+(5+8)*0.9=21.7,Profit(C)=3+(10+4)*0.9=15.6,選[B] ,如圖 18

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

51

圖 17、時間點一之候選節點

圖 18、時間點一之候選節點選擇

2. 時間點二,目前 Schedule : [A, B],候選節點 : C、D、E,如圖 19 Profit(C)=4+(6+4)*0.9=13,Profit(D)=7,Profit(E)=15,選[E] ,如圖 20

圖 19、時間點二之候選節點

圖 20、時間點二之候選節點選擇

3. 時間點三,目前 Scheduling : [A, B, E],候選節點 : [C、D],如圖 21 Profit(C)=3+(4+4)*0.9=11.2,Profit(D)=9,選[C] ,如圖 22

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

52

圖 21、時間點三之候選節點

圖 22、時間點三之候選節點選擇

4. 時間點四,目前 Scheduling : [A, B, E, C],候選節點 : [D、F、G],如圖 23 Profit(D)=8,Profit(F)=2,Profit(G)=4,選[D] ,如圖 24

圖 23、時間點四之候選節點

圖 24、時間點四之候選節點選擇

‧ 國

立 政 治 大 學

N a tio na

l C h engchi U ni ve rs it y

53

相關文件