├── ACCO.py ├── Cloud Computing - Presentation (Vatsal, Arjav, Ananya).pdf ├── Images ├── Image 1.png ├── Image 2.png ├── Values - 1.jpg └── Values - 2.jpg └── README.md /ACCO.py: -------------------------------------------------------------------------------- 1 | # Cloud-MEC Optimal Collaborative Computation Offloading(CMOCO) solution - 2 | # Approximation Collaborative Computation offloading algorithm (ACCO) 3 | from __future__ import division 4 | import sys 5 | # N is the total number of MDs 6 | 7 | N = int(input("enter the number of MDs: ")) 8 | if N==0: 9 | print("enter a value greater than or equal to 1") 10 | N = int(input("enter the number of MDs: ")) 11 | N_set=[]*N 12 | for i in range(0,N): 13 | N_set.append(i) 14 | # K is the maximum number of wireless channels availaible 15 | K = int(input("enter the maximum number of wireless channels availaible: ")) 16 | if K==0: 17 | print("enter a value greater than or equal to 1") 18 | K = int(input("enter the maximum number of wireless channels availaible: ")) 19 | # array of tasks 20 | t_max=[]*N # maximum permissible latency 21 | m = []*N # size of computation input data 22 | c = []*N # number of CPU cycles required 23 | for i in range(0,N): 24 | x = float(input("enter the value of maximum permissible latency for MD %i: " %i)) 25 | t_max.append(x) 26 | y = float(input("enter the value of computation input data %i: " %i)) 27 | m.append(y) 28 | z = int(input("enter the number of maximum CPU cycles %i: " %i)) 29 | c.append(z) 30 | f_local = []*N # computing abilty of MD i per CPU cycle 31 | y_local = []*N # consumed energy per CPU cycle 32 | transmit_power = []*N # transmit power of MD i 33 | r = []*N # uplink data rate of transmitting from MD i to the wireless BS via a wireless access 34 | for i in range(0,N): 35 | x = float(input("enter the computing capability of MD %i: " %i)) 36 | f_local.append(x) 37 | y = float(input("enter the consumed energy of MD %i: " %i)) 38 | y_local.append(y) 39 | z = float(input("enter the transmit power of MD %i: " %i)) 40 | transmit_power.append(z) 41 | v = float(input("enter the uplink data rate from MD %i to BS : " %i)) 42 | r.append(v) 43 | # computing ability of MEC 44 | f_mec = float(input("enter the computing capability of MEC: ")) 45 | # uplink data rate of the optical fiber network 46 | c_bs = float(input("enter the uplink data rate of the optical fiber network: ")) 47 | # uplink propogation delay (optical backbone network) 48 | tau = float(input("enter the uplink propogation delay: ")) 49 | # number of optical amplifying from ONU BS to CCC 50 | n = int(input("enter the number of optical amplifying: ")) 51 | 52 | 53 | # OUTPUT 54 | # optimal computation offloading decision list S 55 | S = []*N 56 | # total minimum energy consumption 57 | E_min = 0 58 | 59 | # FUNCTIONS 60 | # functions to calculate total processing time 61 | def compute_local(ci,f_local): # for local execution model 62 | return (ci/f_local) 63 | 64 | def compute_mec(mi,ri,c_bs,ci,f_mec): # for mobile-edge execution model 65 | a= mi/ri 66 | b=mi/c_bs 67 | g= ci/f_mec 68 | return(a+b+g) 69 | 70 | def compute_ccc(mi,ri,n,c_bs,tau): # for centralised cloud execution model 71 | a=mi/ri 72 | b=n*(mi/c_bs) 73 | return(a+b+tau) 74 | 75 | # functions to calculate the total consumed energy 76 | def energy_local(ci,y_local): # for local execution model 77 | return (ci*y_local) 78 | def energy_mec(pi,t_mec): # for mobile-edge execution model 79 | return(pi*t_mec) 80 | def energy_ccc(pi,t_ccc): # for centralised cloud execution model 81 | return(pi*t_ccc) 82 | 83 | # procedure to determine offloading decision 84 | def offloading_decision_procedure(P): 85 | for p in P: 86 | e_mec = energy_mec(transmit_power[p],compute_mec(m[p],r[p],c_bs,c[p],f_mec)) 87 | e_ccc = energy_ccc(transmit_power[p],compute_ccc(m[p],r[p],n,c_bs,tau)) 88 | if e_mec <= e_ccc: 89 | S_mec.append(p) 90 | else: 91 | S_ccc.append(p) 92 | 93 | # MAIN ALGORITHM 94 | M = []*N 95 | P = []*N 96 | S_local = []*N 97 | S_mec = []*N 98 | S_ccc= []*N 99 | for i in range(0,N): 100 | t_local=compute_local(c[i],f_local[i]) 101 | t_mec=compute_mec(m[i],r[i],c_bs,c[i],f_mec) 102 | t_ccc=compute_ccc(m[i],r[i],n,c_bs,tau) 103 | if min(t_local,t_mec,t_ccc) > t_max[i]: 104 | N_set.remove(i) 105 | if len(N_set)==0: 106 | sys.exit("No offloading scheme possible") 107 | else: 108 | N=len(N_set) 109 | for j in N_set: 110 | t_local = compute_local(c[j],f_local[j]) 111 | if t_local>t_max[j] and len(M)