public class TabuEntity extends Entity
Modifier and Type | Field and Description |
---|---|
protected LinkedList<Node> |
memory
The edge memory.
|
protected double[] |
weights
The edges weights of the current node.
|
Constructor and Description |
---|
TabuEntity() |
Modifier and Type | Method and Description |
---|---|
protected void |
addPass(Edge e,
Node n)
Increment the count of the given node and edge.
|
protected void |
addToTabu(Node node)
Add a node to the tabu list.
|
protected void |
cross(Edge e)
Cross the given edge, eventually storing it in the memory and
incrementing its count as well as the count of the current node.
|
void |
init(RandomWalk.Context context,
Node start)
Start the entity on the given node.
|
protected void |
jump()
Make the entity jump to a randomly chosen node.
|
void |
step()
Should move the entity from its current node to another.
|
protected boolean |
tabu(Node node)
Is the given node tabu ?
|
protected void |
tabuStep()
Move the entity from its current node to another via an edge randomly chosen.
|
protected LinkedList<Node> memory
protected double[] weights
public TabuEntity()
public void init(RandomWalk.Context context, Node start)
public void step()
Entity
protected void tabuStep()
This method makes a list of all leaving edges of the current node. If the node has no leaving edge, the entity jumps to another randomly chosen node. Then an edge is chosen at random in the list of leaving edges. The edge is chosen uniformly if there are no weights on the edges, else, an edge with an higher weight has more chances to be chosen than an edge with a lower weight.
When crossed, if the memory is larger than 0, the edge crossed is remembered so that the entity will not choose it anew until it crosses as many edges as the memory size.
protected void jump()
protected void cross(Edge e)
e
- The edge.protected void addPass(Edge e, Node n)
e
- The edge.n
- The node.protected void addToTabu(Node node)
node
- The node to avoid.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses