Presentation is loading. Please wait.

Presentation is loading. Please wait.

Problems, Problem Spaces, and Search. Introduction To build a system to solve a particular problem, we need to do four things: – Define the problem precisely.

Similar presentations

Presentation on theme: "Problems, Problem Spaces, and Search. Introduction To build a system to solve a particular problem, we need to do four things: – Define the problem precisely."— Presentation transcript:

1 Problems, Problem Spaces, and Search

2 Introduction To build a system to solve a particular problem, we need to do four things: – Define the problem precisely – the definition must include precise specifications of what the initial situation(s) will be as what final situations constitute acceptable solutions to the problems. – Analyse the problem – looking at other features that could have an immense impact on the appropriateness of various possible techniques for solving the problem.

3 Introduction – Isolate and represent the task knowledge that is necessary to solve the problem. – Choose the best problem solving technique (s) and apply it (them) to the particular problem

4 Defining the Problem as a State Space Search The focus now is on the first two things. Lets consider an example of problem statement “Play Chess” To build a program that could “Play chess”, we would first have to; – specify the starting position of chess board, – the rules that define the legal moves – the board positions that represent a win for one side or the other – In addition we must make goal of winning the game.

5 Play Chess In “Play Chess” it is fairly easy to provide a formal and complete problem description. The starting position can be described as an 8-by-8 array where each position contains a symbol standing for the appropriate piece in the official chess opening position. Our goal is any board position in which the opponent does not have a legal move and his or her king is under attack.

6 Play Chess The legal moves provides the way of getting from the initial state to a goal state. Find the way to write the rules describing the legal moves in as general a way as possible. – Use convenient notation for describing patterns and substitutions as described in the following slide. – The more succinctly in describing the rules needed, the less work will be done to provide them and the more efficient the program that uses them can be.

7 Play Chess Example of notation (Describing chess move):- – White pawn at Square(file e, rank 2) AND Square(file e, rank 3) is empty AND Square(file e, rank 4) is empty – > move pawn from Square(file e, rank 2) to Square (file e, rank 4)

8 Play Chess Play a chess is a problem of moving around in a state space where each state corresponds to a legal position of the board. We can then play chess by starting at initial state, using a set of rules to move from one state to another state, and attempting to end up in one of a set of final states.

9 State Space The state space representation forms the basis of most of AI methods to be discussed. 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.

10 State of Space Search It permits us to define the process of solving a particular problem as a combination of known techniques and search, the general technique of exploring the space to try to some path from the 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.

11 State of Space Search The first step toward design of a program to solve a problem must be the creation of formal and manipulable description of the problem itself. Then write programs that can themselves produce such formal descriptions from informal ones.

12 State of Space Search To provide a formal description of a problem, we must – Define a state space that contains all the possible configurations of the relevant objects. – Specify one or more states within that space that describe possible situations from which the problem-solving process may start. These states are called initial states.

13 State of Space Search – Specify one or more states that would be acceptable as solutions to the problem. These states are called goals state – Specify a set of rules that describe the actions (operators) available.

14 Production System

15 Production Systems A production system is a model of computation that provides pattern-directed control of a problem – solving process and consists of a set of production rules, a working memory, and a recognize – act control cycle. A production system is defined by: – A set of production rules, each consisting of a left side (a pattern) that determines the applicability of the rule and a right side that describes the operation to be performed if the rule applied.

16 Production Systems – One or more knowledge/databases (Working Memory) that contains whatever information (description) is appropriate for the particular task. This description is a pattern that is matched the condition part of a production to select appropriate problem-solving actions. – The recognise-act cycle. A control strategy that specifies the order in which the rules will be compared to the database and a way of resolving the conflicts that arise when several rules match at once

17 Production Systems – A rule applier All of these systems provide the overall architecture of a production systems and allow the programmer to write rules that define particular problems to be solved.

18 Production Rule One can often represent the expertise that someone uses to do an expert task as rules. A rule means a structure which has an if component and a then component.

