Tikrit Journal of Pure Science

O ne of the combinatorial optimization problems is Knapsack problem, which aims to maximize the benefit of objects whose weight not exceeding the capacity of knapsack. This paper introduces artificial bee colony algorithm to select a subset of project and represented by knapsack problem to put the best investment plan which achieve the highest profits within a determined costs, this plan is one of the applications of the financial field. The result from the proposed algorithm implemented by matlab (8.3) show the ability to find best solution with precisely and rapidity compared to genetic algorithm


1-Introduction
The most popular subset selection problem is knapsack problem (KP).The goal is to set a subset of n items from N original items to a knapsack, such that the summation of profit of the selected items is maximized which sum of weight not exceeding the capacity of knapsack [1].Knapsack problem has many practical applications are not limited to packing problems: suppose that n projects are available to an investor and that the profit obtained from the j th project is pj, j=1,2,…,n, whose costs wj to invest in project j, by solving (0-1) knapsack problem an optimal investment plan may be found [2].Many methods such as: branch and bound, cutting planes, and dynamic programming etc., and nature inspired algorithm have been proposed to solve the knapsack problem [3,4].Lately, evolutionary algorithms such as genetic algorithm (GA) [5,6], particle swarm optimization algorithm (PSO) [7], ant colony optimization algorithm (ACO) [8] and artificial bee colony algorithm (ABC) [4] efficiently have been developed for solving knapsack problem and reaches to the best solution.
In this paper uses ABC algorithm which proved efficiently in select subset of projects in knapsack problem to build best investment plan compared by GA.The rest of paper is organized as follows: section 2 gives related work, section 3 presents description to solve KP by use ABC algorithm, section 4 views the description of the proposed algorithm, experimental result and conclusion are introduced in section 5 and 6.

2-Related works
Many approaches are proposed to solve knapsack problem to obtain the best solution.In [6] introduced the basic form of genetic algorithm to solve knapsack problem.In [4] presents the using of a novel artificial bee colony algorithm to solve knapsack problem, a hybrid probabilistic mutation schemes in this approach are used to guide the search quickly.In [9] Karboga proposed ABC algorithm which its works similar to a bee colony.In [3] introduced a novel binary biogeography-based optimization algorithm for the knapsack problem, the result from [3] show that the new method is effective and efficient.In [5] implement a fast and efficient genetic algorithm to solve 0-1 knapsack problem feasibility and effectively.In [10] presents a discrete artificial bee colony for multiple knapsack problem, the result from that the presented method has enhanced convergence speed and quality than other evolutionary algorithms.In [11] applied bee algorithm to solve knapsack problem and attempt to find the best solution in knapsack problem by the number of random flight.

