|Top Previous Next|
You don't need to know how a genetic algorithm works to use PerfectTablePlan. This section 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 a staggering 15,511,210,043,330,985,984,000,000 different ways. So we have to find an efficient way to search though the possible assignments to find a good one in a reasonable time. PerfectTablePlan does this using a 'genetic algorithm'.
A genetic algorithm works by my mimicking the Darwinian process of natural selection over successive generations:
1.An initial population of assignments is created using various rules of thumb ('heuristics').
2.The assignments are randomly mutated and spliced to produce new layouts.
3.Weak assignments (those with low scores) are eliminated from the population.
4.If the best assignment isn't satisfactory go to step 2.
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 assignment score with simple drag and drop. But if we 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 in a reasonable time.
The number of combinations for seating n guests in n seats is n! ( n factorial). 3! is 3x2x1. 10! is 10x9x8x7x6x5x4x3x2x1. This means that the difficulty of the problem rises very rapidly with the number of guests. For example:
25! = 15511210043330985984000000
50! = 30414093201713378043612608166064768844377641568960512000000000000
100! = 9332621544394415268169923885626670049071596826438162146859296389
200! = 7886578673647905035523632139321850622951359776871732632947425332
So don't be surprised if PerfectTablePlan takes a while to do an automatic assignment for 1000+ guests.