simuLCS
Class AgentClassifier

java.lang.Object
  extended bysimuLCS.Entity
      extended bysimuLCS.Agent
          extended bysimuLCS.AgentClassifier
Direct Known Subclasses:
AgentClassifierAutomatic, AgentClassifierDuck, AgentClassifierLearning

public class AgentClassifier
extends Agent

Agent having a behaviour described as a set of rules (classifiers).

Author:
Benoit

Field Summary
protected  ClassifierSet behaviour
          The behaviour of the Agent
protected  double DETECTION_DISTANCE
          Size of the visibility circle
protected  boolean isDetectionLimited
          Indicates whether or not a Visibility Circle should be used
protected  Vector2D lastMovVector
          Last movement vector (for the computation of the inertia
protected  Template template
          The template used by the Agent for its behaviour
 
Fields inherited from class simuLCS.Agent
arena, heading, oldcoord
 
Fields inherited from class simuLCS.Entity
color_ext, color_int, coord, generator, name, paintName, size
 
Constructor Summary
AgentClassifier(java.util.Random gen, Arena a, java.lang.String name)
          Creates an AgentClassifier randmoly placed inside the Arena
 
Method Summary
 boolean canDetect(Entity e)
          Indicates if an Entity can be detected (inside the Visibility Circle).
protected  void drawVisibilityCircle(java.awt.Graphics2D g, java.awt.geom.Point2D coord, java.awt.Color c)
          Draw the Circle around the Agent
 ClassifierSet getBehaviour()
          For compatibility reasons, subclasses might implement an Agent whose behaviour is described by a ClassifierSet.
 Vector2D getLastMovVector()
           
 Vector2D getNewMovVectorAccordingTo(ClassifierSet behaviourToConsider, Arena arena, Entity[] others, int nbEntities, java.awt.Graphics2D g, ClassifierSet actionSetToReturn)
          Calculates the New Movement Vector according to the behaviourToConsider.
 Template getTemplate()
           
 boolean isDetectionLimited()
           
 void move(Arena arena, Entity[] others, int nbEntities, java.awt.Graphics2D g)
          Move the agent according to its behaviour and the others entities around.
 void paint(java.awt.Graphics2D g)
          Paint the Agent Classifier + its circle if it has one.
 void setBehaviour(ClassifierSet behaviour)
           
 void setDetectionLimited(boolean b)
           
 void setLastMovVector(Vector2D lastMovVector)
           
 void setTemplate(Template template)
           
 
Methods inherited from class simuLCS.Agent
clear, clear, getArena, getBehaviour, getCoordNearTo, getRadius, isDangerous, isMoving, move, toString
 
Methods inherited from class simuLCS.Entity
collideWithMe, distanceTo, getColor_ext, getColor_int, getCoord, getId, getName, getRadiusBody, getSize, isPaintName, setColor_ext, setColor_int, setName, setPaintName, setSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

template

protected Template template
The template used by the Agent for its behaviour


isDetectionLimited

protected boolean isDetectionLimited
Indicates whether or not a Visibility Circle should be used


DETECTION_DISTANCE

protected double DETECTION_DISTANCE
Size of the visibility circle


lastMovVector

protected Vector2D lastMovVector
Last movement vector (for the computation of the inertia


behaviour

protected ClassifierSet behaviour
The behaviour of the Agent

Constructor Detail

AgentClassifier

public AgentClassifier(java.util.Random gen,
                       Arena a,
                       java.lang.String name)
Creates an AgentClassifier randmoly placed inside the Arena

Parameters:
gen -
a -
name -
Method Detail

getNewMovVectorAccordingTo

public Vector2D getNewMovVectorAccordingTo(ClassifierSet behaviourToConsider,
                                           Arena arena,
                                           Entity[] others,
                                           int nbEntities,
                                           java.awt.Graphics2D g,
                                           ClassifierSet actionSetToReturn)
Calculates the New Movement Vector according to the behaviourToConsider. This corresponds to the procedure "Guess New Position"

Parameters:
behaviourToConsider -
arena -
others -
nbEntities -
g -
actionSetToReturn -
Returns:

move

public void move(Arena arena,
                 Entity[] others,
                 int nbEntities,
                 java.awt.Graphics2D g)
Move the agent according to its behaviour and the others entities around.

Overrides:
move in class Agent
See Also:
Entity.move(Arena, Entity[], int, Graphics2D)

canDetect

public boolean canDetect(Entity e)
Indicates if an Entity can be detected (inside the Visibility Circle).

Parameters:
e - the Entity to detect
Returns:
always true without a Visibility Circle; with a VC, true if e can be detected.

drawVisibilityCircle

protected void drawVisibilityCircle(java.awt.Graphics2D g,
                                    java.awt.geom.Point2D coord,
                                    java.awt.Color c)
Draw the Circle around the Agent

Parameters:
g -
coord -
c -

paint

public void paint(java.awt.Graphics2D g)
Paint the Agent Classifier + its circle if it has one.

Overrides:
paint in class Agent
See Also:
Entity#paint()

getBehaviour

public ClassifierSet getBehaviour()
Description copied from class: Agent
For compatibility reasons, subclasses might implement an Agent whose behaviour is described by a ClassifierSet.

Overrides:
getBehaviour in class Agent
Returns:
null for this class (should be overriden by subclasses)
See Also:
behaviour, ClassifierSet

getLastMovVector

public Vector2D getLastMovVector()

getTemplate

public Template getTemplate()

setBehaviour

public void setBehaviour(ClassifierSet behaviour)

setLastMovVector

public void setLastMovVector(Vector2D lastMovVector)

setTemplate

public void setTemplate(Template template)

isDetectionLimited

public boolean isDetectionLimited()

setDetectionLimited

public void setDetectionLimited(boolean b)