How to design a fitness function for the 8-queens problem?
Here you can find an example of how to apply genetic algorithms to solve the 8-queens problem.
The proposed fitness function is based on the chessboard arrangement, and in particular, it is inversely proportional to the number of clashes amongst attacking positions of queens; thus, a high fitness value implies a low number of clashes.