mas.agents0815
Class HelpFunctions

java.lang.Object
  extended by mas.agents0815.HelpFunctions

public class HelpFunctions
extends java.lang.Object


Field Summary
static int MAXZONECONNECTION
           
static int unexploredEdgeWeight
           
 
Constructor Summary
HelpFunctions()
           
 
Method Summary
 java.util.LinkedList<java.lang.String> ConnectionsOutOfZone(java.lang.String checkedVertex, java.util.LinkedList<java.lang.String> allowedVertices, java.util.LinkedList<apltk.interpreter.data.LogicBelief> edges)
           
 java.util.ArrayList<apltk.interpreter.data.LogicGoal> findRoute(java.lang.String position, java.util.LinkedList<java.lang.String> destination, java.util.LinkedList<java.lang.String> vertices, java.util.LinkedList<apltk.interpreter.data.LogicBelief> edges, boolean useEdgeWeight, int MAXSEARCH)
           
 java.util.LinkedList<java.lang.String> findZone(int borderSizeMAX, int MAXZONESIZE, java.lang.String startVertexName, java.util.LinkedList<apltk.interpreter.data.LogicBelief> vertices, java.util.LinkedList<apltk.interpreter.data.LogicBelief> edges)
           
 int getAgentID(java.lang.String agentName)
          extracts the agents ID out of his name precondition: agentName := 'name' + 'ID', |name|>0
 int getEdgeWeight(java.util.LinkedList<apltk.interpreter.data.LogicBelief> edges, java.util.LinkedList<java.lang.String> verticesByName, java.lang.String origin, java.lang.String destination, boolean useEdgeWeight)
           
static int getMin(int[] distance, boolean[] isReady, int dim)
           
 apltk.interpreter.data.LogicBelief goalToBelief(apltk.interpreter.data.LogicGoal goal)
          Maps a goal to a belief.
 boolean isInt(java.lang.String i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unexploredEdgeWeight

public static final int unexploredEdgeWeight
See Also:
Constant Field Values

MAXZONECONNECTION

public static final int MAXZONECONNECTION
See Also:
Constant Field Values
Constructor Detail

HelpFunctions

public HelpFunctions()
Method Detail

findRoute

public java.util.ArrayList<apltk.interpreter.data.LogicGoal> findRoute(java.lang.String position,
                                                                       java.util.LinkedList<java.lang.String> destination,
                                                                       java.util.LinkedList<java.lang.String> vertices,
                                                                       java.util.LinkedList<apltk.interpreter.data.LogicBelief> edges,
                                                                       boolean useEdgeWeight,
                                                                       int MAXSEARCH)
Parameters:
current - position, all posible destinations, all edges known to the agent, all vertices known to the agent useEdgeWeight=1 means, that the algorihm take account of the edge weight calculation shortes paths useEdgeWeight=0 mean, that the length of a path is determined by the number of edges used, maximum number of serach steps
Returns:
ArrayList of Logic goal containing all steps to the nearest unprobed vertex
See Also:
todo*

getMin

public static int getMin(int[] distance,
                         boolean[] isReady,
                         int dim)
Parameters:
dimension - of vertices array
Returns:
vertex which is not yet processed nearest to the origin
See Also:
findnextRoute()

getEdgeWeight

public int getEdgeWeight(java.util.LinkedList<apltk.interpreter.data.LogicBelief> edges,
                         java.util.LinkedList<java.lang.String> verticesByName,
                         java.lang.String origin,
                         java.lang.String destination,
                         boolean useEdgeWeight)
Parameters:
all - edges known to the agent, 2 vertices which supposedly form an edge
Returns:
0 if the edge does not exist/is unknown to agent, else weight of the edge
See Also:
findnextRoute()

getAgentID

public int getAgentID(java.lang.String agentName)
extracts the agents ID out of his name precondition: agentName := 'name' + 'ID', |name|>0

Parameters:
name - of the agent as String
Returns:
ID of the agent
See Also:
sendMessagestoUnseenAgents

isInt

public boolean isInt(java.lang.String i)
Parameters:
String - to test
Returns:
boolean
See Also:
getAgentID

findZone

public java.util.LinkedList<java.lang.String> findZone(int borderSizeMAX,
                                                       int MAXZONESIZE,
                                                       java.lang.String startVertexName,
                                                       java.util.LinkedList<apltk.interpreter.data.LogicBelief> vertices,
                                                       java.util.LinkedList<apltk.interpreter.data.LogicBelief> edges)
Parameters:
max - size of the zones border max size of the zone itself (necessary to limit the search) name of the vertex around which the zone is established, edges and vertices of the map, topology information
Returns:
borderline of the zone, inner part of the zone
See Also:
initialozeZone

ConnectionsOutOfZone

public java.util.LinkedList<java.lang.String> ConnectionsOutOfZone(java.lang.String checkedVertex,
                                                                   java.util.LinkedList<java.lang.String> allowedVertices,
                                                                   java.util.LinkedList<apltk.interpreter.data.LogicBelief> edges)
Parameters:
respective - vertex, vertices not in the zone, all edges of the map
Returns:
all neighbors of the vertex not in a zone
See Also:
findZone

goalToBelief

public apltk.interpreter.data.LogicBelief goalToBelief(apltk.interpreter.data.LogicGoal goal)
Maps a goal to a belief.

Parameters:
goal -
Returns:
belief


Copyright © 2012. All Rights Reserved.