Logic Programming
06-25433
Autumn 2012

 

 

 

Lecture 4: Search and non-determinism

  • iteration can be rewritten in recursion;
  • search trees and strategies with reference to searching acyclic directed graphs;
  • searching cyclic directed graphs is considered.
How to prepare

 
  • Ensure you understand that recursion requires (at least):
    • one base (terminating) case;
    • one recursive case.
  • Consider searching for a route through a network where there is a gap between two nodes. What would Prolog place on the stack? When the search reached the gap in the network and so was blocked, how would Prolog recover from the situation and find an alternative path through the network?
Video

  Recording of the lecture (Autumn 2012) (Vimeo)

Slides

  If you really want the slides from the lecture ... but don't forget printing the slides is not the same as understanding them.

Summary

  Summary and programs with commentary from the lecture

Programs from the lecture

 
Example 1 - for_loop Example 2 - route finding - from start to end Example 3 - route finding - from end to start

Individual study suggestions and further reading

 

Study how to represent information, search strategies and simple rules and how non-deterministic problems can be described and processed in Prolog.

Recursion is covered in:

Assessed work associated with this lecture

  Tutorial sheet 2