A Hybrid Ant Colony Optimization Algorithm to Solve Assignment Problem by Hungarian Method

This research studied ant colony optimization with optimization problem as an assignment model problem by Hungarian method. The proposed heuristic algorithm simulate ant colony optimization algorithm with Hungarian method for Assignment problem. The ant colony optimization algorithm simulates the behavior of real ant colony, to find the shortest path between many paths for solving the problem. It dependent on the path from the nest (problem of research) to food (optimal solution) by deposited pheromone on the path they take between the nest and food, so that other ants can smell it. The experiment in this research shows that the algorithm provides optimal solution. It has outperforms with computation and it is an effective approach and the algorithm performs significantly better than the classical method


1-1 Introduction
Ant colony optimization introduced by Marco Dorigo in 1992 [7].Swarm intelligence is new approach to solve problem as optimization problems.Ant colony optimization algorithms are population based optimization approaches that have been successfully applied to solve different combinatorial optimization problems, such as assignment model.
Ant colony optimization, called ant system was inspired by studies of the behavior of ants [7].Ant colony algorithms are inspired by the foraging behavior of real life ant colonies in which individual ants deposit a chemical substance on the ground called pheromone, on the path while moving from the nest to the food sources and vice versa.A pheromone trail is formed through which individual ants are aided to smell and select their routes.The paths with higher pheromone would be more likely to be selected by other ants resulting in further amplification of current pheromone trails.Due to this interesting behavior of ants.It is observed that after sometimes a colony of ants would select the shortest path from the nest to the food source and vice versa [1,5,9].
The Assignment problem is one of fundamental combinatorial optimization problem in the branch of optimization or operation research in mathematics [3,4,5,6].
This research aims to present a heuristic algorithm efficient for solving assignment problem by Hungarian method with ant colony algorithm.

1-2 Definition of Assignment Problem
The Assignment problem is a NP-hard optimization problem [8], in which n workers are assigned to n jobs, with minimum cost.The quadratic model can be solved directly as a regular transportation model.
The assignment model is actually a special case of the transportation model in which the workers represent the sources, and the job represents the destinations, the supply amount at each source and the demand amount at each destination exactly equal 1 as in table (1).The cost of "transporting" worker i to j is c ij .In effect, Nevertheless, the fact that all the supply and demand amounts equal 1 has led to the development of a simple solution algorithm called the Hungarian method [10].

Table (1)
The assignment problem in which n workers are assigned to n jobs.or the problem consists of assigning n facilities (or warehouses) to n locations (or sites) with the objective of minimizing the transportation costs associated with the flow of materials between facilities and distances between locations [6].It did not assign many facilities to the same location or assign many locations to the same facility [8].The evaluation function of a Assignment problem is given as : Subject to

1-3 Steps of Hungarian Method
1.For the original cost matrix, identify each row's minimum, and subtract it from all the entries of the row.2. For the matrix resulting from step 1, identify each column's minimum, and subtract it from all the entries of the column.3. Identify the optimal solution as the feasible assignment associated with the zero elements of the matrix obtained in step 2.and go to step 8. 4. If no feasible assignment (with all zero entries) can be secured from step 1 and step 2. 5. Draw the minimum number of horizontal and vertical lines in the last reduced matrix that will cover all the zero entries.6. Select the smallest uncovered element, subtract it from every uncovered element, and then add it to every element at the intersection of two lines.7. If no feasible assignment can be found among the resulting zero entries, then go to step 4. otherwise, go to step 3 to determine the optimal assignment.8. STOP [10].

1-4 Steps of Assignment Procedure
1.For the final matrix, in the beginning in rows, select the row which has one zero element entry only, assign cost in this entry, and delete all elements in the column which has this element.2. After ending from rows, and the assignment wasn't completed, select the column which has one zero element only, assign the cost in this entry, and delete all the elements in the row which has this element.3. Repeat step 1and 2 until the assignment is completed [11].

