.


:




:

































 

 

 

 





, . (Explanation-Based Generalization - EBG), . , , , .

EBG : , , . , , "" . . , , ; , , . , ( ), () . , "", .

EBG . Prolog .

,

.



II. Prolog


, , .

, Prolog.

, .

. , , , .

. , .

. , , .

; ( ) , .

. . ( ) " ", .. . , EEG, . , . , , . . , " " . .

EBG. 23.3 EBG. , . . , : % ( ) gives(John, John, chocolate)

23.3.

% Prolog % :

:- dynamic gives/3, would_please/2, would_comfort/2, feels_sorry_for/2, go/3, move/2, move_list/2.

$ ,


23.



gives(Personl,?erson2, Gift):-likes(Personl, Person2), would_please(Gift, Person21.

gives(Personl, Persan2, Gift,-:-feels_sorry_for(Personl, Person2), would_coinfort [ Gift, Person2).

wauld_please(Gift, Person): -

neecis (Person, Gift).

1 would_comfort(Gift, Person):-

likes[ Person, Gift).

feels_sorry_for{ Personl, Person2): -likes (Personl, Perso:i2), sad{ Person2).

feels_sorry_for(Person, Person):-sad(Person;.

i

operational{ likes(_, _)). operational! needs(_, _)). operati.cr.al (sad [ _)).

likes(John, annie). likes(annie, John). likes! John, chocolate;, needs(annie, tennis_racket).

sad{ John).

% , .

i go(Level, GoalLevel, Moves)

Moves Level GoalLevel

go! Level, GoalLevel, Moves): -

ncve_list(Moves, Distance!, %

Distance -:- GoalLevel - Level.

move_list([], 0).

move_list ([Mbvel I Moves], Distance + Distance 1): -move_list(Moves, Distance), move(Movel, Distancel).

move[ up, 1). move(down, -1).

operational! A =:= B).

: gives (John., John, chocolate) <= (feels_sorry_for{ John, John) <= = sad(John), % ,

% , would_comfort{ chocolate, John) <== likes(John, chocolate) %

$ , 3



II. Prolog


John chocolate :

gives(Person, Person, Thing! <== % - , (feels soi:ry for(Person, Person) <-- sad(Person), I ,

% , would^comfort(Thing, Person! <== likes[ Person, Thing) %

% , ) 23.3 sad () likes () . gives , , "", . :

gives(Person, Person, Thing) <-- % - ,

(sad[ Person), %

likes [ Person, Thing) $

)

, Condition gives (Person, Person, Thing) : Condition (sad(Person), likes(Person, Thing))

, . asserta ((gives(Person, Person, Thing):- Condition))

, gives, :

gives(Person, Person, Thing):-sad(Person), likes(Person, Thing).

gives { John, John, chocolate) ( ) gives ! , : gives; John, armie, tennis_racket). %

:

gives[ Personl, Person2, Thing):- 4 ,

likest Personl, Person2), % ? ,

needs(Person2, Thing]. i

, 23.3, , EBG Prolog.

EBG : , " ". , . . , , 23.1, , . , EBG, ebg : ebg(Goal, GenGoal, Condition)

Goal - , , GenGoal - . Condition


23.



GenGoal, . 23.4. {. 23.3) ebg :

?- ebg(gives! John, John, chocolate), gives! X, Y, Z), Condition]. x = Y Condition - (sacl(X), likes (X, Z))





:


: 2015-10-01; !; : 372 |


:

:

- , .
==> ...

1939 - | 1733 -


© 2015-2024 lektsii.org - -

: 0.017 .