Genetic algorithm |
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:
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 52175999932299156089414639761565182862536979208272237582511852109168640 00000000000000000000000
200! = 7886578673647905035523632139321850622951359776871732632947425332 44359449963403342920304284011984623904177212138919638830257642790242637 10506192662495282993111346285727076331723739698894392244562145166424025 40332918641312274282948532775242424075739032403212574055795686602260319 04170324062351700858796178922222789623703897374720000000000000000000000 000000000000000000000000000 So don't be surprised if PerfectTablePlan takes a while to do an automatic assignment for 1000+ guests. |