/* ========================================================================= David W. Aha 8-14-87 (Mom's Birthday) An example for EBG This is a reproduction of the safe-to-stack domain theory and training example as reproduced by Armand Prieditis and Jack Mostow in their AAAI 1987 paper on PROLEARN. ========================================================================= */ /* Domain Theory */ safe_to_stack(X,Y) :- lighter(X,Y). safe_to_stack(X,Y) :- not(fragile(Y)). lighter(X,Y) :- weight(X,Weight1), weight(Y,Weight2), less_than(Weight1,Weight2). weight(Object,Weight) :- volume(Object,Volume), density(Object,Density), product(Volume,Density,Weight). weight(Endtable,500) :- isa(Endtable,endtable). /* Training Example. */ on(box1,table1). volume(box1,10). isa(box1,box). isa(table1,endtable). color(box1,red). color(table1,blue). density(box1,10). product(10,10,100). less_than(100,500). /* Query. */ query :- explain_and_store((safe_to_stack(box1,table1)), (safe_to_stack(Box1,Table1))). query_check :- Beforec is cputime, Beforeh is heapused, safe_to_stack(box1,table1), Afterc is cputime, Afterh is heapused, Diffc is Afterc - Beforec, Diffh is Afterh - Beforeh, write('Cputime used: '), write(Diffc), nl, write('Heapused: '), write(Diffh), nl.