You don't need to know anything about genetic algorithms to use PerfectTablePlan. This page is just included in case you are interested.
It isn't possible to try every combination of guests and seats, because there are so many. Even just 25 guests can be assigned to 25 seats in 15511210043330985984000000 different ways. An efficient approach is required to search though the possible layouts to find a good solution in a reasonable time. PerfectTablePlan does this using a genetic algorithm.
A genetic algorithm works by mimicking the Darwinian process of natural selection over successive generations:
- an initial population of layouts is created using various rules of thumb ('heuristics').
- the layouts are randomly mutated and spliced to produce new layouts, which are added to the population.
- weak layouts (those with low scores) are eliminated from the population.
- go to step 2.
This process continues until a satisfactory solution is reached. In PerfectTablePlan you can choose to stop:
- after a specified number of seconds; or
- after a specified number of generations without improvement; or
- either of the above (whichever happens first)
Because of the way a genetic algorithm works, it cannot be guaranteed to give a mathematically optimal answer - sometimes you can spot ways to improve the layout score with simple drag and drop. But if PerfectTablePlan were to use an approach that was guaranteed to give a mathematically optimal answer, it might take years to run. The PerfectTablePlan genetic algorithm will usually get close to an optimal solution very quickly.
The number of combinations for seating n guests in n seats is n! ( n factorial). This means that the difficulty of the problem rises very rapidly with the number of guests. For example:
25! = 15511210043330985984000000
50! = 30414093201713378043612608166064768844377641568960512000000000000
100! = 93326215443944152681699238856266700490715968264381621468592963895217599993229915608
200! = 788657867364790503552363213932185062295135977687173263294742533244359449963403342920304284
1000! has 2,568 digits. So don't be surprised if PerfectTablePlan takes a while to do an automatic layout for 1000+ guests!
More information on genetic algorithms: