Solving Problems By Searching and Constraint Satisfaction Problem - PowerPoint PPT Presentation

1 / 52
About This Presentation
Title:

Solving Problems By Searching and Constraint Satisfaction Problem

Description:

the basic elements of a problem definition. initial state. operator (or successor function S) ... On holiday in Romania: currently in Arad. Flight leaves ... – PowerPoint PPT presentation

Number of Views:281
Avg rating:3.0/5.0
Slides: 53
Provided by: aiKai
Category:

less

Transcript and Presenter's Notes

Title: Solving Problems By Searching and Constraint Satisfaction Problem


1
Solving Problems By Searching andConstraint
Satisfaction Problem
CS570 Artificial Intelligence
  • 2001. 4. 18.
  • 20015087 ???
  • 20013460 ???

2
Overview
  • Solving Problem by Searching
  • Problem solving agents
  • Problem types
  • Problem formulation
  • Example problems
  • Searching Strategies(Basic search algorithms)
  • Constraint Satisfaction Problem
  • Introduction
  • Solving Techniques
  • Applications

3
Problem-Solving Agents
  • Problem-Solving Agents
  • one kind of goal-based agent
  • finding sequences of actions that lead to
    desirable states.
  • Steps
  • Goal Formulation
  • limiting the objectives
  • Problem Formulation
  • deciding what actions and states to consider
  • Search
  • looking for the possible action sequence
  • Execution

4
Formulating Problem - Example
  • The eight possible states of the simplified
    vacuum world

5
Properties of environment
  • Accessible vs. Inaccessible
  • Deterministic vs. Nonderterministic
  • Episodic vs. Nonepisodic
  • Static vs. Dynamic
  • Discrete vs. Continuaous

6
Knowledge and Problem Types (1)
  • Single-state problem
  • accessible - the agents sensor knows
  • which state it is in.
  • deterministic - the agent knows
  • what each of its actions does
  • Action sequence can be completely planned.
  • example Right, Suck

7
Knowledge and Problem Types (2)
  • Multiple-state problem
  • inaccessible
  • limited access to the world state
  • deterministic
  • The agent must reason about sets of states that
    it mignt get to.
  • Example
  • Right, Suck, Left, Suck

reach a Goal
8
Knowledge and Problem Types (3)
  • Contingency problem
  • inaccessible
  • non-deterministic
  • sensing during the execution phase.
  • most of the real, physical world problems
  • Keep your eyes open while walking!
  • The agent must calculate a whole tree of actions,
    rather than a single action sequence.

9
Knowledge and Problem Types (4)
  • Exploration problem
  • unknown state space (no map, no sensor)
  • The agent must experiment, gradually discovering
    what its actions do and what sorts of states
    exist.

10
Well-defined Problems and Solutions
single-state problem
  • Problem
  • a collection of information that the agent will
    use to decide what to do
  • the basic elements of a problem definition
  • initial state
  • operator (or successor function S)
  • goal test
  • path cost function(g)

path
state space
11
Problem-Solving Agents - Example
  • A simplified road map of Romania

12
Problem-Solving Agents Example
  • Situation
  • On holiday in Romania currently in Arad.
  • Flight leaves tomorrow from Bucharest.
  • Formulate goal
  • be in Bucharest
  • Formulate problem
  • initial state be in Arad
  • state various cities
  • operators driving between cities
  • Find solution
  • sequence of cities, e.g., Arad, Sibiu, Fagaras,
    Bucharest

Abstraction
13
Measuring Problem-Solving Performance
  • Effectiveness of a search
  • Does it find a solution at all?
  • Is it a good solution (one with low path cost)?
  • What is the search cost associated with the time
    and memory required to find a solution?
  • total cost path cost search cost

14
Example Problems
  • Toy Problems
  • concise and exact description
  • abstract version of real problem
  • Real-World Problem
  • no single agreed-upon description

15
The 8-puzzle
  • problem formulation
  • State the location of each of the eight tiles
    in one of the nine squares
  • Operators blank moves left, right, up, or down
  • Goal test state matches the right figure
  • Path cost each step costs 1, that is the length
    of the path

Start state
Goal state
16
The 8-queens problem(1)
  • problem formulation
  • Goal test 8 queens on board, none attacked
  • Path cost zero
  • States any arrangement of 0 to 8 queens on
    board
  • Operators add a queen to any square
  • States arrangements of 0 to 8 queens with none
    attacked
  • Operators place a queen in the left-most empty
    column such that is not attacked by any other
    queen

