06.03.2013 Views

Artificial Intelligence and Soft Computing: Behavioral ... - Arteimi.info

Artificial Intelligence and Soft Computing: Behavioral ... - Arteimi.info

Artificial Intelligence and Soft Computing: Behavioral ... - Arteimi.info

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.4 Illustrating Backtracking by<br />

Flow of Satisfaction Diagrams<br />

To explain how the system answers these queries, we have to learn a very<br />

useful phenomenon, called backtracking.<br />

Let us now concentrate on the query: Teacher (X)?<br />

Since<br />

Teacher (X) ←<br />

Person (X),<br />

Writes-on (X, board, classhour). (10)<br />

to satisfy the Goal: Teacher (X), one has to satisfy the sub-goals: Person (X),<br />

Writes-on (X, board, classhour). Now, PROLOG searches a sub-goal Person( )<br />

for the predicate Person (X). At clause 5, it finds a match <strong>and</strong> X is instantiated<br />

to john (fig. 6.2 (a)). PROLOG puts a marker at clause 5. Now, it continues<br />

searching Writes-on (john, board, classhour) in the remaining clauses. But it<br />

fails to find so, since Writes-on (john, board, classhour) is at 2 nd position in<br />

the list of clauses (fig. 6.2 (b)). So, it has to trace back above the marker place<br />

(fig. 6.2(c)) <strong>and</strong> then ultimately it finds Writes-on (john, board, classhour)<br />

(fig. 6.2(d)). Since the sub-goals are succeeded, the goal also succeeds,<br />

yielding a solution: Teacher (john). The concept of backtracking is illustrated<br />

below with the help of flow of satisfaction diagrams [2] fig. 6.2(a) to (d)).<br />

Teacher (X)<br />

Person (X)<br />

Writes-on (X, board, classhour)<br />

Fig. 6.2 (a): Unification of the first sub-goal.<br />

X = john, by (5)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!