hw1 - number of move required(optimally) to reach the goal...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Answer to question no 1 a. Define a state representation. As there are three pegs, so the state can be represented by 3 stack S1,S2 & S3, where last inserted disk will be pop out first and the disks can be represented by Di where i=1,2, . ..n. Where size of Di < size of Dj if i<j. Each disk can be on one peg at a time.Here is an example of a state with 5 pegs S1 = {} S2 = {D1} S3 = {D5 , D4,D3,D2} b. Formally formulate this problem as a search problem with required components. For n disk problem, Initial State: S1 = {Dn , Dn-1 , . .. , D1} S2 = {} S3 = {} Goal Test: If the state matches with following then goal is reached. Othrwise not. S1 = {} S2 = {} S3 = {Dn , Dn-1 , . .. , D1} Successor function: A disk Dk can be moved from Pegi to Pegj if Dk is on top of Pegi and the current top disk of Pegj is larger than Dk. Path Cost The number of moves required to reach goal state. If each valid move costs 1 then
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: number of move required(optimally) to reach the goal is: T n = 2 T n-1 + 1 , where T 1 = 1. Ti = number of moves required to place total i disk properly. Supppse the pegs are A,B &amp; C.To move n disks from peg A to peg C: 1 move n?1 disks from A to B. This leaves Dn on peg A 1/2 2 move Dn from A to C 3 move n?1 disks from B to C so they sit on Dn If we solve this recursive equation then we will get the number of move is 2 n-1. c. What is the total number of legal states? Let, the disks, Dn, Dn-1 , . .. D1 are indexed according to their size. So Dn is the largest and D1 is the smallest. The possible choice for putting Dn in peg is 3. For each of the mentioned option of Dn, the option for D n-1 is 3. In this way we can say that number of legal moves is, 3* 3 * . .. * 3 = 3 n 2/2...
View Full Document

Page1 / 2

hw1 - number of move required(optimally) to reach the goal...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online