From plqueiroz@hotmail.com  Fri Apr  7 19:07:19 2000
Received: from hotmail.com (f83.law8.hotmail.com [216.33.241.83])
	by swi.psy.uva.nl (8.9.3/8.9.3) with SMTP id TAA11563
	for <prolog@swi.psy.uva.nl>; Fri, 7 Apr 2000 19:07:18 +0200 (MET DST)
Received: (qmail 16916 invoked by uid 0); 7 Apr 2000 17:07:07 -0000
Message-ID: <20000407170707.16915.qmail@hotmail.com>
Received: from 161.24.1.173 by www.hotmail.com with HTTP;
	Fri, 07 Apr 2000 10:07:07 PDT
X-Originating-IP: [161.24.1.173]
From: "Pedro José de Queiroz" <plqueiroz@hotmail.com>
To: prolog@swi.psy.uva.nl
Subject: i 'm really need help
Date: Fri, 07 Apr 2000 10:07:07 PDT
Mime-Version: 1.0
Content-Type: text/plain; format=flowed

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

