Particle Swarm Optimization Algorithm for Optimizing Assignment of Blood in Blood Banking System

This paper reports the performance of particle swarm optimization (PSO) for the assignment of blood to meet patients' blood transfusion requests for blood transfusion. While the drive for blood donation lingers, there is need for effective and efficient management of available blood in blood banking systems. Moreover, inherent danger of transfusing wrong blood types to patients, unnecessary importation of blood units from external sources, and wastage of blood products due to nonusage necessitate the development of mathematical models and techniques for effective handling of blood distribution among available blood types in order to minimize wastages and importation from external sources. This gives rise to the blood assignment problem (BAP) introduced recently in literature. We propose a queue and multiple knapsack models with PSO-based solution to address this challenge. Simulation is based on sets of randomly generated data that mimic real-world population distribution of blood types. Results obtained show the efficiency of the proposed algorithm for BAP with no blood units wasted and very low importation, where necessary, from outside the blood bank. The result therefore can serve as a benchmark and basis for decision support tools for real-life deployment.


Introduction
Blood is a living tissue of unique medical value to the human body [1]. It is responsible for carrying the substances needed for healthy living to various parts of the body and carries away those not needed as wastes. A normal blood is made up of four different components, namely: red cells, white cells, platelets, and plasma [1], which serve separate functions in human organism and different use in the medical treatment of patients in the hospitals or health clinics. The need for blood every day in the hospitals for various reasons and uses in the treatment of patients has made it become of high demand. As a result, there exits collection sites where blood is collected from donors, processed, and shipped to a Hospital Blood Bank to be stored and be available to meet the demands for transfusions to patients. Handling blood transfusion in hospitals involves some complexities due to blood compatibility issues and stochastic nature of the daily demands for blood. Therefore, assignment of blood can be seen as NP-Hard problem. As a limited resource with limited shelf life, there is need for its efficient management during the process of assigning it to patients from hospitals blood banks. The component of blood considered in this paper is the red cells and it is made up of four main types, namely: A, B, AB, and O. For convenience, blood type AB will be denoted by C in this work. With the Rhesus factor [2], the number of blood types is doubled, resulting in A + , A − , B + , B − , C + , C − , O + , and O − . Optimizing the assignment of these components is the focus of this paper.
The assignment problem is one of the basic combinatorial optimization problems in the fields of discrete optimization. Many optimization techniques have been used to solve various assignment problems including vehicle assignment problem, transportation problem, task allocation problem (TAP), and blood assignment problem (BAP) [3][4][5]. For instance, Jean et al. [3] used PSO to solve the problem of allocating a set of cabs to some customers with the goal of minimizing the distance traveled by the fleet with result that 2 Computational and Mathematical Methods in Medicine showed that PSO is capable of achieving optimal results. Similarly, a discrete PSO (DPSO) and genetic algorithm (GA) were compared for the problems of finding optimal solution to the allocation of the expected number of people in flooded areas to various types of available vehicle in an evacuation process [6] with DPSO having better performance than GA. DPSO has also shown great performance with different degrees of difficult knapsack problems [7,8]. In addition, experimental results in [9] showed that DPSO algorithm is highly efficient for solving the multiple knapsack problems (MKP) even with large problem instances. This motivates the investigation of DPSO in solving the BAP defined in this paper.
BAP recently stated attracting interests among metaheuristics and optimization researchers [2,[10][11][12][13][14] as the sourcing for blood for transfusion purpose is currently posing global challenge. An early work reported in [10] modelled the problem as a multiobjective linear programming model to help determine the best assignment of blood from donors to requests. The model was based on variables that represent the units of blood coming from both within the blood bank and outside the system and assigned available blood on daily basis depending on demand. A case study of Italian Red Cross System in Rome was considered. The model is however incapable of handling global request of different blood types at the same time. In [2] a dynamical system model was developed to handle the management of blood in a blood bank but without considering Rhesus factors. The model in [2] was improved upon in [11] where the authors modelled BAP as a MKP and compared the performances of five different (meta)heuristics in solving the problem. The goal was to minimize the amount of blood unit imported from outside the blood banking system. To further improve on the work in [11], a new cross and mutation techniques were introduced into the algorithm in [12] with the result that GA was reported as more efficient than other compared techniques. In [13], two local search optimization techniques, namely, dynamic programming and greedy randomized adaptive search procedure (GRASP) were tested for the BAP with GRASP performing better than dynamic programming. Tabu search and simulated annealing with their hybrid were also tested on BAP [14] where the hybrid showed better results than the individual techniques.
The problem of assigning blood in blood bank system principally involves attending to requests for blood and accepting donated blood from donors with the lifespan of each blood type of critical considerations. These activities are on daily basis and stochastic in nature. In situations where there is not enough volume of compatible blood type(s) to meet demands, such blood types are imported from other sources outside the blood bank system and this could be very expensive. All these put together show that the objective of assignment of blood in blood banks is to meet the daily demand for blood and to minimize the volume as well as the number of blood types imported from external source(s). Also, the volume of expired blood should be minimized. There is no report of the application of any swarm intelligence algorithms to this new domain of BAP. This paper is therefore set to investigate the application of a well-known swarm intelligence algorithm, particle swarm optimization (PSO), to the BAP. PSO was introduced in [15,16]. It is a fast and efficient technique used in solving complex and simple optimization problems. This technique is nature-inspired and draws inspiration from social behavior of animals, like birds and fishes. Thus, it belongs to the swarm intelligence group of evolutionary computation techniques. From the period of its inception, it has been used by researchers to solve a wide range of simple and complex optimization problems [17][18][19][20][21][22][23][24].
In the sections that follow, Section 2 gives the description of BAP considered in this paper. Section 3 describes the method that was applied in solving the problem. Section 4 focuses on the numerical simulations conducted which comprises the analysis and discussion of results. Finally, Section 5 concludes the paper and identifies some possible areas of future research.

Problem Description for Blood Assignment
The blood bank stores and issues the appropriate blood units to satisfy transfusion requests. On each day the bank receives a random number of transfusion requests for each blood type and each request for a random number of units. Once a request is received, the appropriate number of units of that type is removed from the bank upon successful cross-matching. We will define demand to be the number of units requested and usage to be the number of units transfused. Any units which are not used within their shelf life are considered expired and are discarded from the bank. Normally, a patient should be transfused his or her own blood type when there is a need for it. However, there could be situations when the blood type in the bank may not be enough to meet the blood units of the type requested. In order to address such challenges compatible blood types are supplied instead, where possible. The compatibility between blood types is presented in Table 1 (in this paper, blood types "C + " and "C − " refer to AB + and AB − throughout and are thus chosen for typo simplicity.). In the table, "YES" means that there is compatibility between the donor and receiver, while "NO" means there is no compatibility. Also, in the table, it is evident that O − is the universal donor, while C + is the universal receiver. In Republic of South Africa, 86% of the population has positive Rhesus factor, while 14% have negative Rhesus factor leading to the repartition presented in Table 2 [2,[11][12][13][14]. Further description of the BAP can be found in [2,10,12]. From the preceding description, it is evident that the assignment of blood in blood banks is a complex problem. Furthermore, it becomes more complex because blood products have limited shelf life. As a result, there is therefore the need for algorithms that could efficiently assign available blood resources in the blood bank to receivers, in order to minimize the blood units imported from external source(s) into the blood bank and at the same time minimize wastage of blood unit because of their limited shelf life.

Objective Function.
The objective function of the BAP is given in (4). The aim is to minimize the volume of red blood cells imported into the bank over a period of days: where and C + are volumes of the respective blood types imported in day .

Constraints.
Description of different constraints that are to be satisfied in implementing the proposed algorithm to solve the BAP is as follows.
(i) The total volume of blood requested must be satisfied for each day, either by using the ones in the bank or by importing blood from external sources. (ii) The volume of blood assigned each day must not exceed the total volume available in the bank. (iii) The minimum volume of each blood type must not be less than zero. (iv) Each unit of blood types must not exceed 30 days of shelf life; otherwise, it should be incinerated.

Variables.
Explained below are the descriptions of possible variables that can be used in the algorithm and could be represented using any meaningful variable names: (i) volume of blood types in storage at day ; (ii) proportion of blood types in the population of the region considered; (iii) donations of blood into the bank at day ; (iv) requests for unit blood at time ; (v) volume of incinerated expired blood at day ; (vi) volume of blood supplied at day ; (vii) volume of blood imported from external source(s) into the bank at day .

Updating Blood Volume.
On daily basis, the volumes of the blood types are updated relative to the volumes supplied, donated, and expired as stated in (15).

Assumptions.
The model was defined with the following assumptions.
(i) There is sufficient supply from the external source(s) of blood, when units are required to be imported. (ii) The desired level of the volumes of each blood type is relative to the proportional of blood distribution in the region under consideration. (iii) If emergency arises, no optimization may be performed, but patients straightaway receive O − blood. (iv) The validity date of the blood products is 30 days.

Methodology
In the daily management of the blood bank, the demand and supply of blood units vary; thus, there is a need for an effective method to determine the assignment of blood units for the purpose of good management. The assignment of blood units would be considered optimal if there is no importation of units from external sources; however, this may not be a possibility. Therefore, an algorithm that could be able to assign blood units relative to the available volume of blood units and volume requested with no or minimum units imported from outside the blood bank will suffice.
Three techniques are combined to provide solution to the BAP considered and thus to determine (near) optimal assignment of blood units relative to demands. They are particle swarm optimization which is the optimization technique used, multiple knapsack assignment technique which is used to handle the cross-matching of blood types in order to satisfy requests and stabilize the proportions of blood types stored in the bank, and queuing technique which is used to monitor the expiration date of the units of each blood type. Also described in this section is a bottom-up technique that was used to assign the blood units before importing any blood types from external source(s).

Particle Swarm Optimization Technique.
The PSO as a population-based and stochastic technique needs a swarm of particles to carry out its optimization process [15,16]. Using the search range defined for a problem, values are randomly generated for the decision variables. These values are then used to randomly distribute the particles in the solution search space before the technique begins its iterative process. During the optimization process, each particle communicates its new discoveries to others and this in turn determines subsequent moves of the particles in the search space. In each attempt of iteration, each particle makes use of two major pieces of information: its personal experience and the experiences of reachable neighbours to guide its search. Furthermore, the objective function of the problem being optimized is used to evaluate the quality of the discovery of each particle. Given an -dimensional space, each particle is characterized by the position vector = ( 1 , . . . , ) and Begin PSO Algorithm Input: : the function to optimize : the swarm size : the problem dimension min , max : decision variable search range min , max : particle velocity limits Output: * : the best particle position found (global best) * : the best fitness value found Initialize: position = ( 1 , . . . , ) and velocity V = (V 1 , . . . , V ), for all particles in problem space evaluate ( ) in variables and get , ( = 1, . . . , ) ← best of While stopping criteria is false do Compute inertia weight ( ) if it is not a constant Repeat for times Repeat for times update V for particle using (2) validate for velocity boundaries using Algorithm 3 update for particle using (3) validate for position boundaries using Algorithm 2 compute ( )  (2) and (3), respectively: In (2), and are vectors representing the th particle personal best position and swarm global best position, respectively; 1 and 2 are random numbers in the interval [0, 1], while 1 and 2 are acceleration coefficients called cognitive and social scaling parameters which determine the extent of the random forces in the direction of and . The parameter represents iteration index, while is the inertia weight which was introduced in [25]. It regulates the particle's velocity and helps to balance the global and local search abilities of PSO. In the original PSO algorithm, though not explicitly added to (2), the parameter implicitly had a value of 1. A general framework of PSO algorithm for continuous problems is presented in Algorithm 1.
Although the PSO was initially developed for continuous optimization problems, it has in several occasions been customized for discrete problems [19,20]. Customizing PSO for discrete problems was initially proposed by Kennedy and Eberhart in [26] where they defined trajectories and velocities of particles in terms of changes of probabilities, where the particles move in a state space restricted to 0 and 1 on each dimension, with a certain probability computed using the sigmoid limiting transformation as shown in where is the value in the th dimension of the position of particle , V is the value in the th dimension of the velocity of particle , is a value selected from a uniform distribution in [0, 1], and (V ) is as given in In this paper, some customization was made to the PSO algorithm before it was applied to the BAP. The different parts that were customized are as follows. Figure 1: Exemplified particle representation in the proposed discrete PSO algorithm.   3.1.1. Particle Representation. Each particle is encoded by a long string of characters representing each of the blood types. The string is divided into groups, with each group representing the content of each of the 8 knapsacks for each blood type. The characters in each group show which units of blood have been placed into each knapsack. Furthermore, each character represents 1 unit of positive blood type if it is uppercase (e.g., "A" for "A + "), but represents 1 unit of negative blood type if it is lowercase (e.g., "a" for "A − "). An example is shown in Figure 1.
The example in Figure 1 shows an interpretation of the representation of a typical particle in the swarm. The particle is of size (dimension) 32 and it represents the combination of all the units of requested blood types. The first 4 dimensions represent the number of units (i.e., 4) of O + that was requested and the supply is made up of 3 units of O + and 1 unit of O − . The last 5 dimensions also represent the number of units (i.e., 5) of C − that was requested and the supply is made up of 1 unit of A − , 1 unit of B − , and 3 units of C − . The same idea of interpretation applies to the remaining dimensions of the particle. In the course of implementation of the technique, the dimension of the particles and the size of the various knapsacks vary each day relative to the changing requests received by the blood bank. Figure 1, it is clear that the values of the dimensions of the particle are alphabets. Therefore, , , and will contain alphabets too and these cannot be directly used to compute ( + 1) in (2). For the velocity of each particle to be computed, these alphabets should be converted to numbers. There may be different methods to do this; however, the method used was to replace the alphabet (blood type) in each dimension of the particle with its value (see Table 4). In other words, the particle represented in Figure 1 becomes as represented in Table 3. and are also transformed likewise, depending on the contents of their respective dimensions; hence, (2) can be computed to obtain a value for ( + 1).

Obtaining the Positions of Particles.
The value obtained for ( + 1) is then transformed using (5) to get a value between 0 and 1. This value is then used to determine the blood type to be imported into the blood bank when there is a shortage of blood to meet requests. In other words, the different compatible blood types (including the blood type requested) that could be used to meet the request are given equal chances to be imported from external source(s) into the blood bank. This means that if there are two compatible blood types, each is given 50% chance to be imported, if there are four compatible blood types, each is given 25% chance of being imported, and so forth. Before the beginning of next iteration, each particle is reverted back to a string of alphabets of blood types representing the new potential solution.
Equation (6) is the objective function, which is to maximize the profit of the number of items placed in all the knapsacks;   and (9) indicates whether an item is placed into knapsack or not.

Application of the Technique from Multiple Knapsack Problems (MKP).
Inspired by the various successes in the application of MKP to different problems, the technique was applied to the BAP considered in this paper with some modifications. Equations (10)-(13) represent the way MKP was applied. In the case of the assignment of blood, units of blood types stored in the bank are the items, while different requests for the blood types are the knapsacks and the number of blood types compatible with each blood type is the capacity of each knapsack. Consider , ≥ 0, = 1, . . . , ; = 1, . . . , , where is the total units of blood supplied from the blood bank and/or imported from external source(s), is the total unit of blood supplied from the bank in each day, is units (or volume) of blood type coming from external sources, is the total number of requests (number of knapsacks) to be met, and is the total number of blood types available in the bank for supply (meet requests). Equation (11) certifies that the total blood units supplied are given by the amount of blood units from the bank and external sources. Equation (12) shows whether there is a supply of blood "1" or not "0. " Equation (13) is a nonnegativity constraint; that is, all the values and are positive integers.
In applying this technique to the BAP, some additional constraints are to be satisfied. These constraints are stated as follows. unit of blood. This is illustrated in Figure 2.
It should be noted that the weight of every unit of blood of any of the blood type is equal to 1. As a result, selecting the most profitable units that would satisfy each request in order to maximize profit is of uttermost interest.

Queuing Technique.
In the daily management of the blood bank, it is ensured that the shelf life of each unit of blood is not exceeded in order to minimize wastage. An efficient way which can be monitored is to use the queue technique. Queue is a list-like structure that provides restricted access to its elements. Elements may only be inserted at the back (enqueue) and removed from the front (dequeue). It implements the First-In, First-Out (FIFO) operations; thus, queues release their elements in order of arrival. This means that when units of blood are supplied from the bank, they are dequeued but enqueued when units of blood are donated into the bank. This is illustrated in Figure 3, using a singlelinked list. It should be noted that each of the blood type is represented separately.
Represented in (14)- (16) is the way the stack in Figure 3 is operated in the algorithm: , ≥ 0.
In (14) and (15), is the total blood units of type supplied by the bank, is the total number of requests of all the blood Computational and Mathematical Methods in Medicine 7  [25,75] types, is the total blood units of type requested, tot is the total units of all the blood types in the bank, represents the current day of blood bank operation, is the total units of all the blood types donated, and is the total blood units of type donated.
Expiration of Blood Units. As mentioned earlier, the queue is used to monitor the shelf life of each unit of the different blood type. Any of the blood units of a particular blood type that exceeds its shelf life are removed from the queue. This is represented in (16). Consider where ∈ {A + , A − , B + , B − , C + , C − , O + , O − } is the blood type, is the total blood units of type on queue, is the current day of operation, and is the expired blood unit if its life, , on the queue is greater than its shelf life, life.

Bottom-Up
Technique. Some blood types are compatible while others are not, as shown in Figure 1. Thus, when there is a request for some units of a particular blood type, the request could be met using the same blood type if there are enough of its units in the bank. If there are not enough units (shortage) of the type requested, available units of compatible types are used to meet up the remaining units. In this case, a bottomup approach was used in the course of assigning blood to meet the request. This means that, whenever blood is to be assigned, the requested blood type is considered first; when there is a shortage the next available compatible blood type is assigned, and so forth. Blood type O − is the last option, being the universal donor; if it is not available, then blood will be imported into the bank from external source(s) relative to the request. This approach is exemplified as follows.
Given that typREQ is the number of units requested of blood type typ and typVOL is the number of units of the same blood type that is available in the bank to meet the request, if typREQ > typVOL, then there is a shortage of the blood type to meet the request.

Numerical Simulations
The proposed PSO algorithm proposed for solving the considered problem was investigated, while implementing the modified multiple knapsack problem, with a number of simulations with different datasets. As a result of the nonavailability of real-life data, randomly generated data were used. The stochastic nature of blood donation and requests in real-life scenario informed the usage of the fictitious randomly generated data. Whenever real-life data becomes available, they can be substituted for the fictitious data. The application software was developed in Microsoft Visual C# programming language.

Data Generation.
All the data used were randomly generated based on the uniform random number generator. Given a specified (by the user) upper and lower bounds, random volume of requests and donation for each blood type is computed in each day. This provided the opportunity of testing the blood assignment system developed under various scenarios of varied volumes of requested and donatedblood types. Furthermore, an initial volume of all the blood types in the bank was also specified and used to calculate respective volume for each blood type using some blood type proportion. In this case, the blood type proportion in South Africa was used (see Table 1). All the parameters and their respective values as used in the algorithm to generate the testing data are presented in Table 5.

Parameter
Setting. Presented in this section are the definitions of all the parameters used in the course of implementing the proposed model and algorithm. In Table 4, the different blood types and their respective value and proportion are presented. In Table 4, "Value" was computed based on the information in Figure 1. The numerator is the number of compatible blood types that can be received by the respective "Blood type, " while the denominator is the sum of all the compatible blood types.
For the PSO technique, the values for 1 and 2 were, respectively, set to 1.7 and parameter was set to 0.715, as recommended in [27]. The parameters 1 and 2 were randomly generated using the uniform random number generator. A swarm size of 50 particles was used and the maximum number of iteration was set to 1000. Tables 6, 7, 8, 9, 10, 11, and 12 are the average blood units that were available in, requested for, supplied by, and imported into the blood Table 6: Average volume of blood units during a runtime of 90 days with 500 blood units as initial volume (using dataset 1).   From the results, it is evident that managing the blood bank with each of the datasets over the number of specified periods (90 and 365 days) led to average importation of very few blood units from external sources. The importation became necessary when there were shortages of compatible blood types to meet requests. In Table 10, A + blood type was imported into the blood bank when dataset 5 was used (with unequal ratio of requests to donations of blood units). For A − blood type, apart from Table 9 (using dataset 4), some of its units were imported into the bank when the other datasets were used and the average number of units imported was in increasing order with small variations. Using any of the datasets, no units of B + were imported. Some units of B − were imported in Tables 6, 10, 11, and 12 (using datasets 1, 5, 6, and 7). No C + blood type was imported into the bank using any of the datasets. Some units of C − blood type were imported in Tables 7, 11, and 12 (using datasets 2, 6, and 7).

Results and Discussion. Presented in
Much importation was observed with O + and O − blood types, but with O − , being a universal donor, the importation was more compared to others. Also, when there is a shortage of O − type, no other blood types could be used as alternative(s) for it and thus it must be imported into the bank. The very low level of average importation of blood units from external source(s) is an indication that the bank was efficiently managed. This efficient management was a result of combining the efforts of the multiple knapsack problem technique used to implement the cross-matching between blood types and PSO technique used to spread importation of blood types (where necessary) in assigning blood types to meet requests. Using all the tested datasets, no blood units exceeded their shelf life; thus, no wastage of blood products was experienced. The reason for this is that the cross-matching method helps to quickly use the older blood units which have been on queue to meet requests while the new ones donated into the blood bank are enqueued.
Presented in Figures 4 and 5 are the curves showing the various volume levels of the different blood types in the blood bank when the bank was operated for 90 and 365 days, respectively. The curves show the corresponding total units of blood available, requested, supplied, and imported in each day of operating the bank. In figures, it is evident that minimal units of blood were imported from external source(s) into the bank. In the first few days no units were imported, but between 75th and 85th days a higher number of blood units were imported because the number of units requested was higher than the available blood units relative to the blood types requested. From the graphs, it appears that at the point of importation the volume of available blood in the bank was high and there could be the question, why should there be importation? The reason for importation is that the entire volume of blood in the bank comprised all the units of all blood types and the other units of blood available at the point of importation were not compatible with the blood types requested; therefore, they could not be supplied or used to meet the requests. Also, in Figure 5, the curves show the corresponding total units of blood available, requested, supplied, and imported in each day of operating the bank for a period of 365 days. In this case, the total units of blood imported (though little) were higher than when the bank was operated for 90 days. In the graphs, it is observed that the highest units of blood were imported between the 340th and 350th days. At this period, some of the available blood types were already exhausted and there were needs for importation of blood units from external source(s) to meet the requests.
Presented in Figure 6 are the curves showing the number of blood units imported when the algorithm was tested with all the datasets. The highest importation of blood units occurred when dataset 4 was used (Figure 6(a)) and when dataset 7 was used ( Figure 6(b)); these occurred around the 80th and 350th days, respectively. In Figure 7, the ratios of total units of blood imported to total units of blood requested for both 90 and 365 days of operating the blood bank are presented. For the graphs, the algorithm appears not to have performed very well with datasets 5 and 7.   Figure 5: Importation rate of blood units using datasets 6 and 7.

Conclusion
The problem of assigning of blood units by blood banks to meet requests for blood transfusion in hospitals has been considered in this paper and an efficient method of handling this problem was proposed. The method that was proposed combined the efforts of the PSO technique and multiple knapsack problem. The multiple knapsack problem was modified to reflect some additional constraints that needed to be satisfied for the blood bank to be efficiently managed. Using the queue, multiple knapsack problem, and optimization (PSO) techniques, the total units of blood types imported into the bank were greatly minimized and no wastage was experienced.  Only the red blood cells were considered in the paper and no real-life data were used but randomly generated data.  Therefore, with respect to future work, other components of the blood could be considered and the proposed method could be tested with real-life data.