17
The 8-queens problem(2)
  • States arrangements of 8queens, one in each
    column
  • Operators move any attacked queen to another
    square in the same column

18
Cryptarithmetic
  • problem formulation
  • State a cryptarithmetic puzzle with some
    letters replaced by digits
  • Operators replace all occurrences of a letter
    with a digit not already appearing in the puzzle
  • Goal test puzzle contains only digits, and
    represents a correct sum
  • Path cost zero

FORTY Solution 29786 F2, O9, R7, etc.
TEN 850 TEN 850 ------------ --
------- SIXTY 31486
19
The vaccum world
  • problem formulation ( a single state problem)
  • State one of the eight states shown in Figure
  • Operators move left, move right, suck
  • Goal test no dirt left in any square
  • Path cost each action costs 1

20
Missionaries and cannibals
  • problem formulation
  • State the number of missionaries, cannibals and
    boats on the bank of the river from which they
    started(3,3,1)
  • Operators either 1 missionary, 1 cannibal, 2
    missionaries, 2 cannibals, or one of each across
    in the boat.
  • Goal test 3 missionaries and 3 cannibals in the
    other side of the river (0,0,0)
  • Path cost the number of crossings

21
Example Real-World Problems
  • Route finding
  • Touring and travelling salesperson problems
  • VLSI layout
  • Robot navigation
  • Assembly sequencing

22
Searching for Solutions
  • Partial search tree for route finding from Arad
    to Bucharest.

(a) The initial state (search node)
(b) After expanding Arad
(c) After expanding Sibiu
23
Search Strategies
  • Criteria
  • Completeness
  • Time complexity
  • Space complexity
  • Optimality
  • Classification
  • Uninformed search ( blind search)
  • have no information about the number of steps or
    the path cost from the current state to the goal
  • Informed search ( heuristic search)
  • have some information
  • example Bucharest is southeast of Arad.

24
Breadth-first Search
Searching Strategies
  • Properties
  • Complete Yes (if b is finite)
  • Time complexity 1bb2bd O(bd)
  • Space complexity O(bd) (keeps every node in
    memory)
  • Optimal Yes (if cost1 per step) not optimal in
    general
  • where b is branching factor and
  • d is the depth of the search tree

25
Uniform cost Search (1)
Searching Strategies
  • Expand least-cost unexpanded node
  • the breadth-first search is just uniform cost
    search with g(n)DEPTH(n)

G
26
Depth-first Search (1)
Searching Strategies
  • Depth-first Search

27
Depth-first Search (2)
Searching Strategies
  • Properties
  • Space complexity O(bm)
  • i.e., linear space
  • Time complexity O(bm)
  • where m is the maximum depth
  • Complete, Optimal No
  • fails in infinite-depth spaces, spaces with loops
  • Modify to avoid repeated states along path
  • ? complete in finite spaces

28
Depth-limited Search
Searching Strategies
  • Depth-first search with depth limit l
  • Properties
  • Complete Yes
  • Time complexity O(bl)
  • where l is the depth limit
  • Space complexity O(bl)
  • Optimal No

29
Iterative Deepening Search (1)
Searching Strategies
  • Choose the best depth limit by trying all
    possible depth limit

30
Iterative Deepening Search (1)
Searching Strategies
  • Limit0
  • Limit1
  • Limit2
  • Limit3

31
Iterative Deepening Search (2)
Searching Strategies
  • Choose the best depth limit by trying all
    possible depth limit
  • Breadth-first search Depth-first search
  • Properties
  • Optimal , Complete Yes
  • Time complexity
  • (d1)b0db(d-1)b21bd O(bd)
  • Space complexity O(bd)

32
Bidirectional Search (1)
Searching Strategies
  • Simultaneously search
  • forward from the initial state
  • backward from the goal
  • stop when the two searches meet in the middle.

Goal
33
Bidirectional Search (2)
Searching Strategies
  • Several issues
  • Operators are reversible.
  • Many goal states ? multiple state search
  • Properties
  • Complete Yes
  • Time complexity O(2b(d/2)) O(b(d/2))
  • Space complexity O(b(d/2))
  • Optimal Yes, if step cost 1
  • Can be modified to explore uniform-cost tree

34
Comparison Search Strategies
Searching Strategies
  • Evaluation of search strategies.
  • b is the branching factor
  • d is the depth of solution
  • m is the maximum depth of the search tree
  • l is the depth limit.

35
Avoiding Repeated States
  • Three ways to deal with repeated states
  • Do not return to the state you just came from.
  • Do not create paths with cycles in them.
  • Do not generate any state that was ever generated
    before.

