• 沒有找到結果。

Temporal analysis for duration modification

4.3 EAI 時間表

當工作流程規格考量時間因素的情況下,除了能利用 3.4 節當中介紹的分 支路徑資源串列記錄來輔助外,此節介紹的EAI 時間記錄表,可用來記錄所有 processes 的 EST 與 LET 資料。這些記錄的維護是當使用者對工作流程規格 有新增、刪除 process,或改變 process 的工作時限 (durations),則更新受到影 響的各個欄位內容。利用這個記錄表就不必等到檢驗時才在每個檢查迴圈當中 從Start node 重新計算所有 processes 的 EST 與 LET 值,由此加速檢驗時的效 率。在稍後第五章的劇本範例中將有使用 EAI Table 方法的解說。

4.4 考慮時間因素的遞增式分析

承續4.2 節最後Algorithm 10 關於 durations 改變的討論,可以發現互動 式演算法僅能列出現有的資源衝突,但未能精確的指出一次編輯所新增或消除 掉哪些資源衝突。在此將各種activity process nx的編輯狀況列入一個表中,並 加以說明,以方便稍後描述遞增式演算法時採用。表格當中 RC 代表資源衝突 的數量:

Operation on nx nx nxi, descendant of nx

d’(nx)>d(nx)

D’(nx)>D(nx) LET’(nx)↑→RC↑ EST’(nxi)↑→RC↓

LET’(nxi)↑→RC↑

d’(nx)>d(nx)

D’(nx)<D(nx) LET’(nx)↓→RC↓ EST’(nxi)↑→RC↓

LET’(nxi)↓→RC↓

d’(nx)<d(nx)

D’(nx)>D(nx) LET’(nx)↑→RC↑ EST’(nxi)↓→RC↑

LET’(nxi)↑→RC↑

d’(nx)<d(nx)

D’(nx)<D(nx) LET’(nx)↓→RC↓ EST’(nxi)↓→RC↑

LET’(nxi)↓→RC↓

Table 1 Temporal operations on process nx

觀察此表當中 nx的 LET’下降時,伴隨著資源衝突數量的下降,這些減少 的資源衝突,可先用分支路徑的資源串列記錄,快速查出針對process nx已存在 的資源衝突集合,針對當中各元素(r, nx, ni)進行下列判斷式:

[EST(nx), LET(nx)]∩[EST(ni), LET(ni)]⊆ [LET’(nx), LET(nx)]

檢查若上述式子成立時,則 (r, nx, ni) 為一組會被消除的資源衝突。至於 nxi 的 LET 改變時可比照相同方法進行分析比較,直到 End node 或某個 descendant process nxj 的 LET’(nxj) = LET(nxj),此時意味著 nx所影響到的path 無法提供 LET(nxj) 的最大值,而檢驗分析也可到此為止,因為不再影響到 nxj

之後的descendant processes。上述判斷式當中 EST/LET 值都可透過 EAI 時間表 來查詢,而修改的部分僅需重新計算 LET’(nx),因此可對這個判斷式進行快速 的檢查。

當nxi的EST’延遲,則可能帶來部分資源衝突消除,下列判斷式可檢查 (r, nxi, ni) 的已存在衝突是否被消除:

[EST(nxi), LET(nxi)]∩[EST(ni), LET(ni)]⊆ [EST(nxi), EST’(nxi)]

同樣的,當依據上述判斷式依序判斷nxi的descendant processes,直到 End node 或某個 descendant process nxj 的 EST(nxj) = EST’(nxj),此時意味著 nx所影 響到的path 無法提供 EST(nxj) 的最小值,而檢驗分析也可到此為止,因為不

至於 LET’(nx)與 LET’(nx)的延遲,造成新增的資源衝突,僅需根據以下檢 驗式來進行檢查。其中nj為相對於nx,符合資源衝突定義中第一與第二條件者:

[LET(nx), LET’(nx)]∩[EST(nj), LET(nj)] ≠φ

依據上述判斷式依序判斷nx的descendant processes nxi,將nxi代入nx直到 End node 或某個 descendant process nxj 的 LET(nxj) = LET’(nxj),此時意味著 nx

所影響到的path 無法提供 LET(nxj) 的最大值,檢驗分析可到此為止,因為不會 影響到nxj之後的descendant processes。

最後分析EST’(nxi)的提前,造成新增的資源衝突,則根據以下檢驗式來進 行檢查。其中 nj 為相對於nx,符合資源衝突定義中第一與第二條件者:

[EST’(nxi), EST(nxi)]∩[EST(nj), LET(nj)] ≠φ

根據上述判斷式依序判斷nxi的descendant processes,直到某個 descendant process nxj 的 EST(nxj) = EST’(nxj),此時意味著 nx所影響到的 path 無法提供 EST(nxj) 的最小值,而檢驗分析也可到此為止,因為不再影響到 nxj 之後的 descendant processes。

上述四個檢驗式,目的在於利用已知的背景知識,快速比對出編輯修操作 所造成哪些資源衝突新的增或消去,而非使用 T_CPV 互動式的方法以資源衝 突的第三個定義作判斷。如同 3.4 節當中描述,以下先以流程圖來描述考慮時 間因素下的遞增式分析:

