3. Contents
• Introduction of Harmony Improvisation
• Analysis of Harmony Improvisation
• Analogy Music and Optimization
• Basic Elements of HSA
• Three main procedures (every iteration)
• HSA behavior (movie)
• Publication Trend ( No. and fields)
• Steps of Harmony Search Algorithm
• Modifications to the original HS algorithm
• MATLAB code sample (Sphere Function)
4. Introduction
• Harmony in nature is a special relationship between several
sound waves that have different frequencies.
• Even in ancient civilizations, the relation between music and
mathematics was considered to be essential, but only recently
scientists found an interesting connection between
optimization techniques and music.
• The music-inspired harmony based optimization algorithm; the
algorithm is based on the observation that the aim of music
creation is the quest of the perfect state of harmony
5. Introduction
• in the same way a music band improves rehearsal after
rehearsal, HSA improves iteration after iteration.
• The term Harmony in music refers to the sound result caused
from two or more instruments that play at the same time.
harmony evaluates the relation between two or more sound-
waves and their interaction. This interaction is crucial for the
final result and specifies if it is pleasant or not.
6. Analysis of Harmony Improvisation
Seeking Harmony in Music.
• The new algorithm was inspired by the improvisation process
that a skilled musician follows when he is playing in a music
band. the following choices:
• a. To play the famous Obviously, every member of the band
knows the theme and can play it by heart. In other words all
musicians have this melody in their minds
• b. play something similar to the theme. Very often, musicians
try to enrich a music piece slightly changing or adjusting
pitches of the memorized theme.
• c. This choice, which is so common in Jazz music, gives the
freedom to the musician to play random tunes. The performer
uses his talent
12. Basic Elements of HSA
• Harmony: Harmony is similar to the gene in GA. It is the set
of the values of all the variables of the objective function.
• Harmony Memory (HM): The places where harmonies are
stored.
• Harmony Memory Size (HMS): The number of places that
HM has. The best harmony is stored in the 1st place and the
rest harmonies are classified according to their performance.
Definition of HMS is an important part of the calibration of the
model.
• Maximum number of Iterations (MaxIter): Defines the
termination criterion. It is similar to the maximum number of
generations in GA.
13. Basic Elements of HSA
• Harmony Memory Considering Rate(HMCR)
• pitch adjusting rate (PAR)
• fret width (FW)
• a fret is the metallic ridge on the neck of 5 a string
instrument (such as guitar), which divides the neck into
fixed segments
15. Three main procedures (every iteration)
1. HS is choosing any value from HS Memory. This process is
defined as Memory Consideration and it is very important
because it ensures that good harmonies will be considered
through the solution.
– Harmony Memory Considering Rate (HMCR) :This index will
specify the probability that new harmony will include a value
from the historic values that are stored in the Harmony Memory.
(Typical values of HMCR are typically from 70% to 95% )
• HMCR Intensification
• HMCR Diversification
16. Three main procedures (every iteration)
2. Every component of the new harmony chosen from HM, is
likely to be pitch-adjusted. For example a Pitch Adjusting Rate
(PAR) of 10%, indicates that algorithm will choose neighboring
values for the 10% of the harmonies chosen from HM. The
new harmony will include the value xi new which will be:
• Pitch Adjustment is similar to Mutation procedure in GA and
typically is between 0.1 to 0.5, FW normally ranges from 1%
to 10% of total value range
17. Three main procedures (every iteration)
3. The third choice is to select a totally random value from the
possible value range. Randomization occurs with probability
(100-HMCR)% and increases the diversity of the solutions.
Although pitch adjustment has a similar role, it is limited in a
local area. Randomization can drive the algorithm to explore
the whole range and attain the global optimality.
25. HS VS Other Meta-Heuristics
• It preserves the history of past vectors (Harmony Memory)
similar to TS
• able to vary the adaptation rate (Harmony Memory
Considering Rate) from the beginning to the end of
computation resembling SA
• manages several vectors simultaneously in a manner similar
to GA. However, the major difference between GA and HS is
that HS makes a new vector from all the existing vectors (all
harmonies in the Harmony Memory), while GA makes the new
vector only from two of the existing vectors (the parents)
26. Modifications to the original HS algorithm
• Alternative initialization procedures for HM, or an extended
HM structure
• Originally fixed parameter values were used. However,
some researchers have proposed changeable parameter
values. Mahdavi et al. [4] suggested that PAR in-crease
linearly and FW decrease exponentially with iterations:
27. Modifications to the original HS algorithm
• Options for handling constraints during generation of new
harmonies
• Modifications to the algorithm’s structure, that is, adding or
removing blocks and changing the processing sequence in
the flowchart
29. SAMPLE (Travel Salesman Problem)
• each musical instrument in HM is substituted with a variable
assigned for each city. Linking each city to its next assigned
city creates one of the possible tours.
• The length of the tour is compared with those of existing tours
in HM. If the new length is shorter than any of existing tour
lengths, the new tour is included in HM, and the worst tour
(longest tour) is excluded from HM.
• 30 runs, HMCR = 0.85 - 0.99, HM = 10 – 100, 20,000
iterations, Seven out of 30 runs have reached global optimum.