2-1 Ant Colony Behavior
The ant colony optimization algorithm is solving computational problems to find good paths.They are inspired by the behavior of ants in finding paths from the colony to food [5].
In the real world ants initial wander randomly, and upon finding food return to their colony while laying down pheromone trails.If other ants find such a path, they are likely not to keep traveling at random, but to instead of the trail, return and reinforc it if they eventually find food.
The pheromone trail starts to evaporate, thus reducing its attractive strength, the more time it takes for an ant to travel down the path and back again, the more time the pheromones have to evaporate.A short path, by comparison, gets marched over faster, and thus the pheromone density remains high as it is laid on the path as fast as it can evaporate [5].
The solutions are improved by modifying the environment via a form of indirect communication called stigmergy [7,8].
The use of positive feedback in this algorithm helps cut the time to the discovery of good solutions [1,3,4].

2-2 Characteristics for Artificial Ants
1-Artificial ants are able to memorize their paths.2-Artificial ants are discarded after each trip from the nest to the food source (each iteration).3-Artificial ants are not completely blind but able to include heuristic information in their selections.4-Artificial ants live in an environment where time is discrete [2,9].

2-3 Pheromone Update
The most important component of an ant system is the management of pheromone trail.The trail is used by other ants to find the location of the food source located by their nest mates.It follows that when a number of paths are available from the nest to a food source, a colony of ants may be able to exploit the pheromone trail left by the individual members of the colony to discover the shortest path from the nest to the food source and back.As more ants choose a path to follow, the pheromone on the path build up, making it more attractive to other ants seeking food and hence more likely to be followed [7].Therefore the main characteristics of the ant system is that it followes a positive feedback, allows finding good solution, and a pheromone value is associated with each possible solution component [1,3].
In this research, after each ant of the population has constructed a solution (after step 2 from Hungarian method), the pheromone information is updated.We use a pheromone update procedure where only the best solution found so far is used for global updating.The pheromone trail is denoted by ph, the pheromone update is denoted by Δph.The current of pheromone trail value is equal to the previous pheromone trail value plus the pheromone update value.For each zero element in the matrix after step 2 of Hungarian method, the pheromone is updated.The update rule is as follows: In this research, assume that the Q is 0.5 Also In this research, assume that after each ant of the population has constructed an optimal solution.Assigning is completed.The final pheromone value is updated by the rule: When no pheromone is present, the ants choose the left or right branch with equal probability.Since the ants which choose the shortest branch arrive earlier at the food (and come back to the nest earlier), the pheromone quantity on the shorter branch grows faster.So the ants are able to find the shortest path between nest and food.
The aim of the pheromone update is to increase the pheromone values associated with good or promising solutions, and to decrease those that are associated with bad ones.Usually, this is achieved by decreasing all the pheromone values through pheromone evaporation, and by increasing the pheromone levels associated with a chosen set of good solutions [3].The amount of pheromone the ants deposit increases more on the shorter path, and so more ants prefer this path.This positive effect is called autocatalysis [3].The updating of trail levels can be performed either after each move or after completion of solution.Dorigo et al.(1996) have experimentally shown that the performance of the second way is much better than the first [9].
In this research, the second way can be used for updating of trail levels.

2-4 Pheromone Evaporate
Pheromone evaporate has the advantage of avoiding the convergence to a locally optimal solution, if there were no evaporate at all, the paths chosen by the first ants would tend to be excessively attractive to the following ones.When one ant finds a good (short)path from the colony to a food source, other ants are more likely to follow that path, and positive feedback eventually leads all the ants following a single path.The idea of the ant colony algorithm is to mimic this behavior with "simulated ants" walking a round the space representing the problem to solve [5].There are two different uses of pheromone : Exploration and exploitation, exploration is a stochastic process in which the choice of the component used to construct a solution to the problem is made in a probabilistic way.
Exploitation chooses the component that maximizes a blend of pheromone trail values and partial objective function evaluations [4].
The pheromone evaporation is denoted by p.The pheromone evaporation is defined which enables greater exploration of the search space and minimizes the chance of premature convergence to suboptimal solution by all ants in the colony.Colony optimization algorithm uses an evaporation rate in order to forget previous bad choices at the cost of loosing useful information.Pheromone evaporation can help the ants escape from local minimum where 0 < p <1 [4,7,8].
In this research, assume the evaporation rate is 0.6, after an ant has constructed unfeasible solution, the pheromone information is updated (pheromone evaporate).The current value of pheromone is equal to the previous value of pheromone multiplied by the pheromone evaporation.The update rule is as follows: ph = ph * p

