1
$\begingroup$

In evolutionary computation and in particular in the context of genetic algorithms, there is a stochastic operation called "fitness function". The better a state, the greater the value of the fitness function for that state.

$\endgroup$
  • 2
    $\begingroup$ Can you please reflect more on the question what is your contribution to solving the problem...It helps the answerer to know your perspective and also helps to narrow down the scope. $\endgroup$ – DuttaA Nov 22 '18 at 6:29
  • $\begingroup$ I could answer this question, but, as a first step, you should try to describe the 8 queens problem. What's the goal in this problem/game? How do you know if a certain board configuration is better than another? $\endgroup$ – nbro Nov 22 '18 at 10:49
  • $\begingroup$ 8queen problem is 8*8 game means 8 columns and 8 rows.Goal is that queens should be placed in such a way that no queen can attack one another. $\endgroup$ – Huma Qaseem Nov 22 '18 at 12:14
0
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

This can be calculated quite easily in the context of 8-queen problem. Just start with a particular configuration. Starting from the queen in the left-most column just keep on counting the non-attacking positions (pairs) on the right with each queen. Carry on column by column towards your right until you reach the last queen. As a special case for the last queen the non-attacking pairs will be zero as their are no other queens after that.

$\endgroup$
  • $\begingroup$ This describes how to solve the problem, but it doesn't answer the question which is about formulating this as a fitness function to use in evolutionary computing. $\endgroup$ – Oliver Mason Dec 2 at 11:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.