Question: please solve it in 2 hour please Q1. Write a python program to choose one of 4 colours (red, blue, green, orange) for 6 regions

please solve it in 2 hour pleaseplease solve it in 2 hour please Q1. Write a python program

Q1. Write a python program to choose one of 4 colours (red, blue, green, orange) for 6 regions of Pakistan such that adjacent regions are not assigned the same colour. The 6 regions are Baluchistan (B), Sindh (s), Punjab (P), Khaybar-Pakhtunkhwa (KP), Kashmir (K) and Gilgit-Baltistan (GB). As you know B is adjacent to S, P and KP, P is adjacent to S, B and KP, KP is adjacent to B, P, K and GB, and K is adjacent to P, KP and GB. No graphical output is required, output similar to following is enough: {"B': 'red', 'P': 'blue', 'S': 'green', 'KP': 'green', 'K': 'red', 'GB': 'blue'} For variables and domains defined as variables = ('B', 'P', 'S', 'KP', 'GB','K') domains = dict(lv, ['red', 'blue','green','orange']) for v in variables) You are required to use Backtracking search for this constraint satisfaction problem. Submit your python code only. (20 Marks) Q2. We have 04 features in our system {X1, X2, X3, Xx}. Their possible values are D1 = {1,2,3,...,10}, D2 = {red, blue, green}, Dz = {A, B, C, D,E,F}, D4 = {a,b,y,8,0,1}. Goal is to find {X1 = 5,X2 = blue, X3 = F,X4 = 1} using genetic algorithm. An initial population was generated as Pa = {2, blue, E,y}, P2 = {5, red, F,a}, Pz = {7, green, B,B), P4 = {9, blue, A, 9}. A fitness function is defined that gives marks according to the number of features matching with the goal. Therefore, for the initial population the fitness function gives marks f(P) =1, f (P2) = 2, f (P3) = 0, f (PA) = 1. a) Find a possible next set of population using all steps of genetic algorithm i.e. selection, crossover and mutation (show all steps). b) Find a possible next set of population using the population found in part a, while assuming zero mutation probability (show all steps). c) Is it possible to find the goal state if mutation probability is always kept zero? explain your reason

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!