3-Description to solve knapsack problem by using ABC algorithm
Karboga in 2005 [9] for real parameter optimization proposed the ABC algorithm, which simulates the forging behavior of a bee colony.The colony of artificial bees consists of three groups: employed, onlookers, and scout bees.Randomly search for food source positions (solutions) by employed bees.Then, they share information about food source such as nectar amounts (quality of solutions) with the onlookers bees which waiting at the dance area at the hive [12][13][14].For colony communication the dance is essential and contains three pieces of information regarding of a flower patch: the direction in which it will bees crossing, its distance from the hive and its quality (i.e., fitness).Provided that the amount of nectar of the new selected source is higher than the previous one, the new source position is memories by the bee, and forgets the old one.Otherwise, she keeps in her memory the previous position.The dances of employed bees are watch by onlooker and decide to choose the scout bees.Then employed bees start to search in the neighborhood area of the sources of food found by scout bees [10].To solve knapsack problem involves packing the knapsack with projects which have a weight capacity C, and the number of projects 1,2,…,n, each project has weight corresponds to weight(wi) and profit (pi), the goal is to find a set of projects whose weight does not exceed the capacity of knapsack and to maximize the overall profit.Mathematically, the zero-one knapsack problem can be represented by a vector of binary values X1,X2 …… Xn, Where Xi = 0 or 1 (1 ≤ i ≤ n).given (C > 0), Wi > 0,Pi > 0, 1 ≤ i ≤ n, the zero-one knapsack problem can be represented by a vector of binary values X1,X2 …… Xn, Where Xi = 0 or 1 (1 ≤ i ≤ n).satisfy the constraint in equation 1 is the goal from finding a vector [5]. =1 And maximize the total profit as: To select project by using ABC algorithm a possible solution for the problem can be represented by a food source, and the amount of neater for this food source meet the sum of profit for the selected projects in knapsack.Each bee in ABC algorithm is represented as a string of binary value each bit corresponds to absence or presence of that project in the solution of the bee [4].
One of approach to construct the initial solution by calculate heuristic information by divide profit to weight as in eq. 3 for all item before entered in steps of ABC algorithm. = / … … . .(3) And compute the probability of presence each item in initial solution from eq. 4.
= ( Where the sum of weight for all original items corresponds to T and C represents capacity of the knapsack and Mean(R) is the mean of the relation computed from eq. 4.
After finding a food source by each bee in each iteration, it must be modified where the sum of weight for overall items not exceeds the capacity of knapsack, then evaluate the gathered solution generated by employed bee by compute the fitness (nectar amount) of the k th bee corresponds to the sum of the total profit of the selected items in knapsack by that bee, then apply the selection strategy to choose the best bee as scouts the chance of selecting a bee by onlooker computed from eq.5 [10].
F k : is the profit of knapsack represented by the k th bee.

∑ 𝐹𝑖 𝑁 𝑖=1
: is the total amount of achieved nectar by all the explorer bees.M: number of employed bee.Then continue in running ABC algorithm which includes the following algorithm [15][4]: 1-Initialization: parameters of ABC algorithm are initialized K, N, CC i =0 (i=1,…,K).2-Initial solution: generate initial solution (food sources) { FS i (0) | i=1,…,K } by calculate the value of profit to weight by apply eq.3, Then compute probability of presence of each item in initial solution from eq.4.

4-Description of the proposed algorithm
In this paper, ABC algorithm used to select subset of projects in KP to build good investment plan, these subset represent the best solution which have maximized gross-profit and the sum of total cost not exceeds the capacity of knapsack.There are set of projects available to investor each project has value of sale-revenue and value of cost-making which consist from four types: cost of direct materials, the cost of direct wages, variable industrial costs and non-variable industrial costs, the goal from proposed algorithm select best subset of projects from this set in less executing time.The proposed algorithm contains the following steps 1-Initialization: parameters of ABC algorithm are initialized K=number of population=no.employed bee=no.onlooker bee, N=maximum iteration, CC i =Abandonment counter=0 (i=1,…,K).2-Enter the array of sales-revenue which size [1…no. of projects], and matrix of cost-making whose dimension [no. of project, 4 = types of costmaking].3-Calculate the total cost from summation of costmaking for each project.4-Compute Gross-profit for each project by subtract total cost from sales-revenue.5-Initial solution: generate initial solution (food sources) {FS i (0) | i=1,…,K } by calculate the value of profit to weight by apply eq.3, Then compute probability of presence of each item in initial solution from eq.4, and generate initial solution based on the computed value of probability.6-Loop: For r=1:N do { (4) For i=1:K do (select food sources by employed bees and run local search respectively).{ -Assassinate each employed bee with a food sources FS i (r) and calculate its amount of nectar (corresponds to the sum of the gross-profit of the selected project in knapsack by that bee).-In the neighborhood of FS i (r) find new FS i ′(r) and compute its amount of nectar; -Put the better one in { FS i ′(r), FS i (r) } as a new position of the employed bees; } (5) For j=1:K do ( perform further local search by onlooker bees which take help from employed bees) { -A food source FS i (r)selected from { FS i (r) } for every onlooker bee by apply roulette wheel selection method which pass the probability of choosing calculated from eq. 5; -A new food source FS i ′(r) in the neighborhood of FS i (r) is find then calculate its nectar amount; -Consider the better one in { FS i ′(r), FS i (r) } as a new position of the corresponding bees; } (6) A new food sources exploiting (scout bees randomly perform global search).For i=1:K do (food sources) The FS i (r) is abandon and the associated employed bee become scout; -Generate randomly a new FS i (r) and the scout becomes an employed bee again ; Register the best food source FS best found so far whose gross-profit maximized and the sum of the total cost not exceeds the capacity of knapsack (suppose C calculated from multiply 0.25 by sum of the total cost ); r=r+1; } 7-Output: if the predefined end condition (corresponding to access maximum of iteration) are met then return FS best .

5-Experimental results
The proposed algorithm was implemented by matlab 8.3 that contribute in building efficient investment plan with zero-one knapsack problem.Initialize the parameters of ABC algorithm which illustrates in table (1).Then compute gross profit by subtract total cost from sale-revenue showed in table (5).In this paper the initial solutions are not generated randomly, obtained from eq.3 by divide gross-profit at total cost for each project to find the relation, the result in table (6).Generate the initial solution depending on the probabilities computed in previous step, then calculate gross -profit-loss and total cost for each solutions explained in table (8).

6-Conclusion
In this paper a proposed ABC algorithm used with knapsack problem to select subset of project with maximum gross-profit and the sum of total cost for them not exceeds the capacity of knapsack.The obtained result shows the highly speed ,accuracy, and good quality of solution from applying ABC algorithm compared with genetic algorithm to find best solution that contribute in put optimal investment plan.

Table ( 1) parameters of ABC algorithm
There are n projects each one has profit and cost for explain the steps of proposed algorithm in simplicity get the example with eight projects, in table (2) lists the sales-revenue of the projects.

Table ( 10) parameter of GA
(11)result from comparison two methods with examples with 8, 10, 25, 50, and 100 projects for finding the best solution showed in table(11), which explains the efficiency of ABC algorithm in access to the good quality solution than applying GA.