#include <iso_flock_agent.h>
Inherited by iso::flock::Env, and iso::flock::Swarm.
Inheritance diagram for iso::flock::Agent:
Public Member Functions | |
Agent () | |
default constructor | |
Agent (const base::String &pName) | |
create agent | |
Agent (const base::String &pName, Agent &pAgent) | |
copy constructor | |
virtual | ~Agent () |
destructor | |
unsigned int | index () const |
return agent index | |
const base::String & | name () const |
return agent name | |
unsigned int | parameterCount () const |
return number of parameters the agent contains (first level parameters only | |
bool | checkParameter (const base::String &pParameterName) const |
check if agent has parameter | |
unsigned int | parameterIndex (const base::String &pParameterName) const throw (FlockException) |
return parameter index | |
Parameter & | parameter (unsigned int pParameterIndex) throw (FlockException) |
get parameter | |
Parameter & | parameter (const base::String &pParameterName) throw (FlockException) |
get parameter | |
virtual void | addParameter (Parameter *pParameter) throw (FlockException) |
add parameter | |
virtual void | addParameter (const base::String &pName, unsigned int pDim) throw (FlockException) |
create parameter | |
virtual void | addParameter (const base::String &pName, unsigned int pDim, real pValue) throw (FlockException) |
create parameter | |
virtual void | addParameter (const base::String &pName, const math::Vector< real > &pValues) throw (FlockException) |
create parameter | |
virtual void | removeParameter (const base::String &pParameterName) throw (FlockException) |
create parameter | |
void | setParameterValue (const base::String &pParameterName, real pParameterValue) throw (FlockException) |
set parameter value | |
void | setParameterValues (const base::String &pParameterName, unsigned int pDim, double pValue1, double pValue2,...) throw (FlockException) |
set parameter valus | |
void | setParameterValues (const base::String &pParameterName, const math::Vector< real > &pParameterValues) throw (FlockException) |
set parameter values | |
virtual void | set (const base::String &pParameterName, real pParameterValue) throw (FlockException) |
set parameter values | |
virtual void | set (const base::String &pParameterName, unsigned int pDim, double pValue1, double pValue2,...) throw (FlockException) |
set parameter valus | |
virtual void | set (const base::String &pParameterName, const math::Vector< real > &pParameterValues) throw (FlockException) |
set parameter values | |
virtual void | randomize (const base::String &pParameterName, real pMinParameterValue, real pMaxParameterValue) throw (FlockException) |
randomize parameter value | |
virtual void | randomize (const base::String &pParameterName, const math::Vector< real > &pMinParameterValues, const math::Vector< real > &pMaxParameterValues) throw (FlockException) |
randomize parameter values | |
virtual void | assignNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, space::NeighborGroupAlg *pNeighborGroupAlg) throw (FlockException) |
assign neighbors for a parameter | |
virtual void | assignNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible) throw (FlockException) |
assign neighbors for a parameter | |
virtual void | assignNeighbors (const base::String &pParameterName, const base::String &pSpaceName, bool pVisible, real pNeighborRadius, int pMaxNeighborCount, bool pReplaceNeighborMode) |
assign neighbors for a parameter | |
unsigned int | behaviorCount () const |
return number of behaviors | |
bool | checkBehavior (const base::String &pBehaviorName) const |
check if agent has behavior | |
Behavior & | behavior (unsigned int pBehaviorIndex) throw (FlockException) |
get behavior | |
Behavior & | behavior (const base::String &pBehaviorName) throw (FlockException) |
get behavior | |
virtual void | addBehavior (Behavior *pBehavior) throw (FlockException) |
add behavior | |
virtual void | addBehavior (const base::String &pBehaviorName, const Behavior &pBehavior) throw (FlockException) |
add behavior | |
virtual void | addBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition, const Behavior &pBehavior) throw (FlockException) |
add behavior | |
virtual void | addBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName, const Behavior &pBehavior) throw (FlockException) |
add behavior | |
virtual void | moveBehavior (const base::String &pBehaviorName, unsigned int pBehaviorPosition) throw (FlockException) |
move behavior | |
virtual void | moveBehavior (const base::String &pBehaviorName, const base::String &pSuccessorBehaviorName) throw (FlockException) |
move behavior | |
virtual void | removeBehavior (const base::String &pBehaviorName) throw (FlockException) |
remove behavior | |
virtual void | act () |
perform behaviors | |
virtual void | flush () |
update parameters | |
virtual base::String | info (int pPropagationLevel=0) const |
print agent information | |
Static Public Attributes | |
static const base::String | sClassName |
default name | |
static unsigned int | sInstanceCount |
number of agent instances | |
Protected Attributes | |
base::String | mName |
unsigned int | mIndex |
agent name | |
ParameterList | mParameterList |
agent index | |
BehaviorList | mBehaviorList |
list of parameters | |
Friends | |
std::ostream & | operator<< (std::ostream &pOstream, const Agent &pAgent) |
print agent information |
Created by Daniel Bisig on 3/23/07. Copyright 2006 Daniel Bisig All rights reserved.
Agent::Agent | ( | ) |
default constructor
Agent::Agent | ( | const base::String & | pName | ) |
create agent
pName | name of agent |
Agent::Agent | ( | const base::String & | pName, | |
Agent & | pAgent | |||
) |
copy constructor
pName | name of agent | |
pAgent | agent to copy properties and behaviors from |
Agent::~Agent | ( | ) | [virtual] |
destructor
unsigned int Agent::index | ( | ) | const |
return agent index
const base::String & Agent::name | ( | ) | const |
return agent name
unsigned int Agent::parameterCount | ( | ) | const |
return number of parameters the agent contains (first level parameters only
bool Agent::checkParameter | ( | const base::String & | pParameterName | ) | const |
check if agent has parameter
pParameterName | parameter name |
unsigned int Agent::parameterIndex | ( | const base::String & | pParameterName | ) | const throw (FlockException) |
return parameter index
pParameterName | parameter name |
FlockException | parameter does not exist |
Parameter & Agent::parameter | ( | unsigned int | pParameterIndex | ) | throw (FlockException) |
get parameter
pParameterIndex | parameter index |
FlockException | parameter does not exist |
Parameter & Agent::parameter | ( | const base::String & | pParameterName | ) | throw (FlockException) |
get parameter
pParameterName | parameter name |
FlockException | parameter does not exist |
void Agent::addParameter | ( | Parameter * | pParameter | ) | throw (FlockException) [virtual] |
add parameter
pParameter | parameter |
FlockException | parameter name already exists |
Reimplemented in iso::flock::Swarm.
void Agent::addParameter | ( | const base::String & | pName, | |
unsigned int | pDim | |||
) | throw (FlockException) [virtual] |
create parameter
pName | parameter name | |
pDim | dimension of parameter (> 0) |
FlockException | parameter name already exists |
Reimplemented in iso::flock::Swarm.
void Agent::addParameter | ( | const base::String & | pName, | |
unsigned int | pDim, | |||
real | pValue | |||
) | throw (FlockException) [virtual] |
create parameter
pName | parameter name | |
pDim | dimension of parameter (> 0) | |
pValue | uniform parameter value |
FlockException | parameter name already exists |
Reimplemented in iso::flock::Swarm.
void Agent::addParameter | ( | const base::String & | pName, | |
const math::Vector< real > & | pValues | |||
) | throw (FlockException) [virtual] |
create parameter
pName | parameter name | |
pValues | parameter values |
FlockException | parameter name already exists |
Reimplemented in iso::flock::Swarm.
void Agent::removeParameter | ( | const base::String & | pParameterName | ) | throw (FlockException) [virtual] |
create parameter
pParameterName | parameter name |
FlockException | failed to remove parameter |
void Agent::setParameterValue | ( | const base::String & | pParameterName, | |
real | pParameterValue | |||
) | throw (FlockException) |
set parameter value
pParameterName | parameter name | |
pParameterValue | parameter value |
FlockException | parameter name not found |
void Agent::setParameterValues | ( | const base::String & | pParameterName, | |
unsigned int | pDim, | |||
double | pValue1, | |||
double | pValue2, | |||
... | ||||
) | throw (FlockException) |
set parameter valus
pParameterName | parameter name | |
pDim | dimension of parameter (> 0) | |
pValue1 | first parameter valze | |
pValue2 | second parameter value |
FlockException | parameter name already exists |
void Agent::setParameterValues | ( | const base::String & | pParameterName, | |
const math::Vector< real > & | pParameterValues | |||
) | throw (FlockException) |
set parameter values
pParameterName | parameter name | |
pParameterValues | parameter values |
FlockException | parameter name is not found or parameter values has wrong dimension |
void Agent::set | ( | const base::String & | pParameterName, | |
real | pParameterValue | |||
) | throw (FlockException) [virtual] |
set parameter values
pParameterName | parameter name | |
pParameterValue | parameter value |
FlockException | parameter name is not found |
Reimplemented in iso::flock::Env, and iso::flock::Swarm.
void Agent::set | ( | const base::String & | pParameterName, | |
unsigned int | pDim, | |||
double | pValue1, | |||
double | pValue2, | |||
... | ||||
) | throw (FlockException) [virtual] |
set parameter valus
pParameterName | parameter name | |
pDim | dimension of parameter (> 0) | |
pValue1 | first parameter valze | |
pValue2 | second parameter value |
FlockException | parameter name already exists |
void Agent::set | ( | const base::String & | pParameterName, | |
const math::Vector< real > & | pParameterValues | |||
) | throw (FlockException) [virtual] |
set parameter values
pParameterName | parameter name | |
pParameterValues | parameter values |
FlockException | parameter name is not found or parameter values has wrong dimension |
Reimplemented in iso::flock::Env, and iso::flock::Swarm.
void Agent::randomize | ( | const base::String & | pParameterName, | |
real | pMinParameterValue, | |||
real | pMaxParameterValue | |||
) | throw (FlockException) [virtual] |
randomize parameter value
pParameterName | parameter name | |
pMinParameterValue | minimum parameter value | |
pMaxParameterValue | maximum parameter value |
FlockException | parameter name not found |
Reimplemented in iso::flock::Env, and iso::flock::Swarm.
void Agent::randomize | ( | const base::String & | pParameterName, | |
const math::Vector< real > & | pMinParameterValues, | |||
const math::Vector< real > & | pMaxParameterValues | |||
) | throw (FlockException) [virtual] |
randomize parameter values
pParameterName | parameter name | |
pMinParameterValues | minimum parameter values | |
pMaxParameterValues | maximum parameter values |
FlockException | parameter name not found or parameter values has wrong dimension |
Reimplemented in iso::flock::Env, and iso::flock::Swarm.
void Agent::assignNeighbors | ( | const base::String & | pParameterName, | |
const base::String & | pSpaceName, | |||
bool | pVisible, | |||
space::NeighborGroupAlg * | pNeighborGroupAlg | |||
) | throw (FlockException) [virtual] |
assign neighbors for a parameter
pParameterName | parameter name | |
pSpaceName | name of neighbor space | |
pVisible | whether parameter is visible | |
pNeighborGroupAlg | neighbor group algorithm |
FlockException | parameter not found, space not found, parameter and space dimension mismatch |
Reimplemented in iso::flock::Swarm.
void Agent::assignNeighbors | ( | const base::String & | pParameterName, | |
const base::String & | pSpaceName, | |||
bool | pVisible | |||
) | throw (FlockException) [virtual] |
assign neighbors for a parameter
pParameterName | parameter name | |
pSpaceName | name of neighbor space | |
pVisible | whether parameter is visible |
FlockException | parameter not found, space not found, parameter and space dimension mismatch |
Reimplemented in iso::flock::Swarm.
void Agent::assignNeighbors | ( | const base::String & | pParameterName, | |
const base::String & | pSpaceName, | |||
bool | pVisible, | |||
real | pNeighborRadius, | |||
int | pMaxNeighborCount, | |||
bool | pReplaceNeighborMode | |||
) | [virtual] |
assign neighbors for a parameter
pParameterName | parameter name | |
pSpaceName | name of neighbor space | |
pVisible | whether parameter is visible | |
pNeighborRadius | radius within which neighbors are searched | |
pMaxNeighborCount | maximum number of neighbors in neighbor list if >= 0 (-1: no limit) | |
pReplaceNeighborMode | replace more distant neighbors with closer neighbors if true |
FlockException | parameter not found, space not found, parameter and space dimension mismatch |
Reimplemented in iso::flock::Swarm.
unsigned int Agent::behaviorCount | ( | ) | const |
return number of behaviors
bool Agent::checkBehavior | ( | const base::String & | pBehaviorName | ) | const |
check if agent has behavior
pBehaviorName | behavior name |
Behavior & Agent::behavior | ( | unsigned int | pBehaviorIndex | ) | throw (FlockException) |
get behavior
pBehaviorIndex | behavior index |
FlockException | behavior does not exist |
Behavior & Agent::behavior | ( | const base::String & | pBehaviorName | ) | throw (FlockException) |
get behavior
pBehaviorName | behavior name |
FlockException | behavior not found |
void Agent::addBehavior | ( | Behavior * | pBehavior | ) | throw (FlockException) [virtual] |
void Agent::addBehavior | ( | const base::String & | pBehaviorName, | |
const Behavior & | pBehavior | |||
) | throw (FlockException) [virtual] |
add behavior
pBehaviorName | behavior name | |
pBehavior | behavior |
FlockException | behavior already exists or Illegal Behavior Parameters |
Reimplemented in iso::flock::Swarm.
void Agent::addBehavior | ( | const base::String & | pBehaviorName, | |
unsigned int | pBehaviorPosition, | |||
const Behavior & | pBehavior | |||
) | throw (FlockException) [virtual] |
add behavior
pBehaviorName | behavior name | |
pBehaviorPosition | behavior position | |
pBehavior | behavior |
FlockException | behavior already exists or Illegal Behavior Parameters |
Reimplemented in iso::flock::Swarm.
void Agent::addBehavior | ( | const base::String & | pBehaviorName, | |
const base::String & | pSuccessorBehaviorName, | |||
const Behavior & | pBehavior | |||
) | throw (FlockException) [virtual] |
add behavior
pBehaviorName | behavior name | |
pSuccessorBehaviorName | name of behavior in front of which the new behavior is inserted | |
pBehavior | behavior |
FlockException | behavior already exists or Illegal Behavior Parameters |
Reimplemented in iso::flock::Swarm.
void Agent::moveBehavior | ( | const base::String & | pBehaviorName, | |
unsigned int | pBehaviorPosition | |||
) | throw (FlockException) [virtual] |
move behavior
pBehaviorName | behavior name | |
pBehaviorPosition | behavior position |
FlockException | behavior not found |
Reimplemented in iso::flock::Swarm.
void Agent::moveBehavior | ( | const base::String & | pBehaviorName, | |
const base::String & | pSuccessorBehaviorName | |||
) | throw (FlockException) [virtual] |
move behavior
pBehaviorName | behavior name | |
pSuccessorBehaviorName | name of behavior in front of which the new behavior is inserted |
FlockException | behavior not found |
Reimplemented in iso::flock::Swarm.
void Agent::removeBehavior | ( | const base::String & | pBehaviorName | ) | throw (FlockException) [virtual] |
remove behavior
pBehaviorName | behavior name |
FlockException | failed to remove behavior |
Reimplemented in iso::flock::Swarm.
void Agent::act | ( | ) | [virtual] |
void Agent::flush | ( | ) | [virtual] |
base::String Agent::info | ( | int | pPropagationLevel = 0 |
) | const [virtual] |
print agent information
pPropagationLevel | how far the propagation method proceeds through composite classes (-1: unlimited, 0: no proceeding, >0: limited proceeding) |
Reimplemented in iso::flock::Swarm.
std::ostream& operator<< | ( | std::ostream & | pOstream, | |
const Agent & | pAgent | |||
) | [friend] |
print agent information
const base::String Agent::sClassName [static] |
default name
unsigned int Agent::sInstanceCount [static] |
base::String iso::flock::Agent::mName [protected] |
unsigned int iso::flock::Agent::mIndex [protected] |
agent name
ParameterList iso::flock::Agent::mParameterList [protected] |
agent index
BehaviorList iso::flock::Agent::mBehaviorList [protected] |
list of parameters