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

Section 1 - Clauses, Types and Rules

1.15 Copying a Definition


Go back to the type browser and add a clause definition for moneyRange in the model parameters category of the UniversalAgent type. Give it the following syntax.

Also give it a suitable comment along the lines of sets min and max for money allocated to consumers.

Since the syntax for requirementRange is similar we will save time by copying the moneyRange definition. Select the definition moneyRange and use the command button in that pane to copy definition and then enter the keyword requirementRange. Edit the comment to something like sets min and max of consumers requirements for the good.

In a similar manner enter the definitions for the definitions below in the category consumer.

Now edit the consumer parameters rule so that the consequent reads:

and

noConsumers 30\

moneyRange 50 300\

requirementRange 15 35

Also change the comment. We now want to add a rule that allocates a random amount of money to each consumer within the limits set by the last rules. Enter a rule with some sensible name in the randomised attributes category that has antecedent:

and

consumer ?consumer\

moneyRange ?minMoney ?maxMoney\

randomNumber ?rn1 [getsMoney ?consumer]\

is ?money (truncated ?rn1 * (?maxMoney - ?minMoney) + ?minMoney)

and consequent:

getsMoney ?consumer ?money

Test this rule as before by running the simulation. Write a similar rule to set requires ?consumer ?amount based on requirementRange ?minRequirement ?maxRequirement and test this. Also write and test a new rule to set the profitTarget clause for producers, using the profitTargetRange clause in the antecedent.

Enter the following definitions in the producer category of type UniversalAgent,

this definition under category model parameters

and these under consumer.


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

Generated with CERN WebMaker