2-5 Heuristic Information
Heuristic value is different from one problem to another.Artificial ants are can include some heuristic information while assigning facilities at different locations.The heuristic information is denoted by H.This information indicates the desirability of assigning facility n to location n and is calculated using a heuristic approach.There are several methods to estimate the desirability of each move.The heuristic information is calculated for all moves in all ants.
The heuristic information is calculated either a prior or a posterior, in first category, the heuristic information is computed first at the beginning and remains unchanged during the running of algorithm.In the second category, the heuristic information is dynamic and depends upon the current state of the ant [9].
In this research the first category is used.The heuristic value is formulated for all elements in the matrix, the heuristic value is denoted by H as follows: H = 1/ B ij B: is the main matrix of the cost.Also in this research, we use another rule to assign the worker i to the job j, to reach the optimal solution.The rule is as follows:

3-1 A Generic Description of the Ant Algorithm
Below the steps of generic ant algorithm: [9] Step 1: Initialize the parameters (create n ants) and pheromone trails.
Step 2: For each ant construct a complete solution.
Step 3: Improve each solution to its local optimal.
Step 5: If continuation is allowed, go to step 2, otherwise STOP.

3-2 Solving the Assignment Problem by Hungarian Method with Ant Colony Optimization
Below are the detailed steps for proposed heuristic algorithm of hybridization ant colony optimization algorithm to solve Assignment problem by Hungarian method : Step1: initialize the number of ants is equal to the number of rows or columns of main matrix of the cost as 5.In this research, assume that the primary pheromone trails (ph) is 1. and the pheromone evaporation ( p) is 0.6.The heuristic value (H) is formulated by : H = 1/ B ij B: is the main matrix of the cost Step2: For each ant apply the step 1 and 2 of Hungarian method to construct the solution, the pheromone information is updated.We use a pheromone update procedure where only the best solution found so far is used for global updating.The update rule is as follows: In this research, assume that the Q is 0.5 Calculate the cover lines by applying the step 5 from Hungarian method procedure.If the cover lines isn't equal to the number of rows or column, or the solution isn't possible then pheromone value is evaporated by the rule: ph = ph * p Step3: Improve the solution to its local optimal by applying the step 6 of Hungarian method.In this research, two rules are used to find the heuristic value to assign the worker i to job j and reach an optimal solution as follows: Step4: After each ant of the population has constructed an optimal solution, the pheromone information is updated by the rule: ph = ph * 2 Step5: If continuation is allowed, repeat the same steps, otherwise stop.
Below figure (1) illustrated the flowchart of proposed heuristic algorithm for hybridization ant colony optimization algorithm to solve Assignment problem by Hungarian method

3-3 Problem instance and Result
Below results illustrate that the approach can be applied for solving Assignment problem by Hungarian method .It is implemented which simulate the ants behavior, in our experiment used a simple instance with n workers, n jobs, by single matrix B. Initialization of pheromone value is made with an arbitrary value as ph =1.
The researcher implemented the proposed heuristic algorithm in the language of technical computing as Matlab 6.5.After the solution is completed by each ant, the value of ph is updated, which the pheromone act as a positive feedback that leads to reach the solution.
For one ant, the path is chosen accordingly to the quantity of pheromone.Furthermore, this chemical pheromone has a decreasing action over time, and the quantity left by one ant depends on the amount of food found.
In this research, ant colony optimization with optimization problem is tackled to reduce the region of the space considered and computation in the classical methods.Assignment problems are considered difficult combination problems.If we have problem of size n, their optimal solutions require the enumeration of all the possible solutions.The difficultly in solving these problems is proportional with the size of the problems, as the number of solutions of the problem of size n are n! [11].
The figure (2) shows that the ant was facing an obstacle, there is an equal probability for every ant to choose the left or right path.As the left trail is shorter and so require less travel time, it will end up with a higher level of pheromone after many ants passages being more, and the figure (2) shows a set of ants built a path to some food .an obstacle with two ends was then placed in their way such that one end of the obstacle was more distant than the other (in this research the obstacle is the step 1,2 and 6 of Hungarian method).
In the beginning equal numbers of ants spread around the two ends of the obstacle.Since all ants have almost the same spread, the ants going around the nearer end of the obstacle return before ants going around the farther end (differential path effect).We define how the space where the ants will walk, ant walk through this space according to a set of solutions as feasible or not depended of pheromone trail.

