AI INTRODUCTION What is Artificial Intelligence? Intelligence is the ability to think, to imagine, to create, memorize, understand, recognize patterns, make choices, adapt to change and learn from experience. Artificial intelligence is a human endeavor to create a non-organic machine-based entity, that has all the above abilities of natural organic intelligence. Hence it is called as 'Artificial Intelligence' (AI). Examples: Speech recognition, Smell, Face, Object, Intuition, Inferencing, Learning new skills, Decision making, Abstract thinking It deals with 4 terms: 1. 2. 3. 4. Thinking humanly Thinking Rationally Acting humanly Acting rationally Acting Humanly: The Turing Test • Alan Turing (1912-1954) • “Computing Machinery and Intelligence” (1950) • Predicted that by 2000, a machine might have a 30% chance of fooling a lay person for 5 minutes. • Anticipated all major arguments against AI in following 50 years. • Suggested major components of AI: knowledge, reasoning, language, understanding, learning Thinking Humanly: Cognitive Modelling • Not content to have a program correctly solving a problem. More concerned with comparing its reasoning steps to traces of human solving the same problem. • Requires testable theories of the workings of thehuman mind: cognitive science. Thinking Rationally: Laws of Thought • Aristotle was one of the first to attempt to codify “right thinking”, i.e., irrefutablereasoning processes. • Formal logic provides a precise notation and rules for representing and reasoning with all kinds of things in the world. • Obstacles: - Informal knowledge representation. - Computational complexity and resources. Acting Rationally • Acting so as to achieve one’s goals, given one’s beliefs. • Does not necessarily involve thinking. • Advantages: - More general than the “laws of thought” approach. - More amenable to scientific development than human- based approaches. Task Domains of AI • Mundane Tasks: i) Perception ii) Vision iii) Speech iv) Natural Languages v) Robot Control • Formal Tasks i) Games : chess, checkers etc ii) Mathematics: Geometry, logic,Proving properties of programs • Expert Tasks: i) Engineering ( Design, Fault finding, Manufacturing planning) ii) Scientific Analysis iii) Medical Diagnosis iv) Financial Analysis AI Technique • AI technique is a method that exploits knowledge that should be represented in such a way that: • Knowledge captures generalization • It can be understood by people who must provide it • It can be easily modified to correct errors. • It can be used in variety of situations Tic Tac Toe • Three programs are presented : • Series increase • Their complexity • Use of generalization • Clarity of their knowledge • Extensability of their approach Introductory Problem: Tic-Tac-Toe Program 1: Data Structures: • Board: 9 element vector representing the board, with 1-9 for each square. An element contains the value 0 if it is blank, 1 if it is filled by X, or 2 if it is filled with a O • Movetable: A large vector of 19,683 elements ( 3^9), each element is 9-element vector. Algorithm: 1. View the vector as a ternary number. Convert it to a decimal number. 2. Use the computed number as an index into Move-Table and access the vector stored there. 3. Set the new board to that vector. Comments: This program is very efficient in time. 1. A lot of space to store the Move-Table. 2. A lot of work to specify all the entries in the Move-Table. 3. Difficult to extend. Program 2: Data Structure: A nine element vector representing the board. But instead of using 0,1 and 2 in each element, we store 2 for blank, 3 for X and 5 for O Functions: Make2: returns 5 if the centersqaure is blank. Else any other balnksq Posswin(p): Returns 0 if the player p cannot win on his next move; otherwise it returns the number of the square that constitutes a winning move. If the product is 18 (3x3x2), then X can win. If the product is 50 ( 5x5x2) then O can win. Go(n): Makes a move in the square n Strategy: Turn = 1 Go(1) Turn = 2 If Board[5] is blank, Go(5), else Go(1) Turn = 3 If Board[9] is blank, Go(9), else Go(3) Turn = 4 If Posswin(X) 0, then Go(Posswin(X)) ....... Comments: 1. Not efficient in time, as it has to check several conditions before making each move. 2. Easier to understand the program’s strategy. 3. Hard to generalize. Program 3: 1. If it is a win, give it the highest rating. 2. Otherwise, consider all the moves the opponent could make next. Assume the opponent will make the move that is worst for us. Assign the rating of that move to the current node. 3. The best node is then the one with the highest rating. Comments: 1. Checking for a possible win is quicker. 2. Human finds the row-scan approach easier, whilecomputer finds the number-counting approach moreefficient. 3. Require much more time to consider all possible moves. 4. Could be extended to handle more complicated games. Applications of AI Artificial Intelligence in the form of expert systems and neural networks have applications in every field of human endeavor. They combine precision and computational power with pure logic, to solve problems and reduce error in operation. Already, robot expert systems are taking over many jobs in industries that are dangerous for or beyond human ability. Some of the applications divided by domains are as follows: Heavy Industries and Space: Robotics and cybernetics have taken a leap combined with artificially intelligent expert systems. An entire manufacturing process is now totally automated, controlled and maintained by a computer system in car manufacture, machine tool production, computer chip production and almost every high-tech process. They carry out dangerous tasks like handling hazardous radioactive materials. Robotic pilots carry out complex maneuvering techniques of unmanned spacecrafts sent in space. Japan is the leading country in the world in terms of robotics research and use. Finance: Banks use intelligent software applications to screen and analyze financial data. Softwares that can predict trends in the stock market have been created which have been known to beat humans in predictive power. Computer Science: Researchers in quest of artificial intelligence have created spin offs like dynamic programming, object oriented programming, symbolic programming, intelligent storage management systems and many more such tools. The primary goal of creating an artificial intelligence still remains a distant dream but people are getting an idea of the ultimate path which could lead to it. Aviation: Air lines use expert systems in planes to monitor atmospheric conditions and system status. The plane can be put on auto pilot once a course is set for the destination. Weather Forecast: Neural networks are used for predicting weather conditions. Previous data is fed to a neural network which learns the pattern and uses that knowledge to predict weather patterns. Swarm Intelligence: This is an approach to, as well as application of artificial intelligence similar to a neural network. Here, programmers study how intelligence emerges in natural systems like swarms of bees even though on an individual level, a bee just follows simple rules. They study relationships in nature like the prey-predator relationships that give an insight into how intelligence emerges in a swarm or collection from simple rules at an individual level. They develop intelligent systems by creating agent programs that mimic the behavior of these natural systems! Defining the problem as State Space Search • The state space representation forms the basis of most of the AI methods. • Its structure corresponds to the structure of problem solving in two important ways: It allows for a formal definition of a problem as the need to convert some given situation into some desired situation using a set of permissible operations. It permits us to define the process of solving a particular problem as a combination of known techniques (each represented as a rule defining a single step in the space) and search, the general technique of exploring the space to try to find some path from current state to a goal state. Search is a very important process in the solution of hard problems for which no more direct techniques are available. Example: Playing Chess • To build a program that could “play chess”, we could first have to specify the starting position of the chess board, the rules that define the legal moves, and the board positions that represent a win for one side or the other. • In addition, we must make explicit the previously implicit goal of not only playing the legal game of chess but also winning the game, if possible, • The starting position can be described as an 8by 8 array where each position contains a symbol for appropriate piece. • We can define as our goal the check mate position. • The legal moves provide the way of getting from initial state to a goal state. • They can be described easily as a set of rules consisting of two parts: • A left side that serves as a pattern to be matched against the current board position. • And a right side that describes the change to be made to reflect the move • However, this approach leads to large number of rules 10120 board positions !! • Using so many rules poses problems such as: • No person could ever supply a complete set of such rules. • No program could easily handle all those rules. Just storing so many rules poses serious difficulties. Defining chess problem as State Space search • We need to write the rules describing the legal moves in as general a way as possible. • For example: – • White pawn at Square( file e, rank 2) AND Square( File e, rank 3) is empty AND Square(file e, rank 4) is empty, then move the pawn from Square( file e, rank 2) to Square( file e, rank 4). In general, the more succintly we can describe the rules we need, the less work we will have to do to provide them and more efficient the program. Water Jug Problem • The state space for this problem can be described as the set of ordered pairs of integers (x,y) such that x = 0, 1,2, 3 or 4 and y = 0,1,2 or 3; x represents the number of gallons of water in the 4-gallon jug and y represents the quantity of water in 3-gallon jug • The start state is (0,0) • The goal state is (2,n) Production rules for Water Jug Problem • The operators to be used to solve the problem can be described as follows: To solve the water jug problem • Required a control structure that loops through a simple cycle in which some rule whose left side matches the current state is chosen, the appropriate change to the state is made as described in the corresponding right side, and the resulting state is checked to see if it corresponds to goal state. • One solution to the water jug problem • Shortest such sequence will have a impact on the choice of appropriate mechanism to guide the search for solution. Formal Description of the problem 1. Define a state space that contains all the possible configurations of the relevant objects. 2. Specify one or more states within that space that describe possible situations from which the problem solving process may start ( initial state) 3. Specify one or more states that would be acceptable as solutions to the problem. ( goal states) 4. Specify a set of rules that describe the actions ( operations) available.