• No results found

Ai Units 1 and 2

N/A
N/A
Protected

Academic year: 2021

Share "Ai Units 1 and 2"

Copied!
68
0
0

Loading.... (view fulltext now)

Full text

(1)

A.Rakesh Babu M.C.A., M.Tech 1

Artificial

intelligence

Master of Computer Applications

GVR & S College of Engineering and Technology

Budampadu, Guntur

(2)

CHAPTER-1

WHAT IS ARTIFICIAL INTELLIGENCE

Artificial Intelligence(AI) is the key technology in many of today’s Novell applications, ranging from banking system that detect attempted credit card framed, to telephone systems that understand speech, to s/w systems that notice when you are having problems and offer appropriate advice. These technologies would not exist today without the sustained federal of fundamental AI research over the past 3 decades.

There is no clear definition of A.I .even the name is controversial, some people prefer to call the subject of “computational Intelligence”.

The term A.I was coined in 1957 at a conference at Dartmouth New Hampshire convened to discuss the possibilities of simulating human intelligence and thinking in computers.

Today, AI is a well-established, natural and scaling branch of computer science.

A.I is the part of computer science concerned with designing intelligent computer systems, that is, computer systems that exhibit the characteristics we associate with intelligence in human behavior understanding language, learning, reasoning and solving problems. The study of AI by considering a number of alternative definitions.

1) AI is the study of how to make computers do things which at the moment people do better. It refers to the current state of computer science and if excludes a major area of problems that can not be solved well either by computers or by people at the moment.

2) AI is a field of study that encompasses computational techniques for performing tasks that apparently require intelligence when performed by humans.

3) AI is about generating representations and procedures that automatically solve problems which can be solved by humans.

4) AI is the part of computer science concerned with designing intelligent computer systems that is computer systems that exhibit the characteristics we associate with intelligence in human behavior-understanding language, learning, reasoning and solving problems.

In practical terms, intelligence of a computer system provides:-

(3)

A.Rakesh Babu M.C.A., M.Tech 3

 More autonomy in computer systems, less requirement for human intervention or monitoring.

 Feasibility in dealing with variability in the environment in an appropriate manner.  Ability to understand what the user wants from limited instructions.

 Increase in the performance by learning from experience.

AI problems

Intelligence does not imply perfect understanding: every intelligent being has limited perception, memory, and computation. AI seeks to understand the computations required from intelligent behavior and to produce computer systems that exhibit intelligence. Aspects of intelligence studied by AI include perception, motor control, and communication using human languages, reasoning, planning, learning and memory. Various AI problems are as follows.

Mundane Tasks  Perception

---Machine vision ---Speech understanding  Natural language processing

--- Natural language understanding ---Language generation ---Machine translation  Commonsense reasoning  Robot control Formal tasks  Games ---Chess ---Backgammon

(4)

---Checkers  Mathematics

---Geometry ---Logic

---Integral calculus

---Proving properties of programs. Expert tasks  Engineering ---Design ---Fault finding ---Manufacturing planning  Scientific analysis  Medical diagnosis  Financial analysis

Perception:

Machine vision:-

Accurate machine vision opens up a new world of computer applications. These applications include mobile robot navigation, complex manufacturing tasks, analysis of satellite images, and medical image processing.

Perception of the world around us is crucial to our survival. Animals with much less intelligence than people are capable of more sophisticated visual perception than are current machines.

If it easy to interface a TV camera to a computer and an image into memory. The problem is understanding what the image represents vision takes lots of computation. Speech understanding:

Spoken language is a more natural form of communication in many human computer interfaces. Speech understanding is available now on personal computers. These

(5)

A.Rakesh Babu M.C.A., M.Tech 5

systems must be trained for the individual user and require pauses between words. Understanding continuous speech with a larger vocabulary is harder.

The ability to use language to communicate a wide variety of ideas is perhaps the most important thing that separates human from other animals.

Natural Language Processing:

Natural Language understanding:-

Natural languages are human languages such as English. Making computers understand English allows non- program mess to use them with little training.

Natural language generation:-

Making computers to generate human or natural languages can be called as natural language generation. It is much easier than natural language understanding

Machine Translation:-

A text written in one language and then generate it in another language by means of computers can be called as machine Translation. It is important for organizations that operate in many countries.

Common Sense Reasoning:-

A computer program that interacts with real world must be able to reason about things like time, space and materials. As a fundamental and commonsensical as these concepts may be modeling them turns out to present some problems.

Robot

Control:-Robots can process visual and auditory information, and they can also be equipped with more special sensors, such as laser range finders, speedometers and radar. Although industrial robots to date have been expensive, robot hardware can be cheap. What is needed is perception and intelligence to tell robot effectors what to do; “bling” robots are limited to very well-structured tasks like spray painting car bodies.

Planning:-

Planning attempts to order the application of resources to achieve goals planning applications include logistics; manufacturing scheduling planning steps in manufacturing is to construct a desired product.

(6)

Expert Systems:-

Expert systems attempt to capture the knowledge of human expert and make it available through a computer program.

Machine Learning:-

Learning has remained a challenging area of AI. Expert systems may perform costly computations to solve problem. Unlike human beings it can’t remember the solution, if it is given the same problem for second time one of the solutions for these problems for programs is to learn on their own either from experience examples or analogy.

AI Technique:-

There AI techniques are:

1. Search

2. Use of knowledge 3. Abstraction Search:-

Search programs find a solution for a problem by trying different sequences of actions/operators until a solution is found.

The advantage of search is, to solve a program using search, it is only necessary to code the operators that can be used: search will find the sequence of actions that will provide the desired result. For example a program can be written to play chess using search if one knows the rules of chess if is not necessary to know how to play good chess.

The disadvantage of search is, most problems have search so large that it is impossible to search the whole space. Chess has been estimated to have 1020 possible games.

Use of Knowledge:-

Use of knowledge provides a way of solving complex problems by exploiting of the objects that are involved. Games can be good models of competitive situations, so

principles discovered in games playing programs may be applicable to practical problems. Abstraction:-

Abstraction provides a way of separating important features and variations from the many unimportant ones that would otherwise overwhelm any process.

CHAPTER - 2

(7)

A.Rakesh Babu M.C.A., M.Tech 7

To build a system to solve a particular problem, for that we need to do four things

1) Define the problem exactly. The definition must include precise specification of what the initial situation will be as well as what final situations constitute acceptable solutions to the problem.

2) Analyze the problem a few very important features can have an immense impact on the appropriateness of various possible techniques for solving the problem.

3) Isolate and represent the task knowledge that is necessary to solve the problem. 4) Choose the best problem solving techniques and apply it to the particular problem.

Defining problem as a state space search

A state space represents a problem in terms of states and operators that change states A state space consists of:

1) A representation of the states the system can be in. in a chess game, for example, any board position represents the current state of the game.

2) A set of operators that can change one state into another state. In chess game, the operators are the legal moves from any given state. Often the operators are representation to represent the new state.

3) An initial state.

4) A set of final states, some of these may be desirable others are undesirable this sets often represented implicitly by a program that deletes terminal states.

Tic-tac-toe as a state space

State space is good representations for board games such as tic-tac-toe the state of a game can be described by the contents of the board and the player whose turn is next. The board can be represented as an array of 9 cells, each of which may contain a X or O or be empty.

State:

 Play to move next X or O.  Board configuration.

(8)

X O

O X

X

Operators: Change an empty cell to X or O. Start state: Board empty, X’s turn

Terminal states: Three X’s in arrow there O’s in arrow all the cells full.

Search tree: The sequence of states formed by possible moves is called a search tree each level of the tree is called a play.

X X X X O X O X O

(9)

A.Rakesh Babu M.C.A., M.Tech 9

Since the same state may be reachable by different sequence of moves the state space may be in a general graph it may be as a tree for simplicity at the cost of duplicating states.

Solving problems using search:

Given an informal description of the problem construct a formal description as a state Space.

 Define a data structure to represent the state.

 Make a representation for the initial state from the given data.

 Write programs to represent operators that change a given state representation to new state representations.

 Write programs to delete terminal state.

Choose an appropriate search technique based on the following quires: 1) How large is the search space?

2) How well structured is the domain?

3) What knowledge about the domain can be used to guide the search?

Evaluating search strategies:

Completeness: Guarantees finding a solution when ever one exits.

Time Complexity: How long (worst or average case) does it take to find a solution? Usually measured in terms of the number of nodes expanded. Big O notation used for measuring time complexity.

Space Complexity: How much space is used by the algorithm? Usually measured in term of the maximum size that nodes list becomes during the search.

Optimality: If a solution is found is it guaranteed to be an optimal one? That is the one with minimum cost?

(10)

Water jug problem:

There are two jugs a 4-Gallon one and 3-Gallon one. Neither has any measuring marker on it. There is a pump that can be used to fill the jugs with water how can you get exactly 2- Gallon water into the 4- Gallon jug?

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, 4 and y=0, 1, 2, 3.

X represents the number of gallons of water in the 4- Gallon jug. Y represents the number of gallons of water in the 3- Gallon jug. The state space is (0, 0).

The goal state is (2, n) for any value of n. Operators:

The operators to be used to solve the problem can be described as follows.

1. (x, y) (4,y) fill the 4-g jug

If x<4

2. (x, y) (x, 3) fill the 3-g jug

If y<3

3. (x, y) (x-d, y) pour some water out of the 4-g jug If x>0

4. (x, y) (x, y-d) pour some water out of the 3-g jug

If y>0

5. (x, y) (0, y) empty the 4-g jug on the ground

If x>0

6. (x, y) (x,0) empty the 3-g jug on the ground

If y>0

7. (x, y) (4,y-(4-x)) pour water from the 3-g jug into If x + y >= 4 and y>0 the 4-g jug until the 4-g jug is full

(11)

A.Rakesh Babu M.C.A., M.Tech 11

If x + y>3 & x>0 the 3-g jug until the 3-g jug is full 9. (x, y) (x+y,0) pour all the water from 3-g jug into If x + y<=4 and y>0 4-g jug

10. (x, y) (0,x+y) pour all the water from the 4-g jug If x + y<=3 & x>0 into the 3-g jug

11. (0, 2) (2, 0) pour the 2-g from 3-g jug into 4-g Jug

12. (2, y) (0, y) empty the 2-g in the 4-g jug on the ground.

Solution to the water jug problem:

Gallon in the 4-g jug Gallon in the 3-g jug Rule Applied

0 0 2 0 3 9 3 0 2 3 3 7 4 2 5/12 0 2 9/11 1 0

(12)

Production Systems:

The search forms the basic intelligent process it is useful to structure. A.I programs in a way that facilities describing and performing the search process. Production system provides such structures.

A production system consist of

1) A set of rules, each consisting on the left side that determines the applicability of the rule and on a right side that describe the operation to be performed if the rule is applied. 2) One/more knowledge /database that contain what ever information is appropriate for

the particular task. a production system has two memories

a) A production memory or long-term memory contains the production rules.

b) A working memory or short-term memory containing data about the current problem.

3) A control strategy that specifies the order in which the rules will be compared to the database and a way of resolving conflicts that arise when several rules match at once. 4) A rule applier.

The production rules operate on the knowledge base/database. Each rule has a precondition that is either satisfied by the knowledge base. If the precondition is satisfied, the rule can be applied. Application of the rule changes knowledge base. The control system chooses which applicable rule should be applied and causes computation when a termination condition on the knowledge base.

8-Puzzle:

Give an initial configuration of 8 numbered tiles on a 3X3 board, move the files in such a way so as to produce a desired goal configuration of the tiles.

State: 3 X 3 array configuration of the file on the board. Operators: move blank square left, right, up or down. Initial state: a particular configuration of the board. Goal: a particular configuration of the board.

(13)

A.Rakesh Babu M.C.A., M.Tech 13

Initial State Goal State

The traveling sales man problem:

Sales man has a list of cities, each of which he must visit exactly once. Three are direct roads b/w each pair of cities on the list. Find the route the salesman should follows for the shortest possible round trip that both starts and finishes at any of the cities.

Heuristic search:

A heuristic search is a technique that improves the efficiency of search process. One example of a good general-purpose heuristic search that is useful for a variety of combinational problems is the nearest heuristic. Applying it to the traveling salesman problem. Then we produce the following procedure.

1) Arbitrarily select a starting city.

2) Select the next city, look at all cities not yet visited and select the one closet to the current city go to it next

3) Repeat step2 until all cities have been visited.

Problem characteristics:

Heuristic search is very general method applicable to a large class of problems. It encompasses a variety of specific techniques, each of which is particularly effective for a small class of problems in order to choose the most appropriate method for a particular problem. It is necessary to analyze the problem along several key dimensions. The following characteristics are nothing but problem characteristics:

1) Is the problem decomposable into a set of smaller sub problems?

2) Can solution steps be ignored or undone if they do not move towards a solution? 3) Is the problem universe predictable?

4) Can we find a good solution to the problem with out comparing to all other possible solution?

5) Is the desired solution is path/state?

2 1 3 7 8 9 4 7 1 2 3 4 5 6 7 8

(14)

6) Is a large amount of knowledge required to solve the problem to constrain the search?

7) Can a system return the solution/will the solution of the problem require interaction between the system and a person?

Is the problem decomposable into subprograms?

Suppose we want to solve a problem of computing the expression