36
Overview CSP
  • Constraint Satisfaction Problem
  • The Solution of CSP
  • Solving Techniques
  • Consistency techniques
  • Search
  • Example
  • Applications

37
Constraint Satisfaction Problem(1)
  • CSP A special kind of problem that satisfies
    some additional structural properties beyond the
    basic requirements for problems in general
  • CSP is defined as
  • a set of variables X x1 , x2 , x3 xn
  • for each variable, xi , a finite domain Di
  • Discrete or continuous
  • a set of constraints restricting the values that
    the variables can simultaneously take
  • Unary Constraints
  • Binary Constraints
  • High order Constraints
  • Absolute constraints vs. preference constraints

38
Constraint Satisfaction Problem(2)
  • Example 8 queens problem
  • Variables the locations of each of the eight
    queens
  • Domains squares on the board
  • Constraints no two queens can be in the same
    row, column, or diagonal
  • V1 the row that the
  • first queen occupies
  • V2 the row that the
  • first queen occupies
  • Domain 1,2,3,,8
  • Constraints
  • (1,3),(1,4),(2,4),(2,5),

Q
Q
Q
39
The Solution of CSP
  • If use DFS in 8 queens problem Search space
    will be 88
  • Too huge!
  • In CSP, the goal test is decomposed into a set of
    constraints on variables rather than being a
    black box.
  • Solutions specifying values for all the
    variables such that the constraints are satisfied

40
Solving Technology
  • Consistency Techniques
  • Systematic Search
  • Generate-and-Test (GT)
  • Generate each possible combination of the
    variables and then test to see if it satisfies
    all the constraints.
  • The first combination that satisfies all the
    constraints is the solution.
  • The number of combinations the size of the
    Cartesian product of all the variable domains
  • Generator merged with tester
  • Look back schema
  • Look ahead schema

41
Consistency Techniques
  • Removing inconsistent values from variable domain
  • Graph representation - constraint graph
  • Consistency Techniques are not complete

Consistent pairs of values
removed by AC
a b c
a b c
Vi
Vj
42
Systematic Search (1)
  • Generator merged with tester
  • Look back schema
  • Backtracking, Backjumping, Backmarking,
    Backchecking
  • Look ahead schema
  • Forward checking (FC) , Look Ahead (LA)

43
Backtracking
Look Back Schema
  • Incrementally extending a partial solution(DFS)
  • When conflict occurs, choose another value for
    inconsistent variable
  • Drawbacks
  • Thrashing
  • Redundant work
  • Late detection of collision
  • Exponential time complexity

44
Example - Backtracking
  • There is no legal position available on the next
    row on the board below
  • As a result the queen on the
  • fifth row will be removed and
  • a new position for it will be sought.
  • If all legal positions on the row
  • lead fail to a solution, the queen
  • on the row above will be moved
  • to a new legal position, and
  • the search for a solution
  • will proceed.

Q
Q
Q
Q
Q
45
Backjumping
Look Back Schema
  • Avoid trashing
  • most recent conflicting variable instead of
    immediate past variable

Q
Q
Q
Q
Q
Q
Q
Q
Q
Q
3
1
3
4
1
2
3
2
46
Backchecking, Backmarking
Look Back Schema
  • Avoid redundant work

47
Look Ahead Schema
  • Prevent future conflict
  • Examples of Look Ahead Schema
  • Forward Checking
  • When an assignment, X/a occurs, temporally delete
    all values from other variable domain
  • Look Ahead

48
Example Forward Checking
49
AC Look Ahead
  • When a queen is placed on the board all squares
    that are threatened by that queen are marked to
    be ignored
  • When considering where to place the next queen it
    uses Arc Consistency to ensure that there are
    legitimate positions for each pair of queens to
    be added, and marks any positions that fail the
    test to be ignored.

Arc (Vi, Vj ) is arc consistent if for every
value x in the current domain of Vi there is some
value y in the domain of Vj such that Vi x and
Vj y is permitted by the binary constraint
between Vi and Vj
50
not yet instantiated variables
already instantiated variables
partial look ahead full look ahead
checked by backtracking
forward checking
51
Systematic Search (2)
  • Smart generator
  • Heuristic Method
  • Hill-climbing
  • Min-conflict (MC)
  • Random walk
  • Tabu search

52
Application
  • Traditional Operational Research (OR)
  • Planning
  • Scheduling
  • Optimization
  • NP-Hard
Write a Comment
User Comments (0)
About PowerShow.com