0% found this document useful (0 votes)
54 views39 pages

Lec 8

The document summarizes the Harmony Search algorithm, a metaheuristic optimization technique inspired by musical improvisation. It describes how the algorithm works by initializing parameters like harmony memory size and rates, then iteratively improvising new solution vectors and updating the harmony memory based on fitness evaluations. Applications mentioned include university timetabling, routing problems, engineering design, and hydrologic parameter calibration.

Uploaded by

Akram Ta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views39 pages

Lec 8

The document summarizes the Harmony Search algorithm, a metaheuristic optimization technique inspired by musical improvisation. It describes how the algorithm works by initializing parameters like harmony memory size and rates, then iteratively improvising new solution vectors and updating the harmony memory based on fitness evaluations. Applications mentioned include university timetabling, routing problems, engineering design, and hydrologic parameter calibration.

Uploaded by

Akram Ta
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Harmony Search Algorithm

by

Salwani Abdullah
[email protected]
Universiti Kebangsaan Malaysia

1
Contents:
Introduction
Harmony Search Algorithm, HS
Application of the HS
References

2
Introduction
◼ HS is a population based metaheuristic algorithm
inspired from the musical process of searching for
a perfect state of harmony.

◼ HS has been proposed by Geem et al. (2001).

◼ The pitch of each musical instrument determines


the aesthetic quality, just as the fitness function
value determines the quality of the decision
variables.

◼ In the music improvisation process, all players


sound pitches within possible range together to
make one harmony.
Introduction
◼ If all pitches make a good harmony, each player
stores in his memory that experience and the
possibility of making a good harmony is increased
next time.

◼ The same thing in optimization, the initial solution


is generated randomly from decision variables
within the possible range.

◼ If the objective function values of these decision


variables is good to make a promising solution,
then the possibility to make a good solution is
increased next time.
HS Algorithm
Musical Terms Optimisation Terms
Improvisation Generation or construction
Harmony Solution vector
Musician Decision variable
Pitch Value
Pitch range Value range
Audio-aesthetic standard Objective function
Practice Iteration
Pleasing harmony (near)-optimal solution

5
Harmony Search Algorithm

◼ Step 1: Parameter initialization


◼ Step 2: Harmony memory initialization
Step 3: Harmony memory improvisation
◼ Step 4: Harmony memory update
◼ Step 5: Check the termination criterion
◼ Step 6: Cadenza
7
Step 1: Parameter Initialization
(HMS)
◼ Harmony Memory Size (HMS): this
parameter represents the number of
solution vectors that are stored in the
Harmony Memory (HM). HMS is similar to
the population size in genetic algorithms.
HM representation of the stored solution vectors
Step 1: Parameter Initialization
(HMCR)
• Harmony Memory Consideration Rate
(HMCR): this parameter is used during the
improvisation process in order to determine
whether the value of a decision variable of a
new harmony will be selected from HM, or it
will be generated at random (from the
possible range that takes a value between
[0,1], for continuous problems). The
probability of randomly selecting the decision
variable from the possible range is given as
1-HMCR.
Step 1: Parameter Initialization
(PAR)
• Pitch Adjusting Rate (PAR): The PAR is also
used during the improvisation process to
determine whether to modify the value of the
decision variables that have been selected
from the HM to its neighbouring value or to
make no change. The PAR takes a value
between [0, 1].
Step 1: Parameter Initialization
(NI)
• Number of iterations (NI): The NI represents
the number of iterations that the HSA will be
repeated, which is treated as a stopping
criterion.
Step 2: HM Initialization
◼ HM is initialised, where it contains a set of
solutions with the size equal to HMS.
◼ The solution is represented by one-dimensional
vector. The size of the vector is equal to the size
of decision variables. Each cell in the vector
represents one decision variable.
◼ Each row in the HM represents one chromosome
(solution). Solutions in the HM are arranged in
reverse order based on the fitness values f(G).
 g 1
1 g1
2 ... g 1
N → f (G ) 
1

 2 
 g
2
1 g2
2 ... g 2
N → f (G ) 
HM =    ...  →  
 HMS −1 HMS −1 HMS −1 HMS −1 
 g1 g2 ... g N → f (G )
 g HMS g HMS ... g HMS