∫(x3+x2+2x+3sinx) dx

This problem can be solved by breaking it into 4 smaller problems, each of which we can solve by using a small collection of specific rules:

∫ (x3+x2+2x+3sinx) dx

∫ x3 dx ∫ x2dx ∫2x dx ∫ 3sinxdx

x4/4 x3/3 2 ∫ x dx 3 ∫ sin x dx

2x2/2 -3cosx

Fig: A Decomposable Problem

Using the technique of problem decomposition, we can solve very large problems, very easily. This can be considered as one of the intelligent behaviors.

(15)

A.Rakesh Babu M.C.A., M.Tech 15

Can solution steps to be ignored or undone?

Suppose we are trying to prove a mathematical theorem. We may precede by first a lemma that will be useful. Later we may realize that the lemma is not at all useful. We may start with another one to prove the theorem here we can simply ignore the first method we have adopted to find the solution.

Consider the 8-puzzel problem in attempting to solve the 8-puzzel, we might make a stupid move and realize that mistake and found we have done wrong step. But still mistakes can be recovered it may be as easy as in the theorem proving problem here the control strategy must keep track of all the moves. so that we can backtrack to the initial state and start with some new move.

Consider the problem of playing chess. Here once we make move we can never recover from that step.

These three problems, i.e. theorem proving, 8-puzzel, chess illustrate the differences b/w three important classes of problems.

1) Ignorable: In which solution steps can ignore. Ex: Theorem proving

2) Recoverable: In which solution step can be undone. Ex: 8-puzzle

3) Irrecoverable: In which solution steps can not be undone. Ex: chess

Is the problem universe predictable?

Consider 8-puzzle problem. Every time we make a move .we knows exactly what will happen. This means that it is possible to plan an entire sequence of moves and be confident what the resulting state will be. We can backtrack to undone moves if they prove unwise.

Suppose we want to play bridge. Here we need to plan the entire hand before making the first play. But we can not play with certainty. The outcome in this game is very uncertain. In case of 8-puzzlethe outcome is very certain. To solve uncertain outcome problems we need to allow for a process of plan revision to tale place as the plan is carried out and the necessary feedback is provided. The disadvantage is that the planning in these cases is often very expensive.

(16)

Is a good solution absolute/relative?

Consider the problem of answering questions based on a database of simple facts, such as the following:

1) Marcus was a man. 2) Marcus was a Pompeian. 3) Marcus was born in 40 A.D. 4) All means are mortal.

5) All Pompeian’s died when the volcano erupted in 79 A.D. 6) No mortal lives longer than 150yers.

7) It is now 1991 A.D.

Suppose the question is “is Marcus alive”? By representing each of these facts in a formal language, such as predicate logic, and then using formal inference methods, we can easily derive an answer to the question. In fact we can use either of two methods to give answer to the question, which as shown below.

1) Marcus was a man. 2) All men are mortal. 3) Marcus is mortal.

4) Marcus was born in 40 A.D. 5) It is now 1991A.D.

6) Marcus age is 1951 years.

7) No mortal lives longer than 150 years. 8) Marcus id dead.

Or

1) It is now 1991 A.D.

2) All Pompeian’s died in 79 A.D. 3) All Pompeian’s are dead now. 4) Marcus was Pompeian. 5) Marcus is dead.

Since we are interested in the answer of the question it does not matter which path we follow. If we follow one path successfully, to the answer, there is no reason to go back and

(17)

A.Rakesh Babu M.C.A., M.Tech 17

see if some other path might also lead to a solution. Now, consider the traveling salesman problem our goal is to find the shortest route that visits each city exactly once. Suppose the cities to be visited and the distance b/w they are as shown below.

Boston New York Miami Dallas S.F

Boston 250 1450 1700 3000

New York 250 1200 1500 2900

Miami 1450 1200 1600 3300

Dallas 1700 1500 1600 1700

S.F 3000 2900 3300 1700

Fig: An instance of the traveling salesman problem

Once place the sales person could start is Boston. In that case, one path might be followed as shown below.

3000 1700 1500 1200 1450 Total=8850

Fig: One path among the cities

Here the total distance is 8850kms.but this may not be a solution to the problem, may be other paths may give shortest route.

Boston San Francisco Dallas New York Miami Boston

(18)

These toe examples illustrate the difference b/w any path problems and best-path problems. Any path problems can often be solved in a reasonable amount of time by using heuristic techniques that give good solution to explore.

Is the desired solution a path /state?

Different problem domains represent their goal in different ways such as states/paths. Consider water jug problem, whose solution is a desired state and traveling salesman problems solution is the shortest path. At one level the difference can be ignored and all can be formulated as ones in which only a state is required to be reported as a solution. The role of knowledge:

The knowledge require to solve a particular problem is depending upon the problem it self. for example take playing chess, for this we need acknowledge of legal moves and some simple control mechanism that implements an appropriate search procedure on the other side, take a problem of design a robot have the knowledge about the source and destination, car driving rules, operating knowledge of car, weather knowledge and so on. These two problems illustrate the difference b/w problems for which a lot of knowledge is important only to constrain the search for a solution.

Does the problem require interaction with a person?

If the level of interaction b/w the computer and its human users is problem-in-solution-out then we can program computers to solve problems into the ways that majority of people additional input and additional reassurance then we need to go for progress that interacts with people.

When computers move into the areas of human lives like medical diagnosis people will not blindly accept the systems solution. They need to interact with it. This we can distinguish two kinds of problems.

1) Solitary: Here computer is given a problem description and it produces the answer with out any intermediate interaction.

2) Conversational: Here intermediate interaction between the user and a computer is necessary either to provide additional assistance to the computer or to provide additional information to the user.

(19)

A.Rakesh Babu M.C.A., M.Tech 19

Production system characteristics:

Production system provide us with a good set of production rules, by using which we can solve the problems. Two questions may a raise at this point of time.

1) Can production systems, be described by a set of characteristics?

2) Can we draw any relationship between the problem types and the types of production systems suited to solve the problems?

There are four categories of production systems:

1) A monotonic production system is a production system in which the application of a rule never prevents the later application of another rule that could have been applied at the time the first rule is selected.

2) A non monotonic production system is one in which the application of a rule prevents the later application of another rule that would have been applied at the time the first rule was selected.

3) A partially commutative production system is a production system with the property that if the application of a particular sequence of rules transforms state p into state q. then any permutation of those rules is allowable also transforms state p into state q. 4) A commutative production system is production system that is both monotonic and

partially commutative.

Ex:

Monotonic Non monotonic

Partially Commutative

Theorem proving Robot navigation

Commutative Production system/

Non partially Commutative

Chemical analysis Bridge

(20)

CHAPTER - 3

HEURISTIC SEARCH TECHNIQUES

