Local Search, CSP, Game Search - PowerPoint PPT Presentation

1 / 33
About This Presentation
Title:

Local Search, CSP, Game Search

Description:

State: a consistent (regal) assignment. Goal: complete assignment that satisfies all constraints ... States: a regal assignment. Successor function: assigning a ... – PowerPoint PPT presentation

Number of Views:119
Avg rating:3.0/5.0
Slides: 34
Provided by: aiDg
Category:
Tags: csp | game | local | regal | search

less

Transcript and Presenter's Notes

Title: Local Search, CSP, Game Search


1
Local Search, CSP, Game Search
  • Artificial Intelligence A Modern Approach
  • (Chapter 4.3, 5, 6)
  • Juntae Kim
  • Department of Computer Engineering
  • Dongguk University

2
Local Search
  • For problems such that
  • Goal state itself is a solution (Exgt optimization
    problem)
  • Path is irrelevant
  • Keep single current state, and try to improve
    it
  • (iterative improvement)
  • Hill Climbing
  • Record only current state
  • Continuously select best node among the children

3
Local Search
  • Examples
  • Minimize Y f(X1, X2, Xn) (exgt y x12x22)
  • From (X1, X2) move to (X1 1, X2), (X1, X21),
    (X1-1, X2), (X1, X2-1)
  • TSP
  • From any complete tour, perform pairwise exchange
  • 8-queens
  • From any configuration, move 1

4
Hill Climbing
  • function Hill-Climbing ( )
  • current Make-Node(Initial-State)
  • loop do
  • next highest value successor of current
  • if (Valuenext ? Valuecurrent)) then
    return State(current)
  • current neighbor

5
Problems of Hill Climbing
  • Problem
  • Local maxima ? random-restart

6
Simulated Annealing
  • Idea
  • Allow to take some down hill steps (bad moves) to
    escape from local maxima
  • But gradually decrease their size and frequency
  • Algorithm
  • 1. Select random child as next state
  • 2. If next is better than current, move to next
  • 3. Else move to next with probability e D E/T
  • D E value(current) - value(next)
  • T a parameter that decreases as time goes

7
Simulated Annealing
  • function Simulated-Annealing ( )
  • current Make-Node(Initial-State)
  • for t 1 to ? do
  • Decrease(T)
  • if (T 0) then return State(current)
  • next a random successor of current
  • ?E Valuenext - Valuecurrent
  • if (?E gt 0) then current next
  • else current next with probability e DE
    / T

8
Simulated Annealing
  • Concept
  • If T decrease sufficiently slowly, the algorithm
    will find a global optimum

9
Genetic Algorithms
  • Evolutionary programming
  • Finding best solutions by evolutionary process
  • For an optimization problem with huge solution
    space
  • Definitions
  • Individual(chromosome) - one solution
  • Gene - Each element in individual
  • Population - set of individual

10
Genetic Algorithms
  • Fitness function
  • f(i) evaluation of individual solution (how good
    is it?)
  • Selection
  • Select part of the population for reproduction
  • With probability P(i) f(i) / ?f(i)
  • Reproduction
  • Cross-over
  • Mutation

11
Genetic Algorithms
  • function Genetic-Algorithm ( )
  • population Generate initial population (size
    N)
  • repeat
  • new-population empty set
  • evaluate population by fitness function
  • for i 1 to N
  • x, y Random-Selection(population)
  • child Reproduce(x, y)
  • child Mutate(child) with small
    probability
  • add child to new-population
  • until some individual is fit enough, or enough
    time has elapsed
  • return best individual

12
GA Example
13
GA CNF-Satisfaction
  • Find T,F assignment that makes the expression T
  • NP-complete
  • Genetic algorithm
  • Representation of individual - 6 bit string
  • aF, bT, cF, dF, eT, fT ? 010011
  • Fitness function true clauses
  • f(010011) 3 (0 ? f(i) ? 5)
  • Crossover - divides at random point
  • Mutation - flip one bit

(a ? c) ? (a ? c ? e) ? (b ? c ? d ? e) ? (a
? b ? c) ? (e ? f)
14
GA Timetabling
  • Find the best timetable
  • Genetic algorithm
  • Representation
  • 2 dimensional matrix of classes (Time vs. Room)
  • Fitness function Score of the timetable
  • Weighted sum of penalties f(i) -?(WjPj)
  • Crossover - between independent room sets
  • Mutation - change the position of a class

