Research Article
Cost-Effective Resource Provisioning for Real-Time Workflow in Cloud
Algorithm 4
Dynamic programming knapsack algorithm.
(1) | procedure (DPK(TW, VMs, D)) | (2) | if D × P1 < TW then | (3) | return Failure; | (4) | else | (5) | m ⟵ the number of VMs; | (6) | TW1 ⟵ TW; | (7) | x1 ⟵ ⌈TW1/P1⌉; | (8) | f1 ⟵ x1 × PRICE1; | (9) | for j = 2 to m do | (10) | TWj ⟵ TWj−1 − (xj−1 − 1) × Pj−1; | (11) | xj ⟵ ⌈TWj/Pj⌉; | (12) | fj ⟵ fj−1 − PRICEj−1 + xj × PRICEj; | (13) | if fj ≥ fj−1 or xj−1 − 1 + TWj/Pj > D then; | (14) | fj ⟵ fj−1; | (15) | xj ⟵ 0; | (16) | else | (17) | xj−1 ⟵ xj−1 − 1; | (18) | end if | (19) | end for | (20) | return X; | (21) | end if | (22) | end procedure |
|