→ HMS 
f (G ) 
 1 2 N

Harmony Memory

14
Step 3: HM Improvisation

◼ In this step, a new harmony is improvised


based on the following three rules: (i)
memory consideration, (ii) pitch
adjustment and (iii) random consideration
Rule (i) Memory Consideration
• In this rule, a new random number r1 is
generated within the range [0,1].
• If r1 < HMCR, then the first decision variable
in the vector xij[new] is chosen randomly from
the values in the current HM as follows:

xijnew = xij, xij ∈ {𝑥1𝑗, 𝑥2𝑗, 𝑥3𝑗, … , 𝑥𝐻𝑀𝑆𝑗}

16
Rule (ii) Pitch Adjustment
• The obtained decision variables from the harmony memory
consideration rule is further examined to determine if it
needs to pitch adjustment (is like a mutation in the GA) or
not.
• A new random number r2 is generated within the range
[0,1].
• If r2 < PAR, then the pitch adjustment decision variable is
calculated as follows:
xijnew = xij ± rand[0,1].BW //for the continuous problem

where BW is a bandwidth factor which is used to control the


local search around the selected decision variable in the new
vector. Normally the BW is set to 1.

17
Rule (iii) Random Consideration
• If the condition r1 <HMCR fails (i.e. decision
variables that are not selected from the HM),
it will be selected randomly according to their
possible range of values as follows
xijnew = lij + (uij - lij). rand[0,1] where l, u is the
lower and upper bound for the given problem.
//for continuous problems
• For example, in the gene selection problems,
the possible range value is either 0 or 1.

18
Step 4: HM Update

• In this step, the fitness function of the new


harmony is calculated. It will replace the worst
one in HM if its fitness is better than it.

if (xnew < xworst) then


update the HM as xworst = xnew
end if
Step 5: Stopping Criterion

• The termination criterion is represented as the


number of improvisations or iterations. If the
termination criterion is met, the algorithm will
stop otherwise Step 3 and Step 4 are
repeated.
Step 6: Cadenza

• A cadenza can be referred to as the last step


that takes place at the end of the search
process. In this process, the HS returns the
best harmony ever found and stored in the
HM based on the fitness function.
Application of the HS
• University timetabling
• Routing problems
• Engineering optimization problems
• Nurse rostering problems
• Moving peak benchmark problems
• Gene selection problems

22
University Timetabling
Internet Routing
School Bus Routing Problem
15 10 20
5 5
8 4 10 School
9
8 7
10 5 20 4
15 10
4 4 5 6 6
5 7

5 7 10 4 5
15 5

Depot 1 2 3
3 5 8

Min C1 (# of Buses) + C2 (Travel Time)


s.t. Time Window & Bus Capacity
GA = $409,597, HS = $399,870
Parameter Calibration

RMSE: 1.305 (Powell), 0.969 (GA), 0.948 (HS)


Generalized Orienteering Problem
Max. Multi-Objectives
1. Natural Beauty
2. Historical Significance
3. Cultural Attraction
4. Business Opportunity

Case1 Case2 Case3 Case4 Case5


ANN 12.38 13.05 12.51 12.78 12.36
HS 12.38 13.08 12.56 12.78 12.40
Large-Scale Water Network Design

◼ Huge Variables
◆ (454 Pipes)

◼ GA = 2.3M Euro
◼ HS = 1.9M Euro
Hydrologic Parameter Calibration
I
O
Wedge Storage

= K xI t 
= K x (I - O)
St + (1 − x)Ot m

( )
n

2
Prism Storage
=KO SSQ = ˆ
Ot − O t
t =1

Mathematical = 143.60, GA = 38.23, HS = 36.78


Multi-Modal Function
References: Books on Harmony Search
MAXONE
STEP 1: Initialization
HMS = 5
HMCR = 0.6
PAR = 0.5

32
STEP 2: Harmony Memory Initialization
11101 |4
01110 |3
10101 |3
01100 |2
01010 |2

33
STEP 3: Harmony Memory Improvision

34
35
STEP 4: Harmony Memory Update

36
STEP 5: Check Termination Criterion
if yes
STEP 6
else
STEP 2

37
STEP 6: Cadenza
Return the best harmony

38
End of Presentation

You might also like