Subject: i 'm really need help

From: "Pedro Jos� de Queiroz" <[email-masked]>
Date: Fri, 07 Apr 2000 10:07:07 PDT

hello all , I'm a  self-student of Prolog , i know just a bit of Prolog ,and 
  i have to do on program that do this :

The Packet problem

At the Supermarket a robot have to ckeck one list of thing that one client 
want and get the things that this client want and put them in a packet but 
with the right ordem .

The things in stock are writing in the following order :

     Thing(name, weight,size , fragility)

where,

  name : ladle , yogurt, bread, refreshement, etc...
  weight: light ,midle , heavy
  size : little , normal , great
  fragility : fragile , no-frafile

the things in liquidation can be write :

        liquidation(name , quantity)

the things in the list are wanted is :

           purchase(thing ,quantity)

robot have to use "human" heuristic :
a)check the complement :
  - there is sufficient things in liquidation ?
  -when you buy yorgut or ice-cream you have to by the ladle ?
  - etc.

b)packed

- all things have to be packed in bags.
-things heavy are packed first.
-things  fragile have to be put on the top of the bags.
-the last things to packed are light and little things.
- etc .

you have to use little bags not much and not one ,  but without thinking and 
use a absolute minimum. define the follow initial facts:
-thing , liquidation ,purchase.Formule and use things by "shell" .

important : the result have to be a list showing what is the contents in 
each bag.

-------------------------------

Please i dont know much program in prolog , then , if possible ,do simple 
this program.

when i was tryind do this i use things like :

first i define the prioraty:

:-op(810, xfy, '::').
:-op(808, fx , if  ).
:-op(806, xfy ,then).
:-op(804, xfy , and).
:-op(802, xfy , or ).
:-op(801, xf ,   no).

and i try :

-------------------------------------------------
solve:-initialize
  repeat,
     apply-rule,
goal,
writebags.

-------------------------------------------------
-------------------------------------------------
Apply-rule :- R: if condition then   action,
                  test (condition),
                  perform(Action),!.
--------------------------------------------------
[ ]
[eggs eggs  coke  coke]

----------------------------------
unpacked(coke,5).
unpacked(eggs,3).
unpacked(cup,7).
-----------------------------------

assert(unpacked(coke,5)).
assert(unpacked(eggs,3)).
....
------------------------------------
R :: if C then A

test(c):   call(A)

C1 and C2 :- call(1) , call(2).
C1 or C2 :- call(1)  , call(2),

------------------------------------
e.g rules
rule_3 :: if unpacked(X,N) then pack (X,N).
-----------------------------------

thanks ,

Pedro
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com