|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmassim.javaagents.Agent
mas.agentsHempelsSofa.StrategyBasedAgent
public abstract class StrategyBasedAgent
An implemenation of a generic Goal Oriented Agent.
Field Summary | |
---|---|
protected ActionGenerator |
ag
The action generator. |
protected Environment |
environment
The environment of the agent. |
protected Graph |
graph
The believed Looking of the graph. |
AgentToken |
myToken
The token which holds percepted states of this agent. |
protected java.util.Collection<eis.iilang.Percept> |
percepts
The percepts which are received in each step. |
static boolean |
SHOW_GRAPH_WINDOW
|
protected int |
tactics
The current tactical state of the agent. |
Fields inherited from class massim.javaagents.Agent |
---|
beliefs, goals |
Constructor Summary | |
---|---|
StrategyBasedAgent(java.lang.String name,
java.lang.String team)
Creates a new Subsumption Agent with a specified agent- name and
team -name. |
Method Summary | |
---|---|
void |
broadcast(apltk.interpreter.data.LogicBelief belief)
|
protected eis.iilang.Action |
checkEnergy(eis.iilang.Action action)
checks whether the energy of the agent is sufficient to execute the action . |
protected void |
clearlog()
clears the agent's log. |
protected boolean |
enemyNearby()
|
boolean |
enemySaboteurAt(Vertex v)
|
boolean |
enemyUnknownAgentAt(Vertex v)
|
protected void |
finalize()
|
abstract eis.iilang.Action |
generateAchievementAction(java.lang.String focus)
computes a achievement supportive action with a certain focus |
abstract eis.iilang.Action |
generateBuyAction(java.lang.String focus)
computes a buy action with a certain focus |
abstract eis.iilang.Action |
generateDefensiveAction(java.lang.String focus)
computes an defensive action with a certain focus. |
abstract eis.iilang.Action |
generateOffensiveAction(java.lang.String focus)
computes an offensive action with a certain focus. |
abstract eis.iilang.Action |
generateZoneAction(java.lang.String focus)
computes a zone action with a certain focus |
Strategy |
getDefaultStrategy()
|
Environment |
getEnvironment()
|
Graph |
getGraph()
|
Strategy |
getLastStrategy()
|
protected AgentToken |
getMyToken()
|
java.util.Collection<eis.iilang.Percept> |
getPercepts()
|
Strategy |
getStrategy()
|
ZoneManager |
getZoneManager()
|
abstract void |
handleAgentSpecificMessages()
handles some messages which are agent-role specific. |
void |
handlePercept(eis.iilang.Percept p)
This method is called if the environment-interface sends a percept as a notification. |
void |
loadStrategy(Strategy strategy)
Loads a strategy without cloning. |
void |
loadStrategy(Strategy strategy,
boolean clone)
Loads a strategy |
protected void |
log(java.lang.String s)
appends some string to the agents log. |
abstract void |
preferencesRevision()
computes the preferences for the strategies and focuses. |
void |
reloadStrategy()
reloads the last strategy. |
void |
setEnvironment(Environment environment)
|
protected void |
setGraph(Graph graph)
b |
protected void |
setMyToken(AgentToken myToken)
|
void |
setPercepts(java.util.Collection<eis.iilang.Percept> percepts)
|
void |
setStrategy(Strategy strategy)
|
void |
setZoneManager(ZoneManager zoneManager)
|
eis.iilang.Action |
step()
Executes one step of the agent. |
java.lang.String |
toString()
|
protected boolean |
unsurveyedEdgesNearby()
|
Methods inherited from class massim.javaagents.Agent |
---|
addBelief, addGoal, broadcastBelief, clearBeliefs, clearGoals, containsBelief, containsGoal, createAgentFromClass, equals, getAllBeliefs, getAllPercepts, getBeliefBase, getEnvironmentInterface, getGoalBase, getMessages, getName, getTeam, hashCode, println, removeBeliefs, removeGoals, sendMessage, setEnvironmentInterface |
Methods inherited from class java.lang.Object |
---|
clone, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected Environment environment
protected Graph graph
protected ActionGenerator ag
protected java.util.Collection<eis.iilang.Percept> percepts
public AgentToken myToken
protected int tactics
public static boolean SHOW_GRAPH_WINDOW
Constructor Detail |
---|
public StrategyBasedAgent(java.lang.String name, java.lang.String team)
name
and
team
-name.
name
- The name of the agent.team
- The team-name the agent belongs to.Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public void handlePercept(eis.iilang.Percept p)
Agent
getAllPercepts
method which
yields all percepts.
handlePercept
in class Agent
p
- the percept to be handledpublic eis.iilang.Action step()
Agent
step
in class Agent
public abstract void preferencesRevision()
public abstract void handleAgentSpecificMessages()
public void broadcast(apltk.interpreter.data.LogicBelief belief)
belief
- the belief to send to all other agents.public abstract eis.iilang.Action generateOffensiveAction(java.lang.String focus)
focus
- public abstract eis.iilang.Action generateDefensiveAction(java.lang.String focus)
focus
- public abstract eis.iilang.Action generateZoneAction(java.lang.String focus)
focus
- public abstract eis.iilang.Action generateBuyAction(java.lang.String focus)
focus
- public abstract eis.iilang.Action generateAchievementAction(java.lang.String focus)
focus
- protected eis.iilang.Action checkEnergy(eis.iilang.Action action)
action
.
action
- the action which shall be executed.
protected boolean enemyNearby()
public boolean enemySaboteurAt(Vertex v)
v
- the vertex to test
public boolean enemyUnknownAgentAt(Vertex v)
v
- vertex to test
protected void log(java.lang.String s)
s
- the string to appendprotected void clearlog()
protected void finalize()
finalize
in class java.lang.Object
protected void setGraph(Graph graph)
graph
- the graph to setpublic Graph getGraph()
public void setEnvironment(Environment environment)
environment
- the environment to setpublic Environment getEnvironment()
public void setPercepts(java.util.Collection<eis.iilang.Percept> percepts)
percepts
- the percepts to setpublic java.util.Collection<eis.iilang.Percept> getPercepts()
protected void setMyToken(AgentToken myToken)
myToken
- the myToken to setprotected AgentToken getMyToken()
public void setStrategy(Strategy strategy)
strategy
- the strategy to setpublic Strategy getStrategy()
generateAchievementAction(String)
generateBuyAction(String)
generateZoneAction(String)
generateDefensiveAction(String)
generateOffensiveAction(String)
public Strategy getLastStrategy()
public Strategy getDefaultStrategy()
getLastStrategy()
.public void reloadStrategy()
public void loadStrategy(Strategy strategy)
strategy
- the strategy to loadpublic void loadStrategy(Strategy strategy, boolean clone)
strategy
- the strategy to loadclone
- true
, if the strategy shall be clonedfalse
, otherwise (more performant)protected boolean unsurveyedEdgesNearby()
public void setZoneManager(ZoneManager zoneManager)
zoneManager
- the zoneManager to setpublic ZoneManager getZoneManager()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |