Docsity

2 PROBLEM STATE SPACE SEARCH & HEURISTIC ..., Schemes and Mind Maps of English

Partial preview of the text

Download 2 PROBLEM STATE SPACE SEARCH & HEURISTIC ... and more Schemes and Mind Maps English in PDF only on Docsity!

CHAPTER – 2

PROBLEM STATE SPACE SEARCH & HEURISTIC

SEARCH TECHNIQUES

Subject : AI (^) Asst. Prof. Twinkal PanchalPrepared By:

Code : 2180703 (CSE Department, ACET)

State Spaces

  • One general formulation of intelligent action is in terms of state space.
  • A state contains all of the information necessary to predict the effects of an action and to determine if it is a goal state.

 The agent has perfect knowledge of the state space and can observe what state it is in

 The agent has a set of actions that have known deterministic effects;

 Some states are goal states, the agent wants to reach one of these goal states, and the agent can recognize a goal state;

 A solution is a sequence of actions that will get the agent from its current state to a goal state.

Water jug problem

  • one having the capacity to hold 3 gallons of water and the other has the capacity to hold 4 gallons of water. There is no other measuring equipment available and the jugs also do not have any kind of marking on them. So, the agent’s task here is to fill the 4-gallon jug with 2 gallons of water by using only these two jugs and no other material. Initially, both our jugs are empty.

Production rules for solving the water jug problem

  • Here, let x denote the 4-gallon jug and y denote the 3-gallon jug.

S.No. Initial State Condition Final state Description of action taken

  1. (x,y) If x<4 (4,y) Fill the 4 gallon jug completely
  2. (x,y) if y<3 (x,3) Fill the 3 gallon jug completely
  3. (x,y) If x>0 (x-d,y) Pour some part from the 4 gallonjug
  4. (x,y) If y>0 (x,y-d) Pour some part from the 3 gallon jug
  5. (x,y) If x>0 (0,y) Empty the 4 gallon jug
  6. (x,y) If y>0 (x,0) Empty the 3 gallon jug
  7. (x,y) If (x+y)<7 (4, y-[4-x]) Pour some water from the 3 gallon jug to fill the four gallon jug
  8. (x,y) If (x+y)<7 (x-[3-y],y) Pour some water from the 4 gallon jug to fill the 3 gallon jug.
  9. (x,y) If (x+y)<4 (x+y,0) Pour all water from 3 gallon jug tothe 4 gallon jug
  10. (x,y) if (x+y)<3 (0, x+y) Pour all water from the 4 gallon jugto the 3 gallon jug

8 puzzle Problem

  • Given a 3×3 board with 8 tiles (every tile has one number from 1 to 8) and one empty space. The objective is to place the numbers on tiles to match final configuration using the empty space. We can slide four adjacent (left, right, above and below) tiles into the empty space.

For example,

  1. A control strategy that specifies order in which the rules will be compared to the database of rules and a way of resolving the conflicts that arise when several rules match simultaneously.
  2. A rule applier, which checks the capability of rule by matching the content state with the left hand side of the rule and finds the appropriate rule from database of rules.

Features of Production System

1. Simplicity

  • The structure of each sentence in a production system is unique and uniform as they use “IF-THEN” structure.
  • This structure provides simplicity in knowledge representation. 2. Modularity
  • This means production rule code the knowledge available in discrete pieces. Information can be treated as a collection of independent facts which may be added or deleted from the system with essentially no delete side effects.

Disadvantages

1. Opacity

  • This problem is generated by the combination of production rules. The opacity is generated because of less prioritization of rules. More priority to a rule has the less opacity. 2. Inefficiency
  • During execution of a program several rules may active. A well devised control strategy reduces this problem.
  • As the rules of the production system are large in number and they are hardly written in hierarchical manner, it requires some forms of complex search through all the production rules for each cycle of control program.

3. Absence of learning

  • Rule based production systems do not store the result of the problem for future use.
  • Hence, it does not exhibit any type of learning capabilities. 4. Conflict resolution
  • The rules in a production system should not have any type of conflict operations.
  • When a new rule is added to a database, it should ensure that it does not have any conflicts with the existing rules.

Uninformed Search Algorithms

  • The search algorithms in this section have no additional information on the goal node other than the one provided in the problem definition.
  • The plans to reach the goal state from the start state differ only by the order and/or length of actions. Uninformed search is also called Blind search.
  1. Depth First Search
  2. Breath First Search
  3. Uniform Cost Search

Each of these algorithms will have:

  1. A problem graph, containing the start node S and the goal node G.
  2. A strategy, describing the manner in which the graph will be traversed to get to G.
  3. A fringe, which is a data structure used to store all the possible states (nodes) that you can go from the current states.
  4. A tree, that results while traversing to the goal node.
  5. A solution plan, which the sequence of nodes from S to G.

Solution. The equivalent search tree for the above graph is as follows. As DFS traverses the tree “deepest node first”, it would always pick the deeper branch until it reaches the solution (or it runs out of nodes, and goes to the next branch). The traversal is shown in blue arrows.

Path: S -> A -> B -> C -> G

  • Let = the depth of the search tree

= number of levels of the search tree. = number of nodes in level.

Time complexity

  • Equivalent to the number of nodes traversed in DFS.

Space complexity

  • Equivalent to how large can the fringe get.

Completeness

  • DFS is complete if the search tree is finite, meaning for a given finite search tree, DFS will come up with a solution if it exists.