# An Application of an Unequal-Area Facilities Layout Problem with Fixed-Shape Facilities
## 3 A Genetic Algorithm (GA) for the UA-Flp
### Pseudocode of the Proposed GA  
The steps of the proposed GA are given below:  
\(\pi\_worst=\) worse solution in current population \(g\) (\(P_{g}\))  
Recall, in \(P_{g}\), chromosomes are ordered in ascending order based on TWD.  
Step 1:  Initialize parameters.  
Initialize parameters \(Gen\_Size\), \(Max\_Num\_Cross>Gen\_Size\), \(Num\_Rand\_Chrom\), \(Max\_Duration\).  
Set \(g=0\);  
Set \(curr\_parents\_offspr\_count=0\) (number of chromosomes generated from current pair of chromosomes using the crossover operator).  
Set TWD* = large number.  
Step 2:  Start new population.  
Set \(chromosome\_count=0\) (number of chromosomes generated at iteration \(g\)).  
Step 3:  Generate chromosome.  
If \(chromosome\_count\geq Max\_Num\_Cross\) then go to step 5; Else If \(g=0\), then Randomly generate chromosome \(\pi\). Else If \(curr\_parents\_offspr\_count=0\) then Randomly pick two chromosomes \(\pi^{\prime}\) and \(\pi^{\prime\prime}\) from the generation \(P_{g\_1}\) and set \(\pi^{1}=\pi^{\prime}\) and \(\pi^{2}=\pi^{\prime\prime}\). Set \(curr\_parents\_offspr\_count=curr\_parents\_offspr\_count+1\); Else Set \(\pi^{1}=\pi^{\prime}\), and \(\pi^{2}=\pi^{\prime}\). Set \(curr\_parents\_offspr\_count=0\). Generate chromosome \(\pi\) from \(\pi^{1}\) and \(\pi^{2}\) by applying crossover operation. Generate the layout corresponding to chromosome \(\pi\) using BSH. Step 4: Add chromosome \(\pi\) to new population and run BSH with \(\pi\) as a starting solution. Set \(\pi\_\text{worst}=P_{g\_Gen\_Size}\); If \(chromosome\_count<Gen\_Size\) or \(\text{TWD}(\pi)<\text{TWD}(\pi\_\text{worst})\) If \(\text{TWD}(\pi)<\text{TWD}^{*}\) Initialize \(\text{TWD}^{*}\), \(x^{*}_{i}\), \(y^{*}_{i}\), \(l^{*}_{i}\), and \(w^{*}_{i}\) from the values \(\text{TWD}(\pi)\), \(x_{i}\), \(y_{i}\), \(l_{i}\), and \(w_{i}\), respectively.  
Add chromosome \(\pi\) to new generation \(P_{g}\). When adding the chromosome to the generation, make sure that the higher quality solutions precede lower quality solutions. Also, if \(chromosome\_count\geq Gen\_Size\), then drop the worst (\(Gen\_Size\)-th) chromosome from \(P_{g}\). Run the dual simplex method to improve the chromosomes. This will modify the values of \(\text{TWD}^{*}\), \(x^{*}_{i}\), \(y^{*}_{i}\), \(l^{*}_{i}\), and \(w^{*}_{i}\), if it finds a better solution, than the best solution found thus far. Set \(chromosome\_count=chromosome\_count+1\), and go to Step 3; Step 5: Check stopping criterion and add random chromosomes to the new population. If the heuristic has been running for more than \(Max\_Duration\) minutes, then go to Step 6. Else Remove the last \(Num\_Rand\_Chrom\) (worst) chromosomes from \(P_{g}\), and add \(Num\_Rand\_Genes\) randomly generated chromosomes to the generation. While adding new chromosomes to the generation, make sure that higher quality solutions precede lower quality solutions. Set \(g=g+1\), and go to Step 2. Step 6: Output the best solution (i.e., \(x^{*}_{i}\), \(y^{*}_{i}\), \(l^{*}_{i}\), \(w^{*}_{i}\) for all \(i=1,\ldots,N\)), and terminate the heuristic;