mas.agentsHempelsSofa.util
Class ActionGenerator

java.lang.Object
  extended by mas.agentsHempelsSofa.util.ActionGenerator

public class ActionGenerator
extends java.lang.Object

An action generator which provides some general actions for all strategy-based agents.

Author:
Hempels-Sofa

Constructor Summary
ActionGenerator(Graph graph, ZoneManager zoneManager, StrategyBasedAgent agent)
           
 
Method Summary
 eis.iilang.Action buildZone()
          generates an action which contributes to building a zone
 eis.iilang.Action destroyZone()
          generates an action which contributes to destroying the enemies most precious zone
 eis.iilang.Action destroyZone(Zone targetZone)
          generates an action which contributes to destroying a target zone
 int determineConnectivity(Vertex vertex, Zone zone)
          this method tells with how many frontier agents of a zone a vertex is connected when you call this method from an agents surrounding.
 eis.iilang.Action determineExpansion(Zone zone)
          determines whether an agent on the frontier of the zone should try to expand, parry, survey or recharge
 eis.iilang.Action expandOwnComponent()
          generates an action that extends the agents connected component by surveying (-> money), or taking a walk towards unsurveyed edges
 eis.iilang.Action expandZoneAtRandom(Zone zone)
          generates a random goto action to the outside of the Zone if Agent is on frontier agent @ inside of zone: -> move towards frontier agent @ outside of zone: -> move towards frontier error: -> randomWalk()
 eis.iilang.Action expandZoneBySize(Zone zone)
          creates an goto action to a vertex outside that will expand the Zone by moving to a Node outside of the Zone
 eis.iilang.Action expandZoneByValue(Zone zone)
          creates an gotoAction towards a probably very precious Vertex outside of the Zone this vertex' value is guessed by the value of its neighbours
 Graph getGraph()
           
 eis.iilang.Action moveFastTo(Vertex target)
          generates an action, which leads to the path with least number of vertices
 eis.iilang.Action moveTowards(Vertex vertex)
          Is agent-type unspecific method that generates a goto action towards the closest vertex part of the frontier
 eis.iilang.Action moveTowardsAgent(java.lang.String role)
          generates an action that moves the agent to another agent. if the agent role is at the position, the returned action is "recharge"
 eis.iilang.Action moveTowardsNearest(java.util.LinkedList<Vertex> targetList)
          Is agent-type unspecific method that generates a goto action towards the closest of the given vertices
 eis.iilang.Action randomWalk()
          returns a random goto action
 void setGraph(Graph graph)
           
 eis.iilang.Action stabilizeZone(Zone zone)
          picks a vertex that is well connected to the current zone and goes towards it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionGenerator

public ActionGenerator(Graph graph,
                       ZoneManager zoneManager,
                       StrategyBasedAgent agent)
Method Detail

destroyZone

public eis.iilang.Action destroyZone()
generates an action which contributes to destroying the enemies most precious zone

Returns:
action

destroyZone

public eis.iilang.Action destroyZone(Zone targetZone)
generates an action which contributes to destroying a target zone

Parameters:
targetZone - the zone to destroy
Returns:
action

buildZone

public eis.iilang.Action buildZone()
generates an action which contributes to building a zone


determineExpansion

public eis.iilang.Action determineExpansion(Zone zone)
determines whether an agent on the frontier of the zone should try to expand, parry, survey or recharge

Parameters:
zone - the zone which the agent might expand
Returns:
action resulting action

expandOwnComponent

public eis.iilang.Action expandOwnComponent()
generates an action that extends the agents connected component by surveying (-> money), or taking a walk towards unsurveyed edges


randomWalk

public eis.iilang.Action randomWalk()
returns a random goto action


moveTowardsAgent

public eis.iilang.Action moveTowardsAgent(java.lang.String role)
generates an action that moves the agent to another agent. if the agent role is at the position, the returned action is "recharge"

Parameters:
role - the role of the agent to go to
Returns:
a suitable action

moveTowards

public eis.iilang.Action moveTowards(Vertex vertex)
Is agent-type unspecific method that generates a goto action towards the closest vertex part of the frontier

Parameters:
vertex - a vertex of the zone.
Returns:
a goto action towards the frontier.

moveTowardsNearest

public eis.iilang.Action moveTowardsNearest(java.util.LinkedList<Vertex> targetList)
Is agent-type unspecific method that generates a goto action towards the closest of the given vertices

Parameters:
targetList - the list of targets to choose from
Returns:
a goto action towards the closest target

moveFastTo

public eis.iilang.Action moveFastTo(Vertex target)
generates an action, which leads to the path with least number of vertices

Parameters:
target - the vertex to move to
Returns:
action the resulting action

expandZoneAtRandom

public eis.iilang.Action expandZoneAtRandom(Zone zone)
generates a random goto action to the outside of the Zone if Agent is on frontier agent @ inside of zone: -> move towards frontier agent @ outside of zone: -> move towards frontier error: -> randomWalk()

Returns:
action resulting action

expandZoneByValue

public eis.iilang.Action expandZoneByValue(Zone zone)
creates an gotoAction towards a probably very precious Vertex outside of the Zone this vertex' value is guessed by the value of its neighbours

Parameters:
zone -
Returns:
goto action

expandZoneBySize

public eis.iilang.Action expandZoneBySize(Zone zone)
creates an goto action to a vertex outside that will expand the Zone by moving to a Node outside of the Zone

Parameters:
zone -

stabilizeZone

public eis.iilang.Action stabilizeZone(Zone zone)
picks a vertex that is well connected to the current zone and goes towards it

Returns:
a goto action towards the inside of the zone

determineConnectivity

public int determineConnectivity(Vertex vertex,
                                 Zone zone)
this method tells with how many frontier agents of a zone a vertex is connected when you call this method from an agents surrounding. Don't forget that the result will at least be 1, due to the agent itself

Parameters:
vertex - the position
zone - the zone
Returns:
int the number of calid connections to other vertices of the Zone

setGraph

public void setGraph(Graph graph)

getGraph

public Graph getGraph()
Returns:
the graph


Copyright © 2012. All Rights Reserved.