19 The Edwin Smith papyrus The Edwin Smith papyrus is a 3700-year-old ancient Egyptian text. It contains medical descriptions of 48 different types of head wound. There is a fixed format for each problem description: Title - symptoms - diagnosis - prognosis - treatment. ABCDEECDBBACDACDBCDECDADCADBADE ECDBBACDACDBCDECDADCADBADCDBBACDA BCDEECDBBACDACDBCDECDAD BBACDACDBCDECDADCADBADEDCDBBA DCDBBADCDBBABCDECDADCADBADEACDA BACDACDBCDECDADBACDACDBCDECDAD

20 The Edwin Smith papyrus There's a fixed style for the parts of each problem description. Thus, the prognosis always reads "It is an injury that I will cure", or "It is an injury that I will combat", or "It is an injury against which I am powerless". An example taken from the Edwin Smith papyrus:

21 The Edwin Smith papyrus Title: – Instructions for treating a fracture of the cheekbone. Symptoms: – If you examine a man with a fracture of the cheekbone, you will find a salient and red fluxion, bordering the wound. Diagnosis and prognosis: – Then you will tell your patient: "A fracture of the cheekbone. It is an injury that I will cure." Treatment: – You shall tend him with fresh meat the first day. The treatment shall last until the fluxion resorbs. – Next you shall treat him with raspberry, honey, and bandages to be renewed each day, until he is cured.

22 Other Examples of Rules if - the leaves are dry, brittle and discoloured – then - the plant has been attacked by red spider mite if - the customer closes the account – then - delete the customer from the database

23 Production Rule The statement, or set of statements, after the word if represents some pattern which you may observe. The statement, or set of statements, after the word then represents some conclusion that you can draw, or some action that you should take. IF some condition(s) exists THEN perform some action(s) – IF-THEN – Test-Action

24 Production System Therefore production system can be described as set of production rules, together with software that can reason with them. Production System are sometimes known as Rule Based Expert System. A rule-based system consists of – a set of IF-THEN rules – a set of facts – an interpreter controlling the application of the rules, given the facts.

25 Rule-based system model Long Term Memory Production rule Short Term Memory Fact Interpreter (Inference engine) Conclusion

26 Terminology Rule Part 1 – Antecedent/Premise/Condition – IF part – Test part Rule Part 2 – Consequent/Conclusion/Action) – THEN part – Action part IF THEN A rule fires when its condition part is satisified and its action part is executed

27 Terminology Rule can have multiple antecedents – Conjunction AND – Disjunction OR – Or a combination of both Consequent can have multiple clauses – IF THEN

28 Terminology In a production system, the rules are stored together, in an area called the rulebase

29 Conditional branching Is a production rule the same as a conditional branching statement? A production rule looks similar to the if (statement to be evaluated) then (action) pattern which is a familiar feature of all conventional programming languages.

30 Conditional branching vs. production rules In a conventional program, – The if...then... structure is an integral part of the code, and represents a point where the execution can branch in one of two (or more) directions. – The paths available are pre-defined In a production system – The if...then... rules are gathered together in a rule base – The controlling part of the system (inference engine) has mechanism for a rule from this knowledge (rule) base which is appropriate to the current circumstances, and then using it.

31 Reasoning with production rules l Architecture of a typical production system: rule memory interpreter working memory observed data fire modifyselect output

32 Reasoning with production rules l Architecture of a typical production system: rule memory interpreter working memory New information fire modify select output

33 Reasoning with production rules l Architecture of a typical production system: rule memory Interpreter executes actions working memory New information fire modify select output

34 Reasoning with production rules l Architecture of a typical production system: rule memory Interpreter executes actions working memory New information fire modifyselect output

35 Architecture of a typical production system Has a working memory. – Holds items of data. Their presence, or their absence, causes the interpreter to trigger certain rules. – e.g. W.M. contains [john, age, 29] & [john, employment, none] The system decides: – Does this match any rules in the rulebase? – If so, choose the rule.

36 Architecture of a typical production system Behaviour of the interpreter: – The system is started by putting a suitable data item into working memory. – Recognise-act cycle: When data in the working memory matches the conditions of one of the rules in the system The rule fires ( brought into action). Which may change the working memory which changes the recognise-act cycle

Download ppt "Problems, Problem Spaces, and Search. Introduction To build a system to solve a particular problem, we need to do four things: – Define the problem precisely."

Similar presentations

Ads by Google