# Genetic Algorithm for the Retailers' Shelf Space Allocation Profit Maximization Problem
## 5 Genetic Algorithm
### Chromosome Correction  
The solution attained after mutation and recombination is checked to see if it satisfies the defined constraints and corrected if necessary and when possible. If the current solution exceeds the predefined limits, the productappings, nestings, and facings are extracted from the shelf until constraints are met, or it is impossible to delete product items anymore. The individual object has a special field where the initial algorithm that generates the solution is stored. Mostly, the 13 algorithms introduced earlier are used as the initial ones. All iterations in subsequent steps are performed with the HUPWDR-F1 algorithm, which is the most profitable one. However, if the total GA iteration cannot improve the previous step's solution, then algorithms on all individuals are reassigned, using 13 algorithms that are evenly distributed. After successful solution improvement, HUPWDR-F1 has applied again to all individuals. The correcting procedure consists of two phases. First, minimum values are set into the solution obtained from the recombination, improvement and mutation procedures, where these values are less than the defined lower bounds. Second, redundant product items are extracting: this deletes product items if they exceed the upper bound constraints. The following parameters are set to minimum values if they are below the lower bound values:  
* Facings LB--if the product's number of facings is less than the minimum feasible facings for the product, it is set to the lower bound. * Cappings LB--if the product's number of exppings is less than the minimum feasible comppings for the product, it is set to the lower bound. * Nestings LB--if the product's number of nestings is less than the minimum feasible nestings for the product, it is set to the lower bound. * Shelves LB--if the shelf number where the product is placed is less than the minimum shelf number for the product, the product is placed on other shelves until the lower bound value is not met. The extraction order is based on the algorithm currently assigned to the individual (HUPWDR-F1 or any of the 13 possible ones). If it is not possible to correct a solution or any constraint from the set does not fit, and the next product item extraction is impossible, this chromosome is deleted from the population. The following constraints are checked:1. Shelf constraints: * Shelf length--whether the total width of products on each shelf exceeds the shelf length limit; * Shelf height--whether the max height of products on each shelf exceeds the shelf height limit; * Shelf weight--whether the total weight of products on each shelf exceeds the shelf weight limit; 2. Shelf type constraints: * Pallet--whether the shelf is a pallet and products placed on it must be placed on a pallet; * Eye level--whether the shelf is at eye level and products placed on it must be placed at eye level; * Low level--whether the shelf is at a low level and products placed on it must be placed at low level; 3. Product constraints: * Facings UB--whether the product's facings exceed the maximum facings for the product. * Cappings UB--whether the product's exppings exceed the maximum exppings for the product. * Nestings UB--whether the product's nestings exceed the maximum nestings for the product. * Shelves UB--whether the shelf number where the product is placed exceeds the maximum shelf number for the product. * Supply limit--whether the sum of the product's facings, exppings or nestings exceeds the supply limit. 4. Position allocation constraints: * First aisle products--whether the shelf product kit allows for the first aisle products to be placed near the first aisle. * Last aisle products--whether the shelf product kit allows for the last aisle products to be placed near the last aisle. * Shelf center products--whether the shelf product kit allows the shelf center products to be placed in the shelf center. * Convenience products--whether the shelf product kit allows for convenience products to be placed in the virtual segment for convenience products.