15
Game Search
  • Two person game
  • Introduces uncertainty
  • Search space
  • Search space of interesting game is too large
  • Chess 35100
  • Baduk 361! gt 180180 gt 10360
  • Goal
  • Finding good decision (not optimal) in a given
    time

16
Example - TicTacToe
17
Minimax Search
  • In two persons game
  • MAX - my move
  • ? value of node max of children node
  • MIN - opponents move
  • ? value of node min of children node

18
Minimax Search
  • Algorithm
  • 1. Generate game tree
  • 2. Evaluate leaf nodes
  • 3. Run depth-limited DFS
  • - Compute values of nodes by minimax
    computation
  • 4. Choose node with highest value
  • Evaluation functions
  • Determine the quality of program
  • Weighted linear function
  • f w1f1 w2f2 wnfn
  • fk features of the particular position (Exgt each
    piece)

19
Alpha-Beta Pruning
  • Use current upper/lower bound to reduce search
  • a - current max value of MAX node (always
    increase)
  • b - current min value of MIN node (always
    decrease)
  • Prune a subtree if
  • b of MIN node lt a of parent MAX
  • a of MAX node lt b of parent MIN

20
Complexity of Minimax
  • Time complexity O(bm)
  • Space complexity O(bm)
  • Time complexity with a-b pruning O(bm/2)
  • Double the search depth in given time
  • Chess
  • b ? 35, m ? 100 ? full search is impossible
  • If time limit is 100 secs, explore104 nodes/sec
  • ? search 106 nodes per move ? 354
  • ? search depth 4 ahead using simple minimax
  • ? search depth 8 ahead using a-b pruning

21
Expected Minimax
  • When chance node (probability) is introduced
  • Exgt Backgammon
  • Introduce chance node
  • Value of chance node expected value computed
    according to probability
  • Evaluation function value affects the decision
  • Order-preserving is not sufficient

22
Expected Minimax
23
Constraint Satisfaction Problems
  • CSP
  • Variables X1, X2, , Xn ? Values Di (domain)
  • Constraints C1, C2, , Cm
  • State a consistent (regal) assignment
  • Goal complete assignment that satisfies all
    constraints
  • General purpose heuristics can be defined
  • Example
  • Timetabling
  • Airline scheduling
  • VLSI layout
  • Floor planning

24
Example Graph Coloring
  • Variables WA, NT, SA, Q, NSW, V, SA, T
  • Domain red, green, blue
  • Adjacent ? different (WA ? NT, )

25
Example Graph Coloring
  • Solution (complete assignment that satisfies all
    constraints)

26
Constraint Graph
  • Node variables
  • Arc constraints

27
CSP as a Standard Search
  • State space
  • States a regal assignment
  • Successor function assigning a new value
  • Initial state empty assignment
  • Goal test complete assignment
  • Properties
  • Every solution appears at depth n
  • (n of variables)
  • Possible complete assignment
  • dn (d of values)
  • DFS can be used

28
Heuristics for CSP
  • MRV (Minimum remaining value) heuristic
  • Choose the variable with the fewest regal values

2
3
2
2
1
3
3
Early pruning of the search tree (pick a variable
that is most likely to cause a failure)
29
Heuristics for CSP
  • Degree heuristic
  • When MRV are same, choose the variable with
  • the most constraint on other unassigned variables

3
2
1
3
2
0
1
2
5
3
2
1
2
MRV 3
MRV 1
MRV 2
Reduce branching factor of the search
tree (reduce the number of future choice)
30
Heuristics for CSP
  • Least constraining value heuristic
  • Choose the value that rules out fewest choices
    for the neighboring variables

1
0
31
Constraint Propagation
  • Forward checking
  • Keep track of remaining regal values
  • Terminate search when any variable has no regal
    values

32
Constraint Propagation
  • Arc consistency
  • Provides early detection for failure
  • X ? Y is consistent if
  • for every x ? X, there is some allowed y ? Y

33
Constraint Propagation
  • Propagation
  • If X looses a value due to the consistency,
  • neighbors of X need to be rechecked
Write a Comment
User Comments (0)
About PowerShow.com