|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.util.Observable
fr.lifl.jedi.model.interactionDeclaration.InteractionMatrixLine
public class InteractionMatrixLine
This class represents a line of the interaction matrix. Such a line represents the interactions that a particular agent family (the source) is able to initiate.
Each cell of the interaction matrix contains AbstractAssignationElement
,
which are tuples that represent either :
DegenerateInteraction
) -- that the source agent family is able
to initiate.
SingleTargetInteraction
) --that the source agent family is able to initiate
with an instance of a particular other agent family, only if the distance between source
and target is lower than a limit distance.
This assignation element -- called SingleTargetAssignationElement
-- contains
a SingleTargetInteraction
, the class that the target agent has to inherit
from in order to participate in the interaction, and a limit distance under which
interaction is possible.
MultipleTargetInteraction
)
-- that the source agent family is able to initiate with a set of instances of a
particular agent family.
Target agents have to be close enough to the source : the distance has to be lower than
a limit distance.
This assignation element -- called MultipleTargetAssignationElement
-- contains
a MultipleTargetInteraction
, the class that target agents have to inherit
from in order to participate in the interaction, and a limit distance under which
interaction is possible.
Agent behavior relies on the notion of realizable tuple. A tuple (Source Agent, Single Target Interaction, Target Agent), (Source Agent, Degenerate Interaction) or (Source Agent, Multiple Target Interaction, List of Target Agents) is said realizable if and only if :
true
for the source and target agent(s) (only the source agent for degenerate interactions);
Agents behavior is split in two phases :
Agent.getHalo()
).
This process uses a subsumption-like architecture to select what the agent performs :
every assignation element involved in the action selection process is given a priority,
with the methods add(DegenerateInteraction, int)
,
add(MultipleTargetInteraction, Class, double, int)
or add(SingleTargetInteraction, Class, double, int)
.
Interaction selection takes place in decreasing value of priority, and checks every priority
until a realizable tuple is selected.
For each priority, the selection is made with an interaction selection policy. Such policies defines how the selection of a tuple takes place. For instance, it can :
InteractionSelectionPolicy
for more details on interaction selection policies.
This policy is defined thanks to the
setSelectionPolicy(int, InteractionSelectionPolicy)
method.
JEDI V 2.2 |
Created the 5th nov. 2008 |
Created the 5th may 2009 |
Yoann Kubera |
SMAC Team (Systèmes Multi-Agents et Comportement) |
LIFL (Laboratoire d'Informatique Fondamentale de Lille) |
University of Lille, France |
Constructor Summary | |
---|---|
InteractionMatrixLine()
Constructor of the interaction matrix line. |
Method Summary | |
---|---|
void |
add(DegenerateInteraction interaction,
int priority)
Tell that the source agent owning this interaction matrix line is able to initiate a degenerate target. |
void |
add(MultipleTargetInteraction interaction,
java.lang.Class<?> target,
double limit,
int priority)
Tell that the source agent owning this interaction matrix line is able to initiate a multiple target interaction with instances of a target agent family. |
void |
add(SingleTargetInteraction interaction,
java.lang.Class<?> target,
double limit,
int priority)
Tell that the source agent owning this interaction matrix line is able to initiate a single target interaction with an instance of a target agent family. |
boolean |
canBehave()
Checks if the agent owning this matrix line is able to initiate at least one interaction. |
void |
changePriority(AbstractAssignationElement<?> e,
int priority)
Changes the priority of an assignation element of the interaction matrix line. |
InteractionMatrixLine |
clone()
|
java.util.List<AbstractAssignationElement<?>> |
getAssignationElements(int priority)
Gets the set of all assignation elements that have a particular priority for the interaction selection process of this matrix. |
InteractionSelectionPolicy |
getPolicy(int priority)
Gets the interaction selection policy associated with a particular priority of assignation element. |
java.util.SortedSet<java.lang.Integer> |
getPriorities()
Gets the set of all priorities used in the interaction selection process of this matrix. |
boolean |
removeAssignationElement(AbstractAssignationElement<?> element)
Removes one assignation element from the set of interactions used by the interaction selection process. |
boolean |
setSelectionPolicy(int priority,
InteractionSelectionPolicy policy)
Sets an interaction selection policy for a particular priority of assignation elements. |
java.lang.String |
toString()
|
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InteractionMatrixLine()
It initializes the behavior of agents why an empty one.
Method Detail |
---|
public void add(SingleTargetInteraction interaction, java.lang.Class<?> target, double limit, int priority)
Tell that the source agent owning this interaction matrix line is able to initiate
a single target interaction with an instance of a target
agent family.
Such an interaction is possible only if the distance separating source and target
is lower or equal to a limit
distance.
The priority is used in the interaction selection process, to determine in which order
interactions are tried (see InteractionMatrixLine
).
interaction
- The single target interaction the source becomes able to initiate.target
- The class of the target agent with how the source becomes able to interact.limit
- The maximal distance allowed between source and target so that they can interact.priority
- The priority of this assignation element.public void add(MultipleTargetInteraction interaction, java.lang.Class<?> target, double limit, int priority)
Tell that the source agent owning this interaction matrix line is able to initiate
a multiple target interaction with instances of a target
agent family.
Such an interaction is possible only if the distance separating source and each target
is lower or equal to a limit
distance.
The priority is used in the interaction selection process, to determine in which order
interactions are tried (see InteractionMatrixLine
).
interaction
- The multiple target interaction the source becomes able to initiate.target
- The class of the target agents with how the source becomes able to interact.limit
- The maximal distance allowed between source and each target so that they can interact.priority
- The priority of this assignation element.public void add(DegenerateInteraction interaction, int priority)
Tell that the source agent owning this interaction matrix line is able to initiate a degenerate target.
The priority is used in the interaction selection process, to determine in which order
interactions are tried (see InteractionMatrixLine
).
interaction
- The degenerate interaction the source becomes able to initiate.priority
- The priority of this assignation element.public boolean removeAssignationElement(AbstractAssignationElement<?> element)
Removes one assignation element from the set of interactions used by the interaction selection process.
element
- The assignation element to remove.
true
if the element has been removed successfully.public void changePriority(AbstractAssignationElement<?> e, int priority)
Changes the priority of an assignation element of the interaction matrix line.
e
- The assignation element for which the priority is changed.priority
- The new priority of that assignation element.public java.util.SortedSet<java.lang.Integer> getPriorities()
Do not make modifications in this set.
InteractionMatrixLine
public java.util.List<AbstractAssignationElement<?>> getAssignationElements(int priority)
priority
- The priority for which the set of all assignation elements are retrieved.
Returns null
if no assignation elements of such priority exist.
public boolean setSelectionPolicy(int priority, InteractionSelectionPolicy policy)
priority
- The priority of the interaction selection policy
to change or to define.policy
- The new interaction selection policy used for that priority.
true
if the line of the matrix contains at least one assignation
element for that priority.
Else, it returns false, and the selection policy is not added.InteractionMatrixLine
public InteractionSelectionPolicy getPolicy(int priority)
priority
- The priority of the retrieved interaction selection policy.
null
if such element
does not exist.public boolean canBehave()
true
if the agent owning this matrix line is able to
initiate at least one interaction.public InteractionMatrixLine clone()
clone
in class java.lang.Object
Object.clone()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |