<jupyter_start><jupyter_text>Intro(may help me in understanding)SEES introduces a new election heuristic for choosing a set ofnodes called ZAG (Zone Aggregation Group) in every zone.The task of ZAG is to collect data from other member nodes,perform the data aggregation and forward to the EH relaynodes. We call this heuristic as MSWE1) MSWE is a general solution that supports up tom different parameters ( p = p1, p2, p3,…, pm ) arranged in mdifferent levels of importance ( g = g1, g2, g3,…, gm ).2) However,it selects ZAG in m consecutive stages (stage-1, stage-2,stage-3, ..., stage-m) based on a set of given weights of importance( w = w1, w2, w3,…, wm ). In each stage, one of the givenparameters is taken as the dominant parameter (most importantparameter) and is given the highest weight (in a stage-i,the dominant parameter is pi and is given w1 ).3) MSWE runs intwo main procedures: (1) electing the ZAG member nodes, and(2) assigning some of ZAG member nodes as zone aggregators( ZAs ) for the current transmission round.SEES provides a general model to generate the set ofweights w used in MSWE. The weight wi assigned to theparameter in the importance level gi is given according tothe following formula:                            wi = 𝜇 × wi−1, for i = 2, 3,…,m and 0 < 𝜇 ≤ 1                            where w1 + w2 + w3 +...+ wm = 1𝜇 is the weighting factor defined in advance by theadministrator based on some considerations (e.g., applicationnature and election parameters used).<jupyter_code>#from simulation parameters we get 𝜇 value
𝜇 = float(input("Enter the 𝜇 value"))
m = int(input("Enter m value"))
print(𝜇,m)<jupyter_output>Enter the 𝜇 value0.5
Enter m value3
0.5 3<jupyter_text>w2 = 𝜇 × w1 = pow(𝜇,1) × w1                                        w3 = 𝜇 × w2 = 𝜇 × 𝜇 × w1 = pow(𝜇,2) × w1                                        w4 = 𝜇 × w3 = 𝜇 × 𝜇 × 𝜇 × w1 = pow(𝜇,3) × w1                                        wi = pow(𝜇,i−1) × w1                                                                                w1 + w2 + w3 +⋯+ wm = 1                                                                                w1 + 𝜇 × w1 + pow(𝜇,2) × w1 +⋯+ pow(𝜇,m−1) × w1 = 1                                                                                w1 =  1/(1+𝜇+pow(𝜇,2)+....+pow(𝜇,m))<jupyter_code>#finding initial weight
sum = 0
for i in range(0,m):
    sum =sum + math.pow(𝜇,i)
    
w1 = 1/sum

print(sum,w1)

weights = [w1]

#for remaining weight

for i in range(1,m):
    weights.append(𝜇*weights[i-1])
    
print(weights)#these weigths are used in every stage of ZAG election without any change in their value


#testing condition ,mah.fsum is used for computing sum of float values
if (math.fsum(weights) == 1):
    print("No Error in weights")
else:
    print("Error in weights")<jupyter_output>1.75 0.5714285714285714
[0.5714285714285714, 0.2857142857142857, 0.14285714285714285]
No Error in weights<jupyter_text>the zone aggregationgroup ( ZAG ) is selected in m consecutive stages based onthe WLC (weighted linear combination) concepts. WLC is asimple weighting-based addition in which the values of severalparameters/criteria of an element are, first, standardized/scaled to a common numerical range. Then, added using theweighted average method. The final score ( Scj ) of an elementj (a node in our case) is attained by multiplying the standardizedvalue of each parameter/criteria of that element ( Pji ) bythe corresponding weight of importance ( wi ) assigned to theparameter; and then adding the product of all these values asfollows                pow(Sc,j) = pow(P1,j)*wi + pow(P2,j)*w2 + pow(P3,j)*w3 +......+ pow(Pm,j)*wmThen, the total scores of allthe alive HN nodes in the network ( N1st = Nalv ) are calculatedusing Eq. (18) (the first parameter has the highest weight ofimportance, and the last one has the least weight). Nodesthen are sorted in descending order according to their computedscores. Only the top v%(constant is predefined) nodes are taken as inputs tothe second stage. We call these nodes as the robust nodes,In the second stage (stage-2) the new inputnodes (total number is N2st ) are scored again and sorted in thesame way. But here, the second parameter is considered asthe most important (first/dominant parameter) and is giventhe highest weight ( w1 ). To generalize, in stage-i, the pi parameter is taken as the most important parameter and given the highest weight ( w1 ). The parameters above the pi are shifted one step to the lower importance level, whereas those below the pi remain in the same level of their importance. This procedure continues m times.                                            pow(Nst,i+1) = v%* pow(Nst,i)  First we will implement for a single round then we will loop it m number of times<jupyter_code>inputs<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07775020678246485, 'fraction_numerical': 0.032671629445823, 'mean_word_length': 2.808661417322835, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 22, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '485839', 'license': 'MIT', 'n_tokens_mistral': 1521, 'n_tokens_neox': 1426, 'n_words': 646, 'path': 'Multi-stage weighted election heuristic step by step implementation.ipynb', 'repo_name': 'papanisaicharan/Scalable-energy-efficient-scheme-on-mobile-nodes', 'size': '4836'}