Algorithm 1 Harmonic search algorithm pseudo-code . |
---|
1: Define fitness value function fitness(t) = f(x), x = (x1, x2, x3, …, xn).n |
2: Define the generation range of harmony and the generating function of harmony. |
3: Set the algorithm parameters: harmony library size (HMS), harmony library value probability (HMCR), pitch adjustment probability (PAR), step size factor (BW), and maximum creation times (MAXGEN). |
4: Initialize the harmony library. |
5: Evaluate the fitness value of the sound library. |
6: Take the harmony best with the largest fitness value in the harmony library and set t = 0. |
7: whilet < MAXGEN − 1 do |
8: if random.random() < HMCR then |
9: if random.random() < PAR then |
10: Take a random harmony inv from the harmony library |
11: aa = np.random.randint(0,self.len,size = BW) |
12: fori = 0 → BW − 1 do |
13: Fine-tuning the variables corresponding to the harmony to obtain a new harmony invx. |
14: end for |
15: end if |
16: else |
17: Generate new harmony invx |
18: end if |
19: The new harmony invx is compared with the harmony invy with the worst solution in the harmony library, and updated if it is better than it. |
20: Update the harmony best with the maximum fitness value in the harmony library again. |
21: t = t + 1 |
22: end while |
Algorithm 1 Harmonic search algorithm pseudo-code . |
---|
1: Define fitness value function fitness(t) = f(x), x = (x1, x2, x3, …, xn).n |
2: Define the generation range of harmony and the generating function of harmony. |
3: Set the algorithm parameters: harmony library size (HMS), harmony library value probability (HMCR), pitch adjustment probability (PAR), step size factor (BW), and maximum creation times (MAXGEN). |
4: Initialize the harmony library. |
5: Evaluate the fitness value of the sound library. |
6: Take the harmony best with the largest fitness value in the harmony library and set t = 0. |
7: whilet < MAXGEN − 1 do |
8: if random.random() < HMCR then |
9: if random.random() < PAR then |
10: Take a random harmony inv from the harmony library |
11: aa = np.random.randint(0,self.len,size = BW) |
12: fori = 0 → BW − 1 do |
13: Fine-tuning the variables corresponding to the harmony to obtain a new harmony invx. |
14: end for |
15: end if |
16: else |
17: Generate new harmony invx |
18: end if |
19: The new harmony invx is compared with the harmony invy with the worst solution in the harmony library, and updated if it is better than it. |
20: Update the harmony best with the maximum fitness value in the harmony library again. |
21: t = t + 1 |
22: end while |
Algorithm 1 Harmonic search algorithm pseudo-code . |
---|
1: Define fitness value function fitness(t) = f(x), x = (x1, x2, x3, …, xn).n |
2: Define the generation range of harmony and the generating function of harmony. |
3: Set the algorithm parameters: harmony library size (HMS), harmony library value probability (HMCR), pitch adjustment probability (PAR), step size factor (BW), and maximum creation times (MAXGEN). |
4: Initialize the harmony library. |
5: Evaluate the fitness value of the sound library. |
6: Take the harmony best with the largest fitness value in the harmony library and set t = 0. |
7: whilet < MAXGEN − 1 do |
8: if random.random() < HMCR then |
9: if random.random() < PAR then |
10: Take a random harmony inv from the harmony library |
11: aa = np.random.randint(0,self.len,size = BW) |
12: fori = 0 → BW − 1 do |
13: Fine-tuning the variables corresponding to the harmony to obtain a new harmony invx. |
14: end for |
15: end if |
16: else |
17: Generate new harmony invx |
18: end if |
19: The new harmony invx is compared with the harmony invy with the worst solution in the harmony library, and updated if it is better than it. |
20: Update the harmony best with the maximum fitness value in the harmony library again. |
21: t = t + 1 |
22: end while |
Algorithm 1 Harmonic search algorithm pseudo-code . |
---|
1: Define fitness value function fitness(t) = f(x), x = (x1, x2, x3, …, xn).n |
2: Define the generation range of harmony and the generating function of harmony. |
3: Set the algorithm parameters: harmony library size (HMS), harmony library value probability (HMCR), pitch adjustment probability (PAR), step size factor (BW), and maximum creation times (MAXGEN). |
4: Initialize the harmony library. |
5: Evaluate the fitness value of the sound library. |
6: Take the harmony best with the largest fitness value in the harmony library and set t = 0. |
7: whilet < MAXGEN − 1 do |
8: if random.random() < HMCR then |
9: if random.random() < PAR then |
10: Take a random harmony inv from the harmony library |
11: aa = np.random.randint(0,self.len,size = BW) |
12: fori = 0 → BW − 1 do |
13: Fine-tuning the variables corresponding to the harmony to obtain a new harmony invx. |
14: end for |
15: end if |
16: else |
17: Generate new harmony invx |
18: end if |
19: The new harmony invx is compared with the harmony invy with the worst solution in the harmony library, and updated if it is better than it. |
20: Update the harmony best with the maximum fitness value in the harmony library again. |
21: t = t + 1 |
22: end while |
This PDF is available to Subscribers Only
View Article Abstract & Purchase OptionsFor full access to this pdf, sign in to an existing account, or purchase an annual subscription.