Question: Code in Java Queens problem, where the objective is to place 8 queens on a chess board so that no two queens can attack each

Code in Java

Queens problem, where the objective is to place 8 queens on a chess board so that no two queens can attack each other. A solution corresponding to a goal state is shown in the picture below.

Q
Q
Q
Q
Q
Q
Q
Q

In this question, your objective is to compare the performance of different crossover operators. The crossover operators you need to program are the following: single point crossover, two point crossover, cut and splice, uniform crossover.

You should use the same representation of a chromosome, fitness function, etc. For example, the chromosome or state for the picture above is 86427531.

Your program should first prompt the user for the following input (just input values on a single line, separated by blank space):

Initial population size

Number of chromosomes to select at each iteration or generation of the GA

Mutation rate

Number of iterations or generations to run the GA for; -1 to run the GA until a goal state isfound.

Other parameters can be hardcoded. Then, it should prompt the user to choose one of the crossover operators from a menu. Add an option to exit the program from this menu. After a crossover operator is selected, the program runs. At the end of the run, your program should print (each output on a separate line):

Values of input and hardcoded parameters used (on a single line, comma-separated, format:- )

Number of iterations or generations of the GA executed

Final state reached

Final states fitness function value.

After printing the output, the program should go back to the first menu prompt for another the crossover operator or exit.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!