Seating Arrangement Finder

This program uses a simple genetic algorithm to optimize seating arrangements. The answer returned is not guaraunteed to be optimal.

The program can be downloaded from here:
Source

It can also be tried from this site. You can copy and paste input (or just type it) into the box below and it will be run. See below for sample input.


In the output, note that 0 means that the chair is empty. Other numbers represent that person. (So, 1 is the first person, etc.)

Examples

Try these examples in the textbox above.

Person 1 and person 2 like each other, but person 3 dislikes 1. There are 2 tables of 4 chairs each for them to be seated at.

People: 3
Tables: 2
Chairs: 4 4

Likes:
1 2 1
2 1 3
3 1 -5 

1, 2, and 3 are a family and all like each other. 4, 5, and 6 are a family and all like each other. 1 also greatly admires 4. (Try changing the 7 to an 8.) There are 2 tables of 5 chairs each for them to be seated at.

People: 6
Tables: 2
Chairs: 5 5

Likes:
1 2 2
1 3 2
2 1 2
2 3 2
3 1 2
3 2 2

4 5 2
4 6 2
5 4 2
5 6 2
6 4 2
6 5 2

1 4 7