[Next] [Previous] [Up] [Top] [Contents]

Section 3 - Agents and some user facilities

3.5 Using at to assert to other agent's databases


Now go to the Initial iteration rulebase and write rules to calculate the initial capital for each new producer with consequent:

at ?producer (all week (initialCapital ?capital))

This asserts a clause directly onto a producer's database. It does this from this rule in the ModelAgent using the at primitive. Note that the initialCapital clause must be defined (or inherited) by the Producer type and you must have write access with this clause to do this. Let us check.

Browse the Producer type to find and select the Properties page of the initialCapital predicate. It should look like this.

Note that the Writeability: property is set to public - that is agents external to it (e.g. the model) can write this clause to its database.

Similarly write rule(s) to set fixedCost, marginalCost and profitTarget for all eternity to the databases of all new producers (those that exist this week but not last week).

We have only a few more rules to write in the ModelAgent: one is in the Content rulebase to assert the clause final iteration when the iteration number reaches 2 and one in the Final iteration rulebase to assert final week when the time has reached the number set by noOfWeeks. Write these (see yesterday's lesson if stuck).

Now open a rule firing transcript and restart the simulation (select active and proceed on the debugger if this is still in step mode). After the initial rulebases it should fire two rules per week - one per iteration.


An introduction to SDML - Bruce Edmonds - 13 JUL 99
[Next] [Previous] [Up] [Top] [Contents]

Generated with CERN WebMaker