UNIT II-REPRESENTATION OF KNOWLEDGE (9 hours) Game playing - Knowledge representation, Knowledge representation using Predicate logic, Introduction tounit-2 predicate calculus, Resolution, Use of predicate calculus, Knowledge representation using other logic-structured representation of knowledge. Prepared by Vaishnavi Moorthy Asst Prof- Dept of Cse
Game playing
Effectiveness of a search based problem solving program Legal move generator- not promising Plausible move generator-small number of promising moves are generated As the number of legal moves increases, promising heuristic is applied. Incorporating knowledge in both tester and generator, the performance of the overall system can be improved
In the amount of time given- ply in the game playing is limited in a game graph or tree Static evaluation function Eg. Samuels Checkers game Chess game piece advantage by Turing Decidng which series of actions are responsible for particular outcome is Credit assignment problem Eg. A* algorithm- inadequate for chess Minmax procedure- works on both standard problem solving trees and on game tress
Static evaluation function -10 win for the opponent 0 for even match 10 win for us Two ply search
DEPTH = 2 BRANCHING FACTOR= 3 B D = TOTAL NO OF TERMINAL NODES TERMINAL NODE
States where the game has ended are called terminal states. A utility (payoff) function determines the value of terminal states, e.g. win=+10, draw=0, lose=-10. In two-player games, assume one is called MAX (tries to maximize utility) and one is called MIN (tries to minimize utility). In the search tree, first layer is move by MAX, next layer by MIN, and alternate to terminal states. Each layer in the search is called a ply.
Variety of factors affecting the decision
Best Move for Current Position Depth-first and depth-limited search. At the player choice, maximize the static evaluation of the next position. At the opponent choice, minimize the static evaluation of the next position.
Alpha Beta Pruning Alpha = the value of the best choice we ve found so far for MAX (highest) Beta = the value of the best choice we ve found so far for MIN (lowest) When maximizing, cut off values lower than Alpha When minimizing, cut off values greater than Beta USE THRESH- used to compute cutoffs PASS THRESH-passed to next level
Adding Alpha Beta Cutoffs An alpha cutoff
Alpha Beta Cutoffs
Best Move for Current Position
Alpha-Beta Pruning Example
Alpha-Beta Pruning Example
Alpha-Beta Pruning Example
Alpha-Beta Pruning Example
Alpha-Beta Pruning Example
Additional Requirements Waiting for Quiescence Avoids Horizon effect
Secondary Search- combating horizon effect (double check) Using book moves Alternatives to Minimax- predicting weaker move
Iterative deepening Ply searches with branch and bound strategy Depth first iterative deepening
DFID is proportional to the number of nodes in that solution path DFID is slower by a constant factor
References on Specific Games Chess Checkers Go (difficult since average branching factor is very high) Backgammon- Neurogammon- automatic learning Othello Bridge Scrabble Dominoes Go-moku Hearts poker
MIN MAX PROBLEM General method for determining optimal move. Generate complete game tree down to terminal states. = g(f 1,f 2,.f n ) 1 where f- features of game g-function and - static value. The g is reduced to a linear squaring polynomial by multiplying a constant = c 1 f 1,c 2 f 2,.c n f n ) 2 Compute utility of each node bottom up from leaves toward root. At each MAX node, pick the move with maximum utility. At each MIN node, pick the move with minimum utility (assumes opponent always acts correctly to minimize utility). When reach the root, optimal move is determined.
ALGORITHM: function MINIMAX-DECISION(game) returns an operator for each op in OPERATORS[game] do VALUE[op] MINIMAX-VALUE(APPLY(op, game), game) end return the op with the highest VALUE[op] function MINIMAX-VALUE(state, game) returns a utility value if TERMINAL-TEST[game](state) then return UTILITY[game](state) else if MAX is to move in state then return the highest MINIMAX-VALUE of SUCCESSORS(state) else return the lowest MINIMAX-VALUE of SUCCESSORS(state)
Sample Problem 8 7 3 9 9 8 2 4 1 8 8 9 9 9 3 4
Representations and mappings
Sample 2 All dogs have tails Every dog has a tail
Approaches to knowledge representation
Simple Relational Knowledge
Inheritable knowledge
Inferential knowledge
Procedural knowledge
Representation Issues
Important attributes Instance Isa Relationship among attributes Inverses Existence in an isa hierarchy Techniques for reasoning about values Single values attributes
Inverses First approach Second approach taken for semantic net and frame based systems accompanied by knowledge acquisition tool
An isa hierarchy of attributes Attributes like height- physical attributes Generalization-specialization relationships support inheritance Constraints on the values that the attribute can have and mechanisms for computing those values
Techniques for reasoning about values
Single- valued attributes
Choosing the granularity of representation
Mary is Sue s cousin Another representation
Representation of sets of objects Extensional definition- list all members Intentional definition- needed members Evaluate the sentence true or false One extensional can have many intentional definitions
Finding the right structures as needed
Selecting an initial structure Indexing the sentence with significant English words Pointer to all structures- prospective structures On major clue in the problem description Revising the choice when necessary Select the fragments of the current structure- candidate structure- if matches then preserve it If failure- you can consider the related information and make excuses Use stroke lines to specify the direction (new) Isa (upward direction)- no conflict- use structure to provide knowledge representation else new structure