Research Article

A Proposed Harmony Search Algorithm for Honeyword Generation

Algorithm 1

The general steps of the harmony search algorithm [36].
Step 1: Set up the optimization issue and algorithm parameters (N, HMCR, PAR, and bw).
Step 2: Create a harmony memory (HM).
N of harmonies are generated (randomly) in the search space and stored in HM at first.
Step 3: Create a new harmony from the HM.
1st stage: A random number in the range (0, 1) is produced (rand).
If rand > HMCR, the new harmony’s decision variable (xnew,j) is created at random. Harmony memory rate (HMCR) is an acronym for harmony memory rate, which ranges from (0, 1).
If rand =< HMCR is not specified, one of the harmonics stored in HM is chosen at random, for example, k where 1 =< k =< N. The matching value of harmony k from HM is then used to choose xnew,j.
2nd stage: Using a pitch adjustment, the improvised note can be moved to a neighboring value within the range of possibilities. Pitch adjusting rate (PAR) is a parameter in HS that is in the range (0, 1). After 1st stage, a random number that is in the range (0, 1) with uniform distribution is produced to execute the pitch adjustment method (rand). If rand =< PAR is true, bw should be used to move the improvised note to an adjacent value. Where bw is a random distance bandwidth (a scalar value), bandwidth equals the maximum pitch adjustment change. If rand > PAR, the improvised note remains unchanged.
Step 4. Update the HM.
In HM, compare the new harmony to the worst harmony. If the new one has higher fitness than the poorest one in the HM, it will take its position. Otherwise, it will be removed.
Step 5: Continue using Steps 3 and 4 until the termination condition is met.