CutNotFail 2 - Book York University- CSE 3401- V. Movahedi...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Library Example (cont.) The query will be answered: X= ‘A. Jones’, Y= enquiries; X= ‘A. Jones’, Y= enquiries; since A. Jones had two overdue books X= ‘A. Jones’, Y= borrowing certainly not what we want! Resolving with the second rule! Another example for the need to control backtracking! York University- CSE 3401- V. Movahedi 6 07_CutNotFail
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Search tree of Library Example York University- CSE 3401- V. Movahedi 7 07_CutNotFail
Background image of page 2
CUT ! Changing the code as follows solves this problem: facility(Pers, Fac):- book_overdue(Pers, Book), ! , basic_facility(Fac). facility(Pers, Fac):- general_facility(Fac). client(‘A. Jones’). book_overdue (‘A. Jones’, book100). book_overdue (‘A. Jones’, book200). basic_facility(enquiries). general_facility(borrowing). Cut tells Prolog: If you got this far, don’t try resolving with the second rule for facility . If you got this far, commit to values you have, for example for
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Book York University- CSE 3401- V. Movahedi 8 ! always succeeds as a goal 07_CutNotFail What does ! mean? Effect of cut in this example: If a client is found to have an overdue book, then only allow the client the basic facilities of the library. Dont bother going through all the clients overdue books, and dont consider any other rule about facilities. [Clocksin] Formally: When a cut is encountered as a goal, the system thereupon becomes committed to all choices made since the parent goal was invoked. All other alternatives are discarded. Hence an attempt to re-satisfy any goal between the parent goal and the cut goal will fail. [Clocksin] York University- CSE 3401- V. Movahedi 9 07_CutNotFail York University- CSE 3401- V. Movahedi 10 New Search tree of Library Example 07_CutNotFail...
View Full Document

Page1 / 5

CutNotFail 2 - Book York University- CSE 3401- V. Movahedi...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online