Generate and Test:-

The Generate and test strategy is the simplest of all approaches. Algorithm:-

i. Generate a possible solution.

ii. Text to see if this is actually a solution by comparing with goal. iii. If solution has been found quit otherwise return to step1.

The Generate and text algorithm is a DFS procedure since complete solution must be generated before they can be tested. In this form it is also known as British museum algorithm a reference to method for finding an object in British museum by wandering randomly.

HILL CLIMBING:-

Hill Climbing is a variant of generate and test in which feedback from the test procedure is used to help the generator decide, which direction to move in the search space. Hill Climbing is often used when a good Heuristic Function is available for evaluating states but when no other useful knowledge is available.

For example, suppose you are in an unfamiliar city without a map and you want to get down town you simply aim for the tall buildings. The Heuristic Function is just distance between the current locations of the tall buildings. Absolute solutions exist whenever it is possible to recognize a goal state by just examining it.

Simple Hill Climbing:-

Algorithm:-

i. Evaluate the initial state. If it is also a goal state, then return it and quit. Otherwise continue with the initial state as the current state.

ii. Loop until a solution is found (or) until there are no new operators left to be applied in the current state.

a) Select an operator that has not yet been applied to the current static and apply it to produce a new state.

(21)

A.Rakesh Babu M.C.A., M.Tech 21 b) Evaluate the new state

 If it is a goal state, then return it and quit

 If it is not a goal state but better than the current state, then make it the current state.

 If it is not better than the current state, then continue in the loop.

Steepest-Ascent Hill Climbing:-

Algorithm:-

i. Evaluate the initial state. If it is also goal state, then return it and quit otherwise continue with the initial state as the current state.

ii. Loop until a solution is found(or) until a complete iteration produces no change to current state

a) Let succ be a state such that any possible successor of the current state will be better than succ.

b) For each operator that applies to the current state do: o Apply the operator and generate a new state.

o Evaluate the new state. If it is a goal state, then return it and & quit. If not, compare it to succ. If it is better than set succ to this state. If it is not better leave succ alone.

o If the succ is better than current state, then set current state to succ. Both basic and steepest-ascent Hill Climbing fail to find a solution.

 Local maximum is a state that is better that all its neighbors but is not better than some other states further away.

A A A A 4 5 2 3

(22)

EX:-

 Plateau is a flat area of the search space in which a whole set of neighboring states has the same value.

Ex:-

 Ridge is a special kind of local maximum. It is an area of the search space that is higher than the surrounding areas & itself has a slope.

Ex:-

It means better but having slope.

There are some ways of dealing with these problems

i. Back track to some earlier node and try going to different direction.

ii. Make a big jump in some direction to try. To get a new section of the search space.

iii. Apply two (or) more rules before doing the test suppose we use the following heuristic function operators:

 Pick up one put it on the table  Pick up one it on the other

5

8 2 6

6 5

(23)

A.Rakesh Babu M.C.A., M.Tech 23

Simulated annealing:-

Simulated annealing is a variation of hill climbing and we describe it valley descending. Here we use the term objective function which aims at minimizing the value simulated annealing is patterned after the physical process of annealing in which physical substances such as metals are melted and then gradually cooled until some solid state is reached. The goal is to produce a minimal energy final state.

There is some portability that a transition to a higher state will occur the probability is given by

P=e-∆E/KT

E = Positive change in the energy level. T= temperature

K=constant

The rate at which the system is cooled is called the “Annealing schedule”. Algorithm:-

i. Evaluate the initial state. If it is a goal state, then return it and quit. Otherwise continue with the initial state as the current state.

ii. Initialize BEST-SO-FAR to the current state. iii. Initialize T according to the annealing schedule.

iv. Loop until a solution is found or until no new operators are left to be applied.

a. Select an operator that has not yet been applied to the current state and apply it to get a new state.

b. Evaluate this new state, compute

∆E = value of current state – value of new state.

o If the new state is a goal state, then return it & quit

o If it is not a goal state but is better than the current state, then make it the current state. Also set BEST-SO-FAR to this new state.

o If the new state is not better than the current state, then make it the current state with probability P`

o Revise T as necessary v. return BEST-SO-FAR as the answer:

Here we need to do enough exploration of the whole space early so that the final solution is relatively insensitive to the starting state. These lower the chances of getting caught at a local maximum, a plateau or a ridge.

(24)

BEST- FIRST SEARCH: OR GRAPH

Best first search combines the advantage of both depth-first and breadth first search methods. It selects the most promising node at each step by applying an approximate heuristic function the successors of this node are generated using applicable rules if one of them is a solution, we quit if not all these new nodes are added to the nodes. So far generated, and the process continues.

Figure shows the beginning of a Best- First search procedure.

Best-first search tree

To implement such a graph-search procedure, we will need to use two lists of nodes. Open:-

Open is actually a priority queue in which the elements with the highest priority are those with the most promising value of the heuristic function.

Closed:-

Nodes that have been already been examined. We need to keep these nodes in memory if we want to search a graph rather than a tree.

1 2 3 4 7 8 9 5 6 10 11 4 7 6 2 5 7 6

(25)

A.Rakesh Babu M.C.A., M.Tech 25

Algorithm: Best-First search:-

1. State with open containing just the initial state

2. Until a goal is found or there are no nodes left on open do: a) Pick the best node on open

b) Generate its successors c) For each success do:

 If it has not been generated before, evaluate it add it to OPEN, and record its parent.

 If it has been generated before, change the parent if this new path is better than the previous one.

A* ALGORITHM:-

The A* provides general guidelines with which to estimate goal distances for the search graphs. The A* algorithm generates all successor nodes and computes an estimate of the distance from the start node to the goal through each of the successors. It chooses the successor with the shortest estimated distances for further expansion. The successors or this node are then generated, their distances estimated and this process continues until a goal is found or the search ends in a failure. The form of heuristic function for A* is

F*(n)-g*(n) +h*(n)

Where g*(n) =h*(n) =estimates of the cost (or) distances from the start node to node n and the distances from node n a goal node

Algorithm:-

1. Set SUCCESSOR to point back to BESTNODE.(Back links will help to recover the path).

2. Compute g(SUCCESSOR) = g( BESTNODE) cost of getting from BESTNODE to SUCCESSOR.

3. If SUCCESSOR is same as any node to OPEN, call that node OLD and add OLD to BESTNODE’S SUCCESSORS. Check g (OLD) AND g(SUCCESSOR).If g(SUCCESSOR) is cheaper then rest OLD’S parent link to point to BESTNODE. Update g (OLD) and f’ (OLD).

4. If SUCCESSOR was not on OPEN, see if it is on CLOSED. If so call the node CLOSED OLD, and better as earlier and set the parent link and g and f’ values approximately.

5. If SUCCESSOR was not already on earlier OPEN or CLOSED, then put it on OPEN and add it to the list of BESTNODE’S successors.

(26)

PROBLEM REDUCTION:

Problem reduction is a basic problem solving technique of AI. It involves reducing a problem to a set of easier sub problems whose solutions, if found, can be combined to form a solution, to the hard problem, the procedure is as follows.

1) If the given problem is a primitive sub problem return the solution to it.

2) Otherwise, try breaking the given problem into sets of simpler sub problems, and call the program recursively to try to solve the sub-problems.

3) If a set of sub problems is found such that all the sub problems. Can be solved, combine the sub problem solutions in an appropriate way to form the solution to the current problem.

The given problem is reduced to a set of simpler sub problems, the solution of which will allow the original problem to be solved.

This reduction applied recursively until permissive sub problems which are immediately solvable are reached. The resulting is called an AND/OR graph.

AND node:-

All sub problems must be solved in order to solve the main problem. An arc is drawn across branches of an and node

OR node:-

Solution of any sub-problem will solve the main problem. A state space search graph consists entirely of OR nodes.

(27)

A.Rakesh Babu M.C.A., M.Tech 27 AND / OR Graph Example:

Solution to an AND/OR Graph:-

1) A successful terminal node is a solved node

2) If a non terminal OR node has any solved successors, then it is a solved node. 3) If all of the successors of a non terminal AND node are solved, then it is a

solved node.

4) The problem is solved if the start node is solved.

5) A solution graph is a sub graph of solved nodes that demonstrates that the start node is solved.

Search of an AND/OR Graph:-

An AND|OR graph is searched recursively until the root node is solved, to solve a node, attempt to solve each successor of a non terminal node sequentially.

i. If any successor of an AND node fails, the AND node fails immediately.

Go to Hyderabad Airport Fly to New Delhi Go from New Delhi Airport to JNU

Take a bus Take a taxi

Call a taxi Get Money

Look UP number Dial Phone Ask for Taxi Drive Drive Take a subway Take a taxi Rent a car Steal a car Go from JNTU, Hyderabad

To JNU, New Delhi

AND

OR

(28)

ii. If any successor of an OR node succeeds, the OR node succeeds immediately. The search time may be improve by ordering consideration of the nodes:

 To solve an AND node try first to solve those successors that are most likely to fail.

 To solve an OR node try first to solve those successors that are most likely to succeed.

AO* ALGORITHM:-

I. Let graph consists only one of the node representing the initial state compute h`(INIT)

