Hello everybody,
I am making an agent based model with RePast and Jess and I am a bit stuck with the following (maybe for just trivial) problem.
I have 12 facts defined with

(deftemplate stored (slot householdID) (slot amount) (slot age))
--> householdID    is the id of the household
--> amount is the amount of crop stored in the storage container (household has 12 containers) --> age is the age of the crop (i delete all crops which are older than 12)

and one fact

(feedStrategy ?householdID ?amount2eat ?resthunger)
--> ?householdID    is the id of the household
--> ?amount2eat     is the amount of food a household will eat per cycle
--> ?resthunger     hunger for the next cycle (not relevant now)

what I want is somehow to call all the facts from the template above and substract the amount in ?amount2eat from the slot amount. Don't think i described it well so here is an example

fact 1:  stored (householdID 1) (amount 4) (age 1)
fact 2:  stored (householdID 1) (amount 23) (age 2)
  ...     ...    ...    ...   ...   ...
fact 11:  stored (householdID 1) (amount 0) (age 11)
fact 12:  stored (householdID 1) (amount 8) (age 12)

(feedStrategy 1 32 0)

the total amount of the food the agents have to eat is 32. This should be substracted from the storage beginning with the oldest storage. I make sure before this point of time that the amount2eat is smaller than the amount stored facts all together.

Cann i somehow change these 12 facts in a loop?




--

Bogdan Werth
Doctoral Researcher Centre for Policy Modelling
The Graduate School of Business
Aytoun Building
Aytoun Street
Manchester
M1 3GH
UK
Tel: +44 161 247 6481
Fax: +44 161 247 6802
Email: [EMAIL PROTECTED]
Web: http://cfpm.org/~bogdan

**************************************************************
Before acting on this email or opening any attachments you
should read the Manchester Metropolitan University's email
disclaimer available on its website
http://www.mmu.ac.uk/emaildisclaimer
***************************************************************
--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
in the BODY of a message to [EMAIL PROTECTED], NOT to the list
(use your own address!) List problems? Notify [EMAIL PROTECTED]
--------------------------------------------------------------------

Reply via email to