PROGRAM "vero" LOAD "cal.pl" CAPABILITIES { // Mental actions {True} Goal(Y) {goal(Y)} {True} Pay(X,Y) {payed(X,Y)} {TRUE} Treatedgo(X) {go(X)} {True} Treated(X,C,Y) {not received(X,propose,content(price(C,Y)))} {TRUE} Updateoffer(Z,W,N) {not currentoffer(Z), not lastoffer(W), lastoffer(Z), currentoffer(N)} {TRUE} Updateotheroffer(X,Y) {not otheroffer(X), otheroffer(Y)} {TRUE} Updatecheaper(Y,V) {not cheaper(V,Y), cheaper(Y,V)} } BELIEFBASE { % domain knowledge transport(rentcar). transport(plane). transport(train). transport(boat). conf(aaai). conf(uumus). conf(ijair). pricereg(aaai,125). pricereg(uumus,450). pricereg(ijair,95). town(sydney). town(candera). town(melbourne). isin(aaai,sydney). isin(uumus,candera). isin(ijair,melbourne). seller(philippe). seller(sally). seller(bob). achieve(go(Z),W):- town(Z), transport(W). securetransport(X):- deal(price(Y,Z)), transport(Y). % preferences prefmin(rentcar,250). prefmax(rentcar,100). prefmin(plane,250). prefmax(plane,150). % beliefs about items-prices cheapest(X):- not cheaper(Y,X). cheaper(rentcar,plane). cheaper(rentcar,train). cheaper(rentcar,boat). currentoffer(0). lastoffer(0). otheroffer(0). % calculate the next offer nextoffer(N):- currentoffer(Z), otheroffer(O), plus(Z,O,P), times(P,0.5,N). % indicate when a deal has been reached deal(price(C,Z)):- sent(X,accept,content(price(C,Z))), seller(X). deal(price(C,Z)):- received(X,accept,content(price(C,Z))), seller(X). } GOALBASE { go(aaai) } PLANBASE{} PG-RULES{ //Plan to go to a conference go(X)<- conf(X) and isin(X,Y)| {Goal(go(Y)); goal(go(Y)); payreg(X); Treatedgo(X);}, } PR-RULES { // initial plan for going somewhere goal(X)<- achieve(X,Z) and cheapest(Z) | {negotiate(Z)} // initial plan for paying a registration payreg(X)<- pricereg(X,Y) and securetransport(X) and not payed(X,Y)| {Pay(X,Y)}, negotiate(Z) <- seller(X) | {Send(X,request,content(Z)); bargain(X,Z)} bargain(X,Content) <- received(X,propose,content(price(Content,Y))) and prefmin(Content,M) and prefmax(Content,P) and otheroffer(T) and currentoffer(C) | {Treated(X,Content,Y); Updateotheroffer(T,Y); minus(Y,C,D)?; if D < 10 then Send(X,accept,content(price(Content,Y))) else {nextoffer(X,Content); bargain(X,Content)}} , bargain(X,Y) <- received(X,reqpurpose,why(Y)) and achieve(Z,Y) and goal(Z) and not sent(X,inform,because(Z)) |{Send(X,inform,because(Z));argue(Z,Y)} , bargain(X,Y) <- received(X,reqpurpose,why(Y)) and achieve(Z,Y) and goal(Z) and sent(X,inform,because(Z)) | {Send(X,refuse,because(Z))}, bargain(X,Y) <- received(X,accept,content(price(Y,Z))) | {Treated(X,Y,Z)}, argue(Z,V) <- received(X,inform,content(achieve(Z,Y))) and goal(Z) and not cheaper(Y,V) | {Updatecheaper(Y,V); goal(Z)} , // accept the offer or generate a new one nextoffer(Y,X)<- prefmin(X,M) and prefmax(X,A) and currentoffer(Z) and lastoffer(W) | {if not sent(Y,propose,content(price(X,A))) then {Send(Y,propose,content(price(X,A))); Updateoffer(Z,W,A)} else {nextoffer(N)?; if N > M then {Send(Y,propose,content(price(X,M))); Updateoffer(Z,W,M)} else {Send(Y,propose,content(price(X,N))); Updateoffer(Z,W,N)}}} , }