II. Until INIT is labeled solved or hi (INIT) and become greater than FUTILITY, repeat the following procedure.

a. Trace the marked arcs from INIT and select an unbounded node NODE. b. Generate the successors of NODE if there are no successors then assign

FUTILITY. As h` (NODE). This means that NODE is not solvable. If there are successors then for each one called successor, that is not also an ancestor of NODE do the following.

 Add successor to graph G.

 If successor is not a terminal node, mark it solved and assign zero to its h value.

 Propagate the newly discovered information up the graph by doing the following. Let S be a set of nodes that have been marked SOLVED. Initialize S to NODE. Until S is empty repeat the following procedure.

a) Select a node from S call if CURRENT and remove it from S. b) Compute h` of each of arcs emerging from CURRENT, assign

minimum h` to CURRENT.

c) Mark the minimum cost path a S the best out of CURRENT. CONSTRAINT SATISFACTION:-

Many problems in AI can be considered as problems of constraint satisfaction, in which the goal satisfies a given set of constraint satisfaction problems can be solved by using any of the search strategies.

Algorithm:-

1. Propagate available constraints. To do this, first see OPEN to the set of all objects that must have values assigned to then in a complete solution. Then do until an inconsistency is detected or until OPEN is empty.

(29)

A.Rakesh Babu M.C.A., M.Tech 29

a) Select an object OB from OPEN. String then as possible the set of constraints that apply to OB.

b) If this set is different from the set that was assigned. The last time OB was examined or if this is the first time OB has been examined, then adds to OPEN all objects that share any constraints with OB.

c) Remove OB from OPEN.

2) If the union of the constraints discovered above defines a solution, they quit and report the solution.

3) If the union of the constraints discovered above defines a contradiction, they return failure.

4) If the union of the above occurs, there it is necessary to make a guess at something in order to proceed. To do this, loop until a solution is found or all possible solutions have been eliminated.

a. Select an object whose value is not yet determined and select a way of strengthening the constraints on that object.

b. Recursively invoke constraints satisfaction with the current set of constraints augmented by the strengthening constraint just selected.

Consider The Crypt Arithmetic Problem:

Problem:

SEND +MORE

(30)

Constraints:

 No two letters have the same value.

 The sum of the digits must be as shown in the problem.  Any of search technique may be used.

 Only single digit number can assign to a letter (0-9). Initial state:

M =? O =? R=? E=? S=? N=? D=? Y=? C1=? C2=? C1, C2, C3 stands for the carry variables respectively.

Goal State:

The digits to the letters must be assigned in such a manner so that the sum is satisfied. Solution Process:

 Initially, rules for propagating constraints generate the following additional constraints.

 M=1, since two single digit numbers plus a carry cannot total more than 19.  S=8 or 9.Since S+M+C3>9 and M=1, S+1+C3 >9, S+C3>8 and C3 is at most 1.  O=0, since S+M (1) +C3 (<=1) must be at least 10 to generate a carry and it can be

at most 11.But M is already 1, so O must be 0.

 N=E or E+1, depending on the value of C2.But N cannot have the same as E. So N=E+1 and C2 is 1.

 In order for C2 to be 1, the sum of N+R+C1 must be greater than 9, So N+R must be greater than 8.

(31)

A.Rakesh Babu M.C.A., M.Tech 31

Suppose E is assigned to the value 2.now in the next cycle the constraint propagator observes that.

 N=3 since N=E+1.

 R=8 or 9, since R+N (3) +C1 (1 or 0) =2 or12. But N is already 3; the sum of these non negative numbers cannot be less than 3. Thus R+3+ (0 or 1) =12 and R=8 or 9.  2+D=Y or 2+D=10+Y from the sum in the right most column.

Like this, we continue for further cycles we will get the solutions. Finally the values can be assigned to the letters are as follows in the solutions state.

M =1 O = 0 R=8 E=5 S=9 N=6 D=7 Y=2 9567 +1085 --- 10652. MEANS-ENDS ANALYSIS

For solving any problem we can approach two methods. One is forward searching (Initial state- Goal state.) and second one is backward searching (Goal state to initial State).But sometimes we need combination of these two techniques. It first solves the major parts of a problem and then solves the small problems. Such type of technique is known as MEANS-ENDS ANALYSIS.

The MEANS-ENDS ANALYSIS process is depending upon the direction of differences between the current state and the goal state. In backward chaining the operator are selected and then sub goals are setup to establish the preconditions of operators is called operator subgoaling. The main aim of means-ends analysis is apply the operator’s recursively, which will reduce the difference between current states to goal state.

Algorithm:

MEANS-ENDS ANALYSIS (CURRENT, GOAL)

1. Compare CURRENT to GOAL. If there is no difference between them then return. 2. Otherwise, select the most important difference and reduce it by doing the following

until success or failure is signaled.

a) Select an untried operator O that is applicable to the current difference. If there are no operators then single failure.

(32)

b) Select an operator O that is applicable to the current difference. if there are no operators O to current. Generate two description O-START, a state in while O’s preconditions are satisfied and RESULT that results when O is applied to O-START.

c) If (FIRST-PART ← MEA (CURRENT, O-START)) and (LAST-PART← MEA (O-RESULT, GOAL)) are successful, then signal success and return the result of concatenating FIRST-PART, O, and LAST-PART.

EXAMPLE:

Consider that there is a robot, which can walk, push objects etc... All the operations can be performed by the robot are given as follows.

OPERATOR PRECONDITIONS RESULTS PUSH (obj.loc) at (robot, obj) ^large (obj) ^ at (obj, loc) ^ Clear (obj) ^arm empty at (robot, loc) CARRY (obj, loc) at (robot, obj) ^ at (obj, loc) ^ Small (obj) at (robot, loc) WALK (loc) none at (robot, loc) PICKUP (obj) at (robot, obj) holding (obj) PUTDOWN (obj) holding (obj) ~holding (obj) PLACE (obj1, obj2) at (robot, obj2) ^ on (obj1, obj2) Holding (obj1)

(33)

A.Rakesh Babu M.C.A., M.Tech 33

Suppose that a problem of moving a desk with two things on it from one place to another place is given to the robot. In order to move the desk the robot can use either the PUSH operation or the CARRY operation. In the CARRY operation the preconditions we have objects that should be small. We need to remove two things on the desk. So first robot walk to desk, then remove the two things, then PUSH the desk to the location we want and then place two things back on the desk.

Initially, we use the WALK operator for it to move to the desk. Then we use PICKUP & PUTDOWN to remove the two things on the desk, then PUSH operator followed by WALK in order to go back to the two things, now use PICKUP and CARRY to carry the things to the desk and use PLACE operator to place it on the table. The progress of MEANS-ENDS ANALYSIS is as follows.

WALK PICKUP PUTDOWN PICKUP PUTDOWN PUSH WALK PICKUP

(34)

CHAPTER - 4

KNOWLEDGE REPRESENTATION ISSUES

REPRESENTATION AND MAPPING:

To solve complex problems in A.I, we needs i. Large amount of knowledge is required.

ii. Mechanism for manipulating the knowledge is found a solution to the problem. There are many ways of representing of knowledge, in any representation there are two different kinds of entities:

a) Facts: truths in some relevant world. b) Representation of facts in some logic To structure the above two entities has two levels.

 The knowledge level, at which facts are described.

 The symbol level, at which representation of objects in terms of symbols. The mapping between facts representation are shown in the below figure. The mappings that are having the links in the program are called as representation mappings. *

Reasoning programs

* English understanding English generation

Fig. mapping b/w facts and representation In the above figure there are two representations.

i. Forward: - The forward representation explains logic facts to logic.

ii. Backward: - The backward representation explains logic to facts.

Facts Internal Representation

English representation

(35)

A.Rakesh Babu M.C.A., M.Tech 35

Apart from these representations English representation is also required to understand easily.

Example: - consider the English sentence. Spot is a dog.

The fact is represented by English sentence can also be represented in logic as Dog (Spot).

Suppose consider another fact as All dogs have tails. X: dog(x)  has tail(x).

From above two facts which are represented in logic. We can write as Has tail (spot).

Using backward mapping we could generate the English sentence. Spot has tail.

The above explanation is clearer with following diagram.

Desired real reasoning --

Forward Backward

* Represent Represent * Mapping Mapping

Operation of program

Fig - Representation of facts

Initial facts Initial facts Internal representation of initial facts Internal representation of final facts

(36)

In the figure there is a dotted line originating from initial facts to final facts. This is an abstraction. In order to get final facts firstly, the initial facts are to be represented in some logic done on this logic. And some reasoning has to be done on this logic. That gives final fact in logic. Now using backward representation we convert the final facts, which are in logic in the understandable way.

APPROACHES TO KNOWLEDGE REPRESENTATION:

A good system for the representation of knowledge in a particular domain it should contain following properties.

i. Representational Adequacy: - The ability of representation all kinds of knowledge that are needed in that domain.

ii. Inferential Adequacy: - The ability to manipulated the representational structures in such a way we can derive new structure from old.

iii. Inferential Efficiency: - The ability to add a new info the database to work in best way.

iv. Acquisition Efficiency: - The ability acquires new information easily.

Knowledge Representation Mechanism:

Simple Relational Knowledge:

The simple way to represent the facts is as a set of relations as we do in the database.

Fig: Simple Relational Knowledge:

Representing the facts in this way is simple but it provides weak inference capability because even if cannot answer a simple questions like “Who is a heaviest player?” In order get the answer for this question we need to add some another procedure.

Player Height Weight Bats-Throws Hank Aaron 6.0" 180 right-right

Willie Mays 5.10" 170 right-right Babe Ruth 6.2" 215 left-left Ted Williams 6.3" 205 left-right

(37)

A.Rakesh Babu M.C.A., M.Tech 37

Inheritable Knowledge:-

It is not possible in referential representation to represent objects, attributes and their values. But inheritable knowledge representation allows this type of representation.

The following figure about baseball domain. Handed Height Height Equal to bats Handed batting-avg Isa Isa Bat-avg Instance Instance Team Team

Fig: Inheritable knowledge.  Lines represent attributes

 Boxed nodes represent objects and values.

Person Right Adult-Male 5-10 Base-ball player 6-1 252 .106 Pitcher Fielder Chicago cubs Three-finger-brown Pee-wee-Reese Brooklyn-dodgers

(38)

The structure shown in figure is called slot-and-filter structures. It may also call as “semantic network” or “collection of frames”. Two important attributes that we use in the figure are

i. Isa: - used to show “class inclusion”, which means that which class is derived from which class.

ii. Instance: - used to show “class membership”. That can be used to create an object to a particular class. The following are the attributes for a base-ball player.

Isa: Adult male

Instance: (Equal, Handed) Height: 6-1”

Batting-avgas: 252. Algorithm:

To retrieve value ‘V’ for instance A of an instance object ‘O’ 1) Find ‘O’ in knowledge base.

2) If there is a value for the attribute A, report that value.

3) Otherwise, see if there is a value for the attribute instance. If not, then fail

4) Otherwise, move to the node corresponding to that value and look for a value for the attribute A. if one is found, report it.

5) Otherwise, do until there is no value for the “Is a” attribute or until an answer is found.

a) Get the value “Isa” attribute and move to the node.

b) See if there is no value for the attribute A. if there is a report.

If we apply this procedure to the base-ball example knowledge base to derive answer to the following queries:

Team (pee-wee-Reese) = Brooklyn dodgers

This attribute value is directly obtained from the attribute team. This attribute has a value stored explicit in the knowledge base.

Team (pee-finger-brown) = .106

Because there is no value for batting average stored explicitly for three-finger-brown. We have to follow the attribute instance to obtain the value of that attribute.

(39)

A.Rakesh Babu M.C.A., M.Tech 39

Height (pee-wee-Reese) = 6-1

Because there is no explicit value for height we have to follow the value. So we follow attribute ‘is a’ to obtained the value

Bats (three-finger-brown) =right

Because there is no value for data stores explicitly for the three-finger-brown we have to follow the attribute instance to obtained the value of that attribute and there is ‘Is a’ to obtained value. This algorithm is so simple and we concentrate on only default values. Inferential Knowledge:-

Property of inheritance is a powerful from of inference but it is not only the useful from some times the traditional logic like predicate logic is also used to derive new facts from old facts.

Example: x, y batter(x) ^ batted (x, y) ^infield-fly (y)out(x)

Procedural knowledge:-

We can represent the knowledge in a procedural way also. Production rules are the best techniques to represent the knowledge in a procedural ways.

Example: Water jug problem If x < 4 then fill x. If x < 3 then fill y.

ISSUES IN THE KNOWLEDGE REPRESENTATION:

To represent varies kinds of real –world knowledge. We need to discuss several issues. They are as follows.

1) Important attributes.

2) Relationship among attributes.

3) Choosing the granularity of representation. 4) Representing set of objects.

5) Finding the right structure as needed. Important attributes:

Isa and instance attributes are important because they are present in almost every problem domain. These attributes are important because they support property inheritance.

(40)

Relationship among Attributes: The four properties of attributes are:

 Inverse.

 Existence in an Isa hierarchy.

 Techniques for reasoning about values.  Single value attributes.

Inverse: -

We can represent the relationship between entities in two ways.

a) The first is to represent both the relationship in a single representation. Ex: team (pee-wee, Brooklyn dodgers).

b) Here we use attributes that focus on a single entity but use them in a pairs. One is the inverse of the other. For example,

One associated with pee-wee-Reese

Team = Brooklyn-dodgers. One associated with Brooklyn-dodgers

Team-members = pee-wee-Reese As our primitives in a series of situations. Existence in an isa hierarchy:

There are attributes and specification of attributes. For example the attribute height is a specialized of general attribute physical size which is in turn a specialization of physical attribute. This generalization-specialization relationship supports property inheritance.

Techniques for Reasoning About values:

The reasoning system must reason about values that are not given explicitly. Information that helps us in reasoning includes.

a. Information regarding a type of value

Example: Length must be a number.

(41)

A.Rakesh Babu M.C.A., M.Tech 41

Example: Age of a person cannot be greater than the age of the person’s parent.

c. Rule for computing the value whenever it is required. They cannot be backward rules or they can also be forward rules.

Single value attributes:

A specific attribute may sometime take unique value. For example, a base ball player can be in only one team at one time. Similarly another example, a person can have only one height at a given time.

Choosing the Granularity of Representation:

We can break the details into lower level primitives. For example, john spotted sue can be represented as

Spotted ((john)) object (sue) this may give answer to the question. Who spotted sue?

But it cannot be answer: Did john see sue? The obvious answer that may give is ‘yes’ But for A.I to reason it out we need to add fact.

Spotted (x, y)  saw (x, y) Advantages:

The rules that are used to derive inferences from that knowledge must be written only in the form of primitives rather than in the form of many other ways.

Disadvantages:

 Simple high level facts may requires a lot of storage when broken down into low level primitives.

Example: john punched Mary and Mary punched john.

 Substantial work must be done to reduce the knowledge into primitive’s form, if knowledge I in high level form.

 In many domains, it is not clear what the low level primitives should be

(42)

Representing Sets of Objects:-

We need to represent sets of object because there may be some properties which are true of sets but are not true of individual members and also to see that if a property is true of all elements of a set, then it is more efficient to associate it once with the set rather than to associate it explicitly with every element of set.

There are two ways to define a set and its elements.

Extensional definition: - This definition deals with listing the members.

Intentional definition: - It provides a rule such that, when a particular object is evaluated, returns true or false depending on weather the object s belong to the set or not.

Ex: an extensional definition of the set of our sun’s planets on which people live is [earth] an intentional description is given as

{X: sun-planet(x) ^ human-inhabited (x)}

An extensional definition and intentional definition may not correspond one to one with each other. In the above example the extensionally defined set {earth} may have any intentional definitions.

The advantages that an intentional definition has over extensional definition are…. a. Intentional representations’, can be describe infinite sets and sets not all of

whose elements are explicitly know. Ex: Sets of prime numbers or kings of England.

Intentional definition allows us to depend on parameters that can be change with time or location.

Ex: “The president of U.S used to be pemcrot”.

Finding the right structures as needed:

In order to access the right structure for describing a situation, we need to solve the following problems:

i. How to perform an initial selection of the most current structure? ii. How to fill in the details?

iii. If the one chosen doesn’t turn out to be appropriate, then how do we go for a better one?

iv. What to do if none of the structures that are available is appropriate? v. When we can go for a new structure?

(43)

A.Rakesh Babu M.C.A., M.Tech 43

In order to solve the problems given above, there are two methods.  Selecting an initial structure:

There are two important structures for selection of an initial structure. a. Index structure directly by specific English words.

Ex: john flew to New York.

b. Consider a major concept as a pointer to all of the structure

Ex: the concept steak might point to two scripts, one for restaurant and other for super script.

c. Locate one major clue and use that to select an initial structure.  Revising the choice when necessary:-

Once we find a structure and if it doesn’t seem to be appropriate then we would opt another choice. The different ways in which this can be done are:

 Choose the best one.

 Refer to specify links between the structures in order to follow new directions to explore.

FRAME PROBLEM:-

Frame problem is a problem of representing the facts that change as well as those that do not change. For example, consider a table with a plant on it under a window. Suppose we move it to the centre of the room. Here we must infer that plant is now in the centre but the window id not.

Frame axioms are used to describe all the things that do not change operator is applied in state to go to another state say n+1.

(44)

CHAPTER - 5

USING PREDICATE LOGIC

The logical formalism is used to derive new knowledge from old. i.e., we called mathematical deduction.

For representation of knowledge using logic symbols, such are

“----” Material Implication Not “v” or “^” and For all There exits

REPRESENTING SIMPLE FACTS IN LOGIC:

The use of propositional logic is used to represent the world knowledge. Propositional logic is simple to deal a decision procedure for the facts. We can easily represent real-world facts as logical propositions can be written as well-formed formulas (wff’s) in Propositional logic. Some simple facts in propositional logic as follows.

It is raining RAINING It is sunny. SUNNY It is windy. WINDY

If it is raining, then it is not, sunny. RAINING  SUNNY

(45)

A.Rakesh Babu M.C.A., M.Tech 45

Suppose we want to represent the fact by the classical sense. Socrates is a man.

We could write as

SOCRATESMAN and Plato is a man.

PLATOMAN

The above facts can be represent as much better as Man (Socrates)

Man (Plato)

But that representation is fails to capture the relationship between and individual being a man and that individual being a mortal. We need variables and quantifiers to represent logic. In predicate logic, we can represent real-world facts as statements written as wff’s. So now we explore the use of predicate logic as a way of representing knowledge by a specific example.

Consider the following set of sentence: 1. Marcus was a man

2. Marcus was a Pompeian 3. All Pompeian’s were Romans 4. Caesar was a ruler

5. All Romans were either loyal to Caesar or hated him 6. Everyone is loyal to someone.

7. People only try to assassinate ruler they are not loyal to 8. Marcus tried to assassinate Caesar

The above facts can be represented as a set of wff’s in predicate logic as follows. 1. Man (Marcus)

2. Pompeian (Marcus)

3. x: Pompeian(x)->roman(x) 4. Ruler (Caesar)

5. x: Roman(x) ->loyal to(x, Caesar) V hate(x, Caesar) 6. x: y: loyal to(x, y)

7. x: y: Person(x) ^ruler(y) ^ try assassinate(x, y) 8. Loyal to(x, y)

(46)

Now suppose that we want to use these statements to answer the question. Was Marcus loyal to Caesar?

Now let’s try to produce a formal proof, reasoning backward from the desired goal.

loyalto (Marcus, Caesar) ^ (7)

Person (Marcus) ^ ruler (Caesar) ^ tryassasinate (Marcus, Caeser) ^ (4)

Person (Marcus)

Try assassinating (Marcus, Caesar) ^ (8)

Person (Marcus)

REPRESENTING INSTANCE AND ISA RELATIONSHIP

The specific attributes instance and is a plays an important role in a particularly useful form of reasoning, property inheritance. The predicate instance is a binary one, whose first argument is an object and whose second argument is a class to which the object belongs. But these representations don’t use an explicit is a predicate.

The three ways of representing class membership is as follows. 1. Man (Marcus)

2. Pompeian (Marcus)

3. x: Pompeian(x) ->roman(x) 4. Ruler (Caesar)

5. x: Roman(x) ->loyal to(x, Caesar) V hate(x, Caesar)

1. Instance (Marcus, man) 2. Instance (Marcus, Pompeian)

3. x: instance(x, Pompeian) instance(x, Roman). 4. Instance (Caesar, ruler)

(47)

A.Rakesh Babu M.C.A., M.Tech 47

1. Instance (Marcus, Man) 2. Instance (Marcus, Pompeian) 3. Isa (Pompeian, Roman) 4. Instance (Caesar, ruler)

5. x: instance(x, roman)loyalto(x, Caesar) V hate(x, Caesar).

The class and super class membership are important facts that need to be represented, those membership need not to be represented with predicates instance and Isa.

COMPUTABLE FUNCTIONS AND PREDICATES:

In predicate calculus it is often useful to have computable a functions and computable predicates for this we want to express simple facts. Such as the following greater than and less than relationships:

gt(1,0) lt(0,1) gt(2,1) lt(1,2) gt(3,2) lt(2,3) | |

| | . .

For example the simple fact (2+3)>1 might be represented as gt(2+3,1).to calculate the truth of gt(2+3,1) the value of the plus function is evaluated first and then the arguments 2+3(=5) and 1 are sent to the computable predicate gt.The use of computable functions and predicates is illustrated below.

Consider the following set of facts and their representations. 1. Marcus was a man

Man (Marcus) 2. Marcus was a Pompeian

Pompeian (Marcus) 3. Marcus was born in 40 A.D

Born (Marcus, 40 A.D) 4. All men are mortal

(48)

5. All Pompeian’s died when volcano erupted in 79 A.D

Erupted (volcano, 79) ^ x :{ Pompeian(x) died(x, 79)} 6. No mortal lives longer than 150 years

x: t1: t2: mortal(x) ^ born(x, t1) ^ gt (t2-t1, 150) ->dead(x, t2) 7. It is now 1991

Now=1991 8. Alive means not dead

x: t: alive (x, t) ->&dead(x, t) ^ [ dead(x, t) ->alive(x,t)] 9. If someone dies then he is died at all later times.

x: t1: t2:died(x,t1) ^gt(t2,t1)->dead(x,t2) The above predicates can be represented as set of facts as follows.

1. Man (Marcus) 2. Pompeian (Marcus) 3. Born (marcus,40) 4. x: men(x)mortal(x) 5. x: Pompeian(x)died(x,79) 6. Erupted (volcano, 79) 7. x: t1: t2: mortal(x)^born(x, t1)^ gt(t2-t1,150)died(x,t2) 8. Now=1991

9. x: t:[alive(x, t) dead(x, t)]^[ dead(x,t)alive(x, t)] 10. x: t1: t2:died(x,t1)^ gt(t2,t1)dead(x,t2)

References

Related documents

Longer than broad (CI 75), posterior head mar- gin shallowly concave; mandibles elongate, linear, produced into narrow projecting blades, longer than broad (MI 44), preapical

Using a likert scale reading interest survey, a released SOL reading comprehension test, and teacher observations data were collected to determine if independent choice in a

A master-slave flip-flop consists of two flip-flops where one circuit serves as a master and the other as a slave. 107.Define rise time. 108.Define fall time. 109.Define skew

Thank you for your interest in Hillsborough Community College Health Sciences Programs. Acceptance to the Health Sciences Programs is selective, a complete

Application in Capacity Building in Higher Education and Jean Monnet activities. Applications must be submitted using

In addressing an identified local need, national calls for pain management education and recommendations for authentic methods of IPL (Gordan et al., 2018) we aimed to

ISNIC is responsible for implementing changes in conformance with these rules when requested to do so by the domain's registrant, the administrative contact for a domain, the Board

Our findings suggest that S. mansoni infection among pre-school children is associated with a reduced antibody response to catch-up measles immunisation, and that praziquantel