Matrix of Problem
In constructing the solution, the researcher considers the rows or columns of matrix one by one, starting from that covered all the zero entries, and increases the associated pheromone from one zero element entry to another.
The researcher did not consider the effect of the probability function in the ant colony optimization algorithm, because in this research the ants act in deterministic way.In this research, use of the value heuristic, and another rule is denoted (Hnew), because the final matrix has more than one zero element entry and cannot assign the worker i to the job j.
During each iteration the ant constructs complete solution using heuristic information and the collected experiences of previous group of ants.These collected experiences are represented by trail pheromone which is deposited on the elements of a solution.Below the results of implementation of the Assignment problem by Hungarian method with ant colony algorithm.This results reduces the region of the space considered and computation in the classical methods.For example the steps of solution for problem size 5x5 are: The cover lines after steps 1and 2 of Hungarian method is 4 and are not equal to the number of jobs or workers.The solution isn't optimal.The pheromone information is updated because pheromone is evaporated by (5*0.6) which equals 3. We must apply the Step 6 of Hungarian Method as in table (6): The cover lines after step 6 of Hungarian method is 5 and equal the number of jobs or workers.The previous value of pheromone is equal 3.
The pheromone information is updated by (ph = ph + Δph) for each zero element entry in the table(6).The current value of pheromone equals 9.5 In the classical method, the assignment process is difficult because every row or column has more than one zero element entry, therefore the solutions is generated very much.Some of the solutions generated by classical method aren't possible for assigning (conflict as it did not assign many workers to the same job or assign many jobs to the same worker).The assigning isn't possible and not completed as in the tables (7) and (8)  Below are the proposed steps illustrated the assignment process that assign worker i to job j: • If every row or column in the matrix after step 6 of Hungarian Method has more than one zero element entry then use the heuristic value.
• The heuristic value consists of two rules.H = 1/ B ij for each element in the matrix • For the final matrix in the table (10), each row in this matrix chooses the smallest element and assigns the worker i to job j, and delete all elements in the column which has this element.• In the end, if the final matrix in table (10) has one element the assigning guarantees the worker i to job j.As in table (11) below: After the ant has constructed the final solution of problem and reached optimal solution , the pheromone information is updated by (ph =ph *2) and is 19.The cost is equals 11.
In this research, the proposed algorithm facilitates the difficultly in solving these problems is proportional with the size of the problems, as the number of solutions of the problem of size n are n!.For example, the number of the solutions for problem size 5x5 are 120.The classical method has large space and computation.Not continuing, the classical method reachs an optimal solution, especially for example in table (2).If we solved the example in table (2) in classical method then the solution (final matrix) after step 6 is similar to the matrix in table (6), but the assignment process is difficult because every row or column has more than one zero element entry, furthermore, the solution is generated very much.Some of the solutions is generated by classical method isn't possible for assigning (conflict as it did not assign many workers to the same job or assign many jobs to the same worker).A hybrid ant colony optimization showed the advantages of this approach over classical method by using the two rules of heuristic value.The two rules of heuristic value facilitated the solution and reached an optimal solution.

3-4 Conclusion
In this research, our implementation of algorithm was successful in combining two procedures as ant system with standard Assignment problem.
Ant colony optimization algorithm is used to solve optimization problem as Assignment problem, to find optimal solution, the attempt in ant algorithm is to simulate the behavior of real ants through mathematical formulations.
The solution has minimum value of pheromone, therefore this solution will be removed from search space, furthermore to reduce the region of the space considered and computation, especially when small instances may require long computation time.
Ant colony optimization gives better results using a less iteration number than enumerate solutions for solving of problem.
In general, the ants choose the left or right branch with equal probability, but the ant followed the shortest path with a higher value of pheromone.Not necessary the ants choose previous or right paths therefore, it permits to explore the short paths or other new paths randomly by pheromone trail to find optimal solution.
In this research, in the assignment process, if the final matrix has more than one zero element entry in each row or each column and cannot assign the worker i to the job j, then using the two rules of heuristic value.The two rules of heuristic value facilitated the solution and reachs an optimal solution.

Figure( 1 )
Figure(1) A Flowchart of hybrid ant colony algorithm for solving Assignment by Hungarian method

Table ( 2
) Main Matrix of the Cost