Monday, July 24, 2006

Backtracking

In today's lecture we studied about backtracking. Backtracking is a methodical way of trying out various sequences of decisions, until you find that works. Backtracking is basically searching in the databse, when prolog carries out search to do any any particular task, it basically is doing backtracking. Each and every condition of code is checked until the right one is found out. Backtracking gave us an idea that how prolog carries out the search inside the database...the good thing about backtracking in prolog is that it is buil into prolog, as a user you do not need to write down the code inorder to carry out your search.

Fail predicate is used in prolog inorder to force backtracking. The fail predicate forces prolog to carry our search even if the answer of query is found in the database.

0 Comments:

Post a Comment

<< Home