80 likes | 243 Views
Department of Computer and Information Science, School of Science, IUPUI. Models of Computation - State Transition Diagrams. CSCI 230. Dale Roberts, Lecturer Computer Science, IUPUI E-mail: droberts@cs.iupui.edu. Models of Computation. What is a model?
E N D
Department of Computer and Information Science,School of Science, IUPUI Models of Computation - State Transition Diagrams CSCI 230 Dale Roberts, Lecturer Computer Science, IUPUI E-mail: droberts@cs.iupui.edu
Models of Computation • What is a model? • Capture the important properties of the real thing • probably be different in scale from the real thing • suppress details of the real thing • lack full functionality of the real thing Example: A model to compute the distance traveled for a moving vehicle: d = r*t or t = d/r d = distance; r = rate of speed; t = time
Why we need models if they are not the real thing? • By changing some aspects, we can observe their effects • Can provide an environment for learning • They can be used as design tools without actually building the real thing – for economic reasons • In summary, they can be predict, can be used for training, can be used as test beds.
Model of a Computing Agent Q: Operations in an algorithm must be unambiguous and effectively computable. Therefore, could we design a model of an algorithm before we implement the algorithm in hardware and /or software? A: A computing agent (robot) is a thing/a person that carries out the operations described in an algorithm.
Input Environment ? agent Output motor • Properties of a Computing Agent • can accept an input • can store & retrieve information from memory • can take actions according to instructions – the actions may depend upon a present state and the current input • can produce an output • Agent • So, what is a State?
Phone 0/1 (input) Office 0/1 Answer the Phone 0/1 (output) A Concept of a State Consider a simple scenario: If I am in my office: if the phone rings; I’ll answer the phone and leave my office if the phone does not ring; I’ll not answer the phone and will stay in the office If I am NOT in my office: if the phone rings; I’ll NOT answer the phone but I’ll come back to my office if the phone does not ring; I’ll not answer it and will stay away from the office Phone ring I am in office Answer I will be in office? 1 1 1 0 0 1 0 1 1 0 0 1 0 0 0 0 function notation
1 / 1 in office out of office 0 / 0 A B 0 / 0 1 / 0 Present State Next State (Output) phone = 0 phone = 1 A A, 0 B, 1 B B, 0 A, 0 State Transition Diagrams • Output depends NOT ONLY on the INPUT, but also depends on the internal (current) state of the office (0/1). Let A: is a state when I’m in the office B: is a state when I’m NOT in the office State TableState Transition Diagram
State Transition Diagrams • What does the following state transition diagram do? nonalpha/nonalpha A B alpha/alpha nonalpha/nonalpha alpha/upper(alpha)