Mais conteúdo relacionado Semelhante a Solving np hard problem using artificial bee colony algorithm (20) Mais de IAEME Publication (20) Solving np hard problem using artificial bee colony algorithm1. INTERNATIONALComputer VolumeOF COMPUTER ENGINEERING
International Journal of Engineering and Technology (IJCET), ISSN 0976-
JOURNAL 4, Issue 1, January- February (2013), © IAEME
6367(Print), ISSN 0976 – 6375(Online)
& TECHNOLOGY (IJCET)
ISSN 0976 – 6367(Print)
ISSN 0976 – 6375(Online)
Volume 4, Issue 1, January- February (2013), pp. 171-177
IJCET
© IAEME: www.iaeme.com/ijcet.asp
Journal Impact Factor (2012): 3.9580 (Calculated by GISI) ©IAEME
www.jifactor.com
SOLVING NP-HARD PROBLEM USING
ARTIFICIAL BEE COLONY ALGORITHM
Lalit Kumar1, Dr. Dheerendra Singh2
1
M.Tech Scholar, Department of CSE, SUSCET Tangori, Mohali, India
2
Professor and Head, Department of CSE, SUSCET, Tangori, Mohali, India
E-mail: 1lalit.cse@gmail.com, 2professordsingh@gmail.com
ABSTRACT
In this paper we present a artificial bee colony (ABC) algorithm for NP- Hard
problems. This algorithm is considered as one of the newest nature-inspired swarm-based
optimization algorithms and has a promising performance. Shortest Common Supersequence
is a classical problem in the field of string and it is classified as NP-Hard problem, such as
Genetic algorithms, Majority Merge algorithm and Ant Colony Algorithm [1]. This
approach obtains better results than the original artificial bee colony algorithm.
KEY-WORDS: Artificial Bee Colony, Nature Inspired Algorithm, Shortest Common
Supersequence Problem, Swarm Intelligence.
1. INTRODUCTION
Several approaches have been proposed for solving optimization problems. In recent
years, the research trend focuses more on heuristic methods rather than the traditional
methods to solve the optimisation problems. Swarm intelligence for example focuses on the
behavior of insects to develop some meta-heuristics which can mimic the insect’s problem-
solving. Artificial bee colony (ABC) [2] algorithm is a part of swarm intelligence algorithms
that mimics the natural behavior of real honey bees on searching for food sources. The
selection of a best element from some set of available alternative referred as optimization
problem. In many such problems, exhaustive search is not feasible. It has important
application in several fields, including artificial and intelligence, NP-hard problem in
combinatorial optimization studied in operations research. For example Shortest Common
Supersequence problem and Solving Shortest Common Supersequence Problem. It has
171
2. International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 1, January- February (2013), © IAEME
several applications, such as planning, logistics, network communication, transportation and
manufacture of microchips. SCS states that for one salesman who wants to visit cities and
given distance between them. Shortest Common Supersequence has to visit all of them, but
he doesn’t to travel very much. Task is to find a sequence of cities to minimize travel
distance[1]. Combinatorial optimization problems have attracted much attention of
researchers over the years. Many of combinatorial optimization problems are NP-hard [1, 2],
which means they cannot be solved to optimality within polynomially-bounded computation
times. Several algorithms, including population-based algorithms, have been developed that
can find near-optimal solutions within reasonable running times. The swarm-based algorithm
introduced in this paper to solve a single machine scheduling problem is a new population-
based search algorithm capable of locating good solutions efficiently. The algorithm is
inspired by the food foraging behavior of honey bees and could be regarded as an
“intelligent” optimization tool [3]
Artificial Bee Colony (ABC) algorithm is a branch of newly developed from of artificial
intelligence called Swarm Intelligence, which proposed by Karaboga and Basturk in 2006 to
solve NP-hard optimization problems [24]. In groups of insects which live in colonies like the
ants and bees, an individual only can do simple task on its own, while the cooperative work
of colony is the main reason determining the intelligent behavior of them. ABC algorithm
inspired of the natural behavior of real honey bees in their search process for the best food
sources in case of the nectar quality and the food source position. A colony of honey bees can
extend itself over long distances in order to exploit a large number of food sources. In ABC
algorithm, a bee colony contains of three kinds of bees: employed, scout and onlooker bees
[25]. The employed bees carry with them information about the food sources that they found
them, consist of the direction of food sources, and the nectar amount of them. The scout bees
are searching the environment surrounding the nest for finding the new better food sources.
And onlookers waiting in the hive and finding the optimal food source through the shared
information by the employed bees[4]. In ABC, a food source position represents a possible
solution for the optimization problem. Therefore, at the initialization step, a set of food
source positions are randomly considered. The nectar amount of a food source corresponds to
the quality of the solution represented by that source searched by the bee. So the nectar
amounts of the food source existing at the initial positions are determined. On the other hand ,
the quality values of the initial solutions are calculated. Each employed bee is moved onto her
food source area for determining a new food source within the neighborhood of the present
one by guidance of the scout bee; then its nectar is evaluated. ABC algorithm can be applied
to any optimization problem if it is possible to define:
• Appropriate problem representation
The problem must be described as a space which consists of food sources.
• Construction of feasible solutions
A mechanism must be in place whereby possible solutions are efficiently created. Each food
source represents a feasible solution.
• Heuristic desirability of solutions
A suitable heuristic measure of the goodness of the found solution must be defined. ABC is
an optimization tool which provides a population-based search procedure in which
individuals called foods positions are modified by the artificial bees with time and the bee’s
aim is to discover the places of food sources with high nectar amount and finally chose
source with the highest nectar amount among the other resources [4], see the outline of the
ABC algorithm.
172
3. International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 1, January- February (2013), © IAEME
Step 1: Initialize the population of solutions xi,
i= 1, . . . , SN
Step 2: Evaluate the population
Step 3: cycle = 1
Step 4: repeat
Step 5: Produce new solutions vi for the employed bees and evaluate them
Step 6: Apply the greedy selection process for the employed bees
Step 7: Calculate the probability values pi for Solutions xi
Step 8: Produce the new solutions vi for the onlookers from the solutions xi selected
depending on pi and evaluate them
Step 9: Apply the greedy selection process for the Onlooker bees
Step 10: Determine the abandoned solution for the scout bee, if exists, and replace it
with a new randomly produced solution xi
Step 11: Memorize the best solution achieved so far
Step 12: cycle = cycle + 1
Step 13: until cycle = MCN
2. SHORTEST COMMON SUPERSEQUENCE PROBLEM SOLVERS
Shortest Common Supersequence problem (SCS) is a classical NP-Hard problem and
has applications in many areas. Pervious researches proposed different algorithms to solve
Shortest Common Supersequence problem[1]. The Alphabet algorithm used to solve SCS and
has an approximation ratio of q = |∑| with time complexity (qn), in practice the algorithm
doesn’t perform when the alphabet is not fixed [3]. Another solution by using Majority-
Merge algorithm (MM) and it does not have any worst-case approximation ratio and
performs very well in practice with time complexity O(qkn) [13]. Greedy and Tournament
algorithms used to solve SCS and have O(k2n2) time complexity and O(kn+n2) space
complexity [10]. Genetic Algorithm (GA), On the other hand, was very hard to apply for
many reasons for example: Changing a good solution slightly will yield an invalid string and
most possible strings with reasonable length are invalid. Three versions of GA were proposed
to solve SCS: G0, G1/||L||, G1, after testing, it turned out there is no basic value which
performs best for all test instances, which led to propose another version of GA called Gv .
The later allows the basic value to vary between 0 and [14]. Ant Colony Algorithm (ACO)
algorithm developed by Michel & Middendorf for the SCS problem they called it (AS-SCSP)
showed promising results when compared to the results of other approaches[21].
3. PROPOSED APPROACH
This section briefly describes the Artificial Bee Colony algorithm and its modified
adaptation for solving the SCS. String S is called a Supersequence of a string T if S can be
obtained from T by inserting zero or more symbols. Calculating the number alphabet and
their frequency for all of the strings (L) to direct the random generation toward the used
alphabets & most frequent alphabet. Checking the generated SCS compatibility with each
string and give value for it. Our approach first, calculates the frequency of each alphabet used
in L, and then store frequency for each character occurred in L in Array 1. After that we
convert the frequencies to characters in Array 2. Example: L = {APLY, DUHA, LADP}, ∑ =
{A,D,H,L,P,U,Y}, we store frequency for each character occurred in L in Array 1 (denote the
173
4. International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 1, January- February (2013), © IAEME
alphabet 26 characters) then we convert the frequencies to character in Array 2 (illustrated in
Figure 1). These two steps are to ensure the best way of random string generation.
Figure 1 generating string from alphabet used
Each worker bee xi generate candidate SCS by randomly choosing characters from Array 2 in
random length and we can see that the most frequent alphabet will be choosing more than less
frequent alphabet. Then the onlooker bee calculate fitness value fi for each candidate SCS by
checking each candidate SCS with L one string at a time by checking how much alphabet
with the same ordering in L that the candidate SCS have, the more fi the more the candidate
SCS is fitted to be SCS for L. We had modified the Merge Algorithm to calculate fi for the
candidate SCS the approach assigns fitness value for each candidate SCS using equation (1)
described below:
∑ Merge(Si,T1….Tn) (1)
Fitness (Si) = ∑ Fitness (S1….. Sm)
• n: number of entered strings
• m: number of generated strings
• S: generated string
• T: entered string
After assigning final fitness value fi for each worker bee, the onlooker bee needs to calculate
Average to determine whether the generated string’s fitness is good or not. The measure is
simply calculated by finding the average
of the finesses of the generated strings over the number of the entered strings, see equation
(2).
Average = ∑ Fitness (S1…..Sn) (2)
n
Example: Figure 3 shows that there are 5 worker bees have different fitness values resulted
by comparing the generated SCS with entered string “ABCABAA” using heuristic (1)
mentioned before, when we calculate the Average if worker bees fitness values the result is
5.6, so we check the fitness values for worker bees and we found that worker bees 1 & 5 have
fitness values below average. So in the next cycle the worker bees number 1 & 5 regenerate
SCS and compute fitness values.
174
5. International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 1, January- February (2013), © IAEME
Figure 2 the results of the 1st cycle of the execution of the Program Figure 3 shows worker
bees in the 2nd cycle of the program execution
Figure 3 the results of the 2nd cycle of the execution of the Program
Here, we present the Artificial Bee Colony Shortest Common Supersequence problem Solver
Step 1: Read Entered Strings
Step 2: Calculate alphabet number & frequencies
Step 3: Random generation new solution for each worker bee
Step 4: for (cycle = 0, cycle < MCN, cycle++)
Step 5: for-each ES (Entered String)
Step 6: Calculate the fi for the solutions produced by worker bees
Step 7: Calculate Average
Step 8: if fi < Average
Step 9: then
Step 10: Generate new string and calculate fi
Step 11: Store the solution with the highest fi and shortest length
4. ABC-SCS PERFORMANCE
We compared the results of ABC-SCS and the optimal solution to check the performance of
ABC-SCS. Table 1 shows the results of ABC-SCS implementation with respect of L & ∑.
175
6. International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 1, January- February (2013), © IAEME
Table 1 comparing the results of ABC-SCS with optimal solutions
L ∑ SCS Length Optical Solution
1 1 4 4
2 2 8.5 8
5 5 13.25 12
10 10 33 26
20 20 54 46
5. CONCLUSION
It can be concluded from the results that proposed Artificial Bee Colony Algorithm as
a solver for the shortest Common Super sequence problem. We compare the results obtained
by applying Artificial Bee Colony Algorithm with the results obtained from applying other
approaches that were proposed for solving the Shortest Common Super sequence problem.
We can also use our proposed algorithm ABC with SCS rule to solve various NP-Hard
problems.
6. REFERENCES
[1] Singh D., “Solving Real Optimization Problem using Genetic Algorithm with
Employed Bee” International Journal of Computer Applications (0975 – 8887)
Volume 42– No.11, March 2012.
[2] Mohd Afizi Mohd Shukran, “Artificial Bee Colony based Data Mining Algorithms for
Classification Tasks” 2011.[3] Mustafa M. Noaman, “Solving Shortest
Common Supersequence Problem Using Artificial Bee Colony Algorithm” The
Research Bulletin of Jordan ACM, ISSN, Volume II (III) PP-80.
[4] Gupta M., “An Efficient Modified Artificial Bee Colony Algorithm for Job
Scheduling Problem” International Journal of Soft Computing and Engineering
(IJSCE) ISSN: 2231-2307, Volume-1, Issue-6, January 2012
[5] Inova B., “Artificial bee colony algorithm for the capacitated vehicle routing
problem” Proceedings of the European Computing Conference 2010.
[6] Chang Jianghui, Zhao Yongsheng, Wen Chongzhu, “Research on Optimization of
Fuzzy Membership function based on Ant Colony Algorithm,” Proc of the 25th
Chinese Control Conference, Harbin, Aug, 2006.
[7] Ashita S. Bhagade, “Artificial Bee Colony (ABC) Algorithm for Vehicle Routing
Optimization Problem” International Journal of Soft Computing and Engineering
(IJSCE ISSN: 2231-2307, Volume-2, Issue-2, May 2012
[8] Malek Alzaqebah, “Artificial bee colony search algorithm for examination
timetabling Problems” International Journal of the Physical Sciences Vol. 6(17), pp.
4264-4272, September, 2011
[9] Adil Baykasoglu, “Artificial Bee Colony Algorithm and Its Application to
Generalized Assignment Problem” International Conference on Computational
Intelligence for Modeling, Control and Automation, Las Vegas.
[10] Marco Dorigo and Thomas Stuzzle, Ant Colony Optimization, Eastern Economy
Edition, PHI, 2005.
176
7. International Journal of Computer Engineering and Technology (IJCET), ISSN 0976-
6367(Print), ISSN 0976 – 6375(Online) Volume 4, Issue 1, January- February (2013), © IAEME
[11] Arun Khosla, Shakti Kumar, KK Aggarwal, Jagatpreet Singh,”Particle Swarm
Optimizer for fuzzy models IEEE Proc. on Fuzzy Systems, 2007
[12] Marco Dorigo and Thomas Stuzzle, Ant Colony Optimization, Eastern Economy
Edition, PHI, 2005.
[13] M. Galea and Q. Shen, “Fuzzy Rules from ant-inspired computation,”Proc. IEEE Int’l
Conf. Fuzzy Systems, pp 1691-1696, 2004.
[14] Bhalla P., “Fuzzy Rule base generation from Numerical Data using Ant colony
optimization,” MAIMT-Journal of IT & Management. Vol. 1, No. 1 May-Oct, 2007,
pp 33-47.
[15] Chia-Feng J, H.J. Huang and C.M. Lu, “Fuzzy Controller Design by ant colony
optimization,” IEEE Proc. on Fuzzy Systems, 2007.
[16] Kumar S. “Introduction to Fuzzy Logic Based Systems”, Workshop on Intelligent
System Engineering (WISE-2010), 2010.
[17] Shakti Kumar, P.Bhalla and Amarpartap Singh, “Soft Computing Approaches to
Fuzzy System identification:A Survey”, IISN-2009,pp 402-411, 2009.
[18] M.S. Abadeh, J. Habibi and E. Soroush, “Induction of Fuzzy classification systems
using evolutionary ABC-based algorithms,” Proc. of the First Asia Int’l Conf. on
Modeling and Simulation (AMS’07), 2007
[19] Shakti K, P. Bhalla and S.Sharma, “Automatic Fuzzy Rule base Generation for
Intersystem Handover using Ant Colony Optimization Algorithm,” International
Conference on Intelligent Systems and Networks (IISN-2007), Feb 23-25, 2007,
MAIMT, Jagadhri Haryana, India, pp 764-773.
[20] Shakti Kumar, “Rule base generation using ant colony optimization,” Proc. Of the one
week workshop on applied soft computing (SOCO-2006), Haryana Engineering
College, Jagadhri, July 2006.
[21] Adil, B., Lale, Ö., and Pınar, T. 2007. Artificial Bee Colony Algorithm and Its
Application to Generalized Assignment Problem. I-Tech Education and Publishing,
ISBN 978-3-902613
[22] Andreas, W. 2003. The Shortest Common Supersequence Problem. ISBN 978-3-
90232
[23] Barone, P., Bonizzoni P., Vedova, G.D., and Mauri, G. 2001. An approximation
algorithm for the shortest common Supersequence symposium on applied
computing, 56-60.
[24] Dervis, K. 2010. Artificial bee colony algorithm. Scholarpedia. 5(3):6915.
[25] Dervis, K., and Bahriye, A. 2009. A comparative study of Artificial Bee Colony
algorithm. Applied Mathematics and Computation, 214, 108–132.
[26] G.Vasu, J. Nancy Namratha and V.Rambabu, “Large Scale Linear Dynamic System
Reduction Using Artificial Bee Colony Optimization Algorithm” International Journal
of Electrical Engineering & Technology (IJEET), Volume 3, Issue 1, 2012,
pp. 145 - 155, Published by IAEME.
[27] S. Kanimozhi Suguna and Dr.S.Uma Maheswari, “Comparative Analysis Of Bee-Ant
Colony Optimized Routing (Bacor) With Existing Routing Protocols For Scalable
Mobile Ad Hoc Networks (Manets)” International journal of Computer Engineering
& Technology (IJCET), Volume 3, Issue 1, 2012, pp. 232 - 240, Published by IAEME
177