COMP 221 Tutorial 3 - PowerPoint PPT Presentation

1 / 10
About This Presentation
Title:

COMP 221 Tutorial 3

Description:

Design Hints. Heuristic Function. The sum of distances that each tile is from where it ... Design Hints. Open and Close List. The first list is the OPEN list. ... – PowerPoint PPT presentation

Number of Views:261
Avg rating:3.0/5.0
Slides: 11
Provided by: Tina68
Category:
Tags: comp | hints | tutorial

less

Transcript and Presenter's Notes

Title: COMP 221 Tutorial 3


1
COMP 221 Tutorial 3
  • Solving Problems by Searching
  • A Search Assignment 1

2
A Search
  • Is basically Best First Search
  • Greedy Search Uniform Search
  • Is optimal with admissibility
  • Is complete because of monotonically

3
15-puzzle
4
Design Hints
  • v     Game States
  •          A start state 8,7,6,5,4,3,2,1,0
  •          Goal state 1,2,3,4,5,6,7,8,0

5
Design Hints
  • nt moves GAME_SIZE MAX_N_MOVES
  • / From 0 / 1, 3, -1, -1 ,
  • / From 1 / 0, 2, 4, -1 ,
  • / From 2 / 1, 5, -1, -1 ,
  • / From 3 / 0, 4, 6, -1,
  • / From 4 / 1, 3, 5, 7,
  • / From 5 / 2, 4, 8, -1,
  • / From 6 / 3, 7, -1, -1,
  • / From 7 / 4, 6, 8, -1,
  • / From 8 / 5, 7, -1, -1
  •  

6
Design Hints
  • Heuristic Function.
  • The sum of distances that each tile is from where
    it should be.
  • The number of displaced tile.

7
Design Hints
  • Open and Close List.
  • The first list is the OPEN list. This stores
    nodes, which we have generated by using the rules
    from an existing node, but we don't yet know
    where they lead.
  • The second list is nodes that we have generated
    and we have also explored where they go.

8
Why Open and Close List
  • Every time when were expanding a node A to get a
    new node B. we must test whether there is a node
    who has the same state as B stored in the Open or
    Close List. If so and the rating of node B is
    larger than the rating of that node. We can
    decide not to expand to the node B. On the other
    hand, if the rating of node B is smaller, we can
    just remove the node who has already been in the
    Open or Close List.

9
Priority Queue
  • Why heap-based?
  • . In the demo program weve written, a Priority
    Queue based on a heap is used. The goodness of a
    heap is that it can always give you a smallest
    (or largest ) element immediately.

10
The Close List
  • The close list may have a large mount of nodes in
    it. So the best strategy to implement it is a
    harsh table, the reason is that whether a node is
    in the list or not can be known very fast with
    using a harsh table.
Write a Comment
User Comments (0)
About PowerShow.com