(1)(2)的演算法與 3.4 節中的討論相同。在此僅描述(3)的演算法 CTO (Checking Time Overlapping) 如下,從(2)傳入的資源衝突集合,做一個篩選比 對,符合時間重疊的判斷式時予以留下,否則就從集合中刪除該項資源衝突。

void CTO(conflict set RC, EXP TIME_EXP) 1 {

2 // Checking working time overlapping with expression EXP 3 for each resource conflict (r, n, ni) in RC

4 if not (TIME_EXP) then

5 remove (r, n, ni) from RC;

6 }

此處的判斷式暫以 EXP 表示,而不以 2.4 節的 EAI 重疊的定義來做檢 驗,為的是保留這個判斷式的彈性以符合本節所討論的 EST 與 LET 的提前、

延後所造成資源衝突的影響。EXP 的類型包括以下幾種,其中 n 表示受到編 process,而 n 為來自(2)的集合中與 n 成對的衝突 process:

(1) Collect p, a set of all

the SPLIT_PATHs parallel with process n by backtracking from n to start point of ws, and update the resource list on the split path SP where n

(2) Check Resource Dependency and collect the resource conflicts set by RLSPi.ProcessRef(r) records,SPi ∈ p

(3) Check overlaps of working time of each pair of conflicting processes

(a) [EST(n), LET(n)]∩[EST(ni), LET(ni)] ≠φ

void T_IAC(workflow specification ws, process n, resource r , EXP E) 1 {

2 SPLIT_PATH SET P=φ; // to store parallel AND-SPLIT paths of n 3 CONFLICT SET RC=φ; // resource conflicts set

4

5 // Finding all parallel SPLIT_PATHs with n 6 P = CSP(ws, n, r);

7 // Checking resource dependency 8 RC = CRD(P, n, r);

9 // Checking working time overlapping 10 CTO(RC, E);

11

12 // showing information to users

13 for each resource conflict (r, n, ni) in RC

14 printf(“There is a resource conflict ”, (r, n, ni));

15}

接下來根據Table 1 中考慮各種改變 duration 操作,其遞增式演算法 T_CDM (Checking Duration Modification)為:

void T_CDM(workflow specification ws, process n, EST’, LET’) 1 {

2 CONFLICT SET RC=φ; // resource conflicts set 3

4 if LET’(n)<LET(n) then // it may reduce resource conflicts 5 {

6 for each r ∈ R(n)

7 RC=RC+T_IAC(ws, n, “[EST(n),LET(n)]∩[EST(ni),LET(ni)]⊆[LET’(n),LET(n)]”);

8 for each resource conflict (ri, n, nj) in RC

9 printf(“resource conflict ”, (ri, n, nj), “ is removed.”);

10 }

11 else if LET’(n)>LET(n) then // it may increase resource conflicts 12 {

13 for each r ∈ R(n)

14 T_IAC(ws, n, r, “[LET(n),LET’(n)]∩[EST(ni),LET(ni)] ≠φ”);

15 } 16

17 if EST’(n)<EST(n) then // it may increase resource conflicts 18 {

19 for each r ∈ R(n)

20 T_IAC(ws, n, r, “[EST’(n),EST(n)]∩[EST(ni),LET(ni)] ≠φ”);

21 }

22 else if EST’(n)>EST(n) then // it may reduce resource conflicts 23 {

24 for each r ∈ R(n)

25 RC=RC+T_IAC(ws, n, “[EST(n),LET(n)]∩[EST(ni),LET(ni)]⊆[EST(n),EST’(n)]”);

26 for each resource conflict (ri, n, nj) in RC

27 printf(“resource conflict ”, (ri, n, nj), “ is removed.”);

28 }

29 if (EST’(n)≠EST(n)) or (LET’(n)≠LET(n)) then 30 for each child process n’ of n

31 T_CDM(ws,n’);

32}

而當新增/刪除activity process n 時該採取的分析方法,則類似前述兩個 演算法的組合運用,針對n 本身的各項資源參考進行如同新增/刪除一項資源 的檢驗,而對其descendent processes 則以 T_CDM 遞回的方式檢查那些 EST 與 LET 受改變的範圍。詳細內容描述如下:

CONFLICT SET T_IAC_ACTIVITY(ws, n) 1 { (Operation based incremental analysis for conflict with temporal consideration,根據 操作類型來處理的遞增式資源衝突分析) 如下:

void T_OBIAC(workflow specification ws, process n, operation OP) 1 {

2 CONFLICT SET RC=φ; // resource conflicts set 3

4 if (OP=”ADD OR REMOVE A RESOURCE”) then 5 T_IAC(ws, n, r);

6 else if (OP=”CHANGING DURATIONS”) then 7 T_CDM(ws, n, EST’(n), LET’(n));

8 else if (OP=” ADD OR REMOVE AN ACTIVITY”) then 9 T_IAC_ACTIVITY(ws, n);

10}

Algorithm 11 Operation based incremental analysis with temporal