public abstract class StrategyBasedAgent extends Agent
Modifier and Type | Field and Description |
---|---|
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 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.
|
Constructor and Description |
---|
StrategyBasedAgent(String name,
String team)
Creates a new Subsumption Agent with a specified agent-
name and
team -name. |
Modifier and Type | Method and Description |
---|---|
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(String focus)
computes a achievement supportive action with a certain focus
|
abstract eis.iilang.Action |
generateBuyAction(String focus)
computes a buy action with a certain focus
|
abstract eis.iilang.Action |
generateDefensiveAction(String focus)
computes an defensive action with a certain focus.
|
abstract eis.iilang.Action |
generateOffensiveAction(String focus)
computes an offensive action with a certain focus.
|
abstract eis.iilang.Action |
generateZoneAction(String focus)
computes a zone action with a certain focus
|
Strategy |
getDefaultStrategy() |
Environment |
getEnvironment() |
Graph |
getGraph() |
Strategy |
getLastStrategy() |
protected AgentToken |
getMyToken() |
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(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(Collection<eis.iilang.Percept> percepts) |
void |
setStrategy(Strategy strategy) |
void |
setZoneManager(ZoneManager zoneManager) |
eis.iilang.Action |
step()
Executes one step of the agent.
|
String |
toString() |
protected boolean |
unsurveyedEdgesNearby() |
addBelief, addGoal, broadcastBelief, clearBeliefs, clearGoals, containsBelief, containsGoal, createAgentFromClass, equals, getAllBeliefs, getAllPercepts, getBeliefBase, getEnvironmentInterface, getGoalBase, getMessages, getName, getTeam, hashCode, println, removeBeliefs, removeGoals, sendMessage, setEnvironmentInterface
protected Environment environment
protected Graph graph
protected ActionGenerator ag
protected Collection<eis.iilang.Percept> percepts
public AgentToken myToken
protected int tactics
public static boolean SHOW_GRAPH_WINDOW
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
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(String focus)
focus
- public abstract eis.iilang.Action generateDefensiveAction(String focus)
focus
- public abstract eis.iilang.Action generateZoneAction(String focus)
focus
- public abstract eis.iilang.Action generateBuyAction(String focus)
focus
- public abstract eis.iilang.Action generateAchievementAction(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 testpublic boolean enemyUnknownAgentAt(Vertex v)
v
- vertex to testprotected void log(String s)
s
- the string to appendprotected void clearlog()
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(Collection<eis.iilang.Percept> percepts)
percepts
- the percepts to setpublic 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()
Copyright © 2013. All Rights Reserved.