Problem Solving - PowerPoint PPT Presentation

About This Presentation
Title:

Problem Solving

Description:

Astronaut carries Grain, Goose, Fox across river. Astronaut 1 item ... States: location of Astronaut, Fox, Goose and Grain at top or bottom river bank ... – PowerPoint PPT presentation

Number of Views:57
Avg rating:3.0/5.0
Slides: 44
Provided by: kipir
Category:
Tags: goose | problem | solving

less

Transcript and Presenter's Notes

Title: Problem Solving


1
Problem Solving
CS1103 ????????
  • Prof. Chung-Ta King
  • Department of Computer Science
  • National Tsing Hua University

(Contents from Prof. I. K. Lundqvist, Prof.
Nilufer Onder, Prof. Kun-Yung Lu, 140.121.196.191/
pdf/ai/2007/Topic 3. Search methodologies.pdf)
2
?????????
3
?????????
4
???????????
5
?? ? ????
??/??/????
????
?????
????
225???
????
?????????
6
How Did We Derive the Solution?
  • Problem solving as state space search
  • What is state?
  • States location of you
  • Transitions transportation (?????????????????????
    )

??
????
?????
???
????
??
?????????
????
7
Consider a More Complex Problem
  • Consider the problem
  • Astronaut carries Grain, Goose, Fox across river
  • Astronaut 1 item allowed in the boat
  • Goose alone eats Grain
  • Fox alone eats Goose

Astronaut Grain, Goose, Fox
8
Problem Solving as State Space Search
  • Goal
  • Astronaut, Fox, Goose and Grain across river
  • Problem representation
  • States location of Astronaut, Fox, Goose and
    Grain at top or bottom river bank
  • Operators move boat with astronaut and 1 or 0
    items to other bank
  • Generate solution
  • Sequence of states Move(goose,astronaut),
    Move(astronaut), . . .

9
Initial State
Goal State
10
(No Transcript)
11
Representing the Problem
  • The problem space consists of
  • A state space which is a set of states
    representing the possible configurations of the
    world
  • A set of operators which can change one state
    into another
  • Initiate state and goal state
  • Path sequence of states produced by the valid
    application of operators from an old state to a
    new state
  • The problem space can be viewed as a graph where
    the states are the nodes and the arcs represent
    the operators

12
The 8-Puzzle Problem
  • Operator move blank

13
State Space of 8-Puzzle
14
????????????
  • ?????????,???????????,?????????????,??
  • ??? (optimal solution)
  • ??sorting
  • Bubble sort, selection sort, insertion sort,
    merge sort, heapsort, quicksort, ...

15
???...
  • ???????
  • ????
  • ??????
  • ???
  • ????
  • ???
  • ?????
  • ???
  • ???????? ...
  • ?????
  • ???????

Optimization goal
?????????
16
????????
  • ??
  • ????
  • ??????

?? (1.5??)
????
?????
?? (0.5??)
?? (15??)
?????????
????
17
????????
  • ??
  • ????
  • ???????

?? (100)
????
?????
?? (40)
?? (15)
?????????
????
18
????????
  • ??????
  • ?????????????

?? (???)
????
?????
?? (???)
?? (???)
?????????
????
19
Cost-directed Problem Solving
  • In many search problem, we are interested not
    only in reaching a goal state, but also in
    reaching it with the lowest cost (or the maximum
    profit)
  • We can compute a cost as we apply operators and
    transit from state to state

20
Traveling Salesperson Problem
21
State Space of TSP
(arc label cost from root)
22
Nearest Neighbor Path
Nearest neighbor path AEDBCA (550) Minimal cost
path ABCDEA (375)
23
Finding Solutions
  • Some problems have only one solution (goal
    state), e.g. 8-puzzle, sorting, Tower of Hanoi
    others may have more than one solution, e.g.
    ???????, traveling salesperson
  • To find one solution
  • We need to find one path from the root to the
    leaf in the state space
  • To find the optimal solution
  • We need to traverse all the paths in the state
    space
  • What if the state space is huge?

24
Search Algorithms
  • Effective search algorithm must
  • Cause motion or traversal of the state space
  • Do so in a controlled or systematic manner
  • The method that never using the information about
    the problem to help direct the search is called
    brute-force, uninformed, or blind search
  • Search algorithms which use information about the
    problem, such as the cost or distance to the goal
    state, are called heuristic, informed, or
    directed search

25
Search Algorithms
  • An algorithm is optimal if it will find the best
    solution from among several possible solutions
  • A strategy is complete if it guarantees that it
    will find a solution if one exists.
  • Complexity of an algorithm
  • Time complexity (how long to find a solution)
  • Space complexity (how much memory it requires)

26
Search Algorithms
  • The search problem can be classified to two
    classes P and NP
  • The classes P consists of all problems for which
    algorithms with polynomial time behavior have
    been found
  • The class NP is the set of problems for which
    algorithms with exponential behavior have been
    found
  • If an optimization of the problem cannot be
    solved in polynomial time, it is called NP-hard

27
Breadth-first Search
28
Depth-first Search
Depth bound 5
29
Blind Search
  • BFS and DFS are blind in the sense that they have
    no knowledge about the problem at all other than
    the problem space
  • Such techniques are also called brute-force
    search, uninformed search, or weak methods
  • Worst case scenarios are equally bad
    (exponential)
  • Obviously, we cant expect too much from these,
    but they provide
  • Worst-case scenarios

30
Heuristic State-space Search
  • A heuristic algorithm consists of two parts
  • The heuristic measure a heuristic evaluation
    function measures the goodness of a node
  • An algorithm that uses the heuristic measure to
    search the state space
  • Heuristics are rules for choosing the branches in
    a state space that are most likely to lead to an
    acceptable problem solution
  • A heuristic is only an informed guess of the next
    step to be taken in solving the problem
  • A heuristic is often based on experience or
    intuition and can lead to a suboptimal solution

31
Tic-tac-toe
  • of states in an exhaustive search is 9!

32
Tic-tac-toe
  • A heuristic is moving to the board in which X has
    the most winning lines

33
Hill-climbing Search
  • Hill-climbing expands the current state and
    selects the best child for further expansion
  • Neither its siblings nor its parent are retained
    (without backtracking)
  • Search halts when it reaches a state that is
    better than any of its children
  • Major problems
  • May get stuck at a local optimal

34
Hill-climbing Search
  • Possible solutions
  • Keep a list of plausible move and backtrack when
    a dead-end is met
  • Make a big jump or move the same direction
    several times
  • Try different directions (applying two or more
    rules) before test
  • Hill climbing is basically a local heuristics

35
Best-First Search
  • Use heuristic function to choose a best move out
    of several alternatives
  • Keep exploring the best path (depth-first search)
    until it turns less promising than a previous
    path
  • Return to explore the previous path that has
    become most promising

36
Heuristic Evaluation Function
  • The goal is to use the limited information
    available in a single state descriptor to make
    intelligent choices
  • For 8-puzzle, heuristicmay be
  • tiles out of place
  • Sum of all the distances by which the tiles are
    outof pace
  • 2 x direct tile reversals

37
Heuristic Evaluation Function
  • The evaluation function may be the sum of two
    components f(n)g(n)h(n)
  • g(n) measures the actual length of the path from
    state n to the start state
  • h(n) is a heuristic estimate of the distance from
    state n to a goal
  • A Algorithm

38
Iterative Improvement
  • Start with one solution and make modifications to
    improve its quality

39
Find Initial Solution
  • Traverse the state space and find one solution

?? (1.5??)
????
?????
?? (0.5??)
?? (15??)
?????????
????
40
Refinement
  • Modify the solution to make it better

???????
?? (1.2??)
?? (45??)
?? (1.5??)
????
?????
?? (0.5??)
?? (15??)
?????????
????
41
Example Search Problems
  • Puzzles missionaries and cannibals, 8-puzzle,
    n-queens, Tower of Hanoi,
  • 2-player games chess, checkers, Chinese Go,
  • Proving theorems in logic and geometry
  • Path finding
  • Industrial problems VLSI layout design,
    assembling a complex object
  • AI problems speech recognition, planning,

42
Importance of Problem Space
  • The choice of a problem space makes a big
    difference
  • Finding a good abstraction is half of the problem
  • Intelligence is needed to figure out what problem
    space to use

43
Quiz
  • ??????????????????DVD???????????????CPU??????????
  • ???????state space
  • ????????? (path)???????
Write a Comment
User Comments (0)
About PowerShow.com