Alexey
unread,Oct 6, 2009, 4:29:36 PM10/6/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to SPARK Users Group
Hello all,
I'm going to post descriptions of new features of SPARK/SPARK-PL in
this group. When I have time I'll also update the documentation.
Priorities in SPARK/SPARK-PL.
Now it is possible to specify the order in which agents make their
steps. To be more precise, it is possible to define the order not for
individual agents, but for groups of agents of the same type. To
specify the order, you need to assign priorities to agent types.
Priority is a number from 1 to 1000. 1 means that agents of a given
type act first, 2 - act second, etc. If you don't define priority for
some agents, then by default they'll get the lowest priority 1000. If
several types of agents have the same priority, then they will move in
the alphabetical order: first agent in alphabetical order moves first.
In SPARK-PL priorities are assigned using @step attribute for agents.
You should put this attribute before 'agent' keyword. Example:
@step(priority = 1)
agent Virus : SpaceAgent
@step(priority = 2)
agent Macrophage : SpaceAgent
In this example, agents of type 'Virus' will act before agents of type
'Macrophage'.
Example 2:
@step(priority = 1)
agent Virus : SpaceAgent
@step(priority = 1)
agent Macrophage : SpaceAgent
In this example, agents of type 'Macrophage' will act first because
they have the same priority as viruses but in alphabetical order
'Macrophage' goes first.
Example 3:
@step(priority = 10)
agent Virus : SpaceAgent
agent Macrophage : SpaceAgent
In this example, agents of type 'Virus' will act first because the
priority is not specified for macrophages, so they get the lowest
priority by default.