Package libai.ants
Class Node
- java.lang.Object
-
- libai.ants.Node
-
- All Implemented Interfaces:
java.lang.Comparable<Node>
public class Node extends java.lang.Object implements java.lang.Comparable<Node>
This class belong to the core classes of the Ant Framework.Implements a single node of a problem Graph. It stores the graph index, distance relative to other Node and heuristic information It is mainly used as a handy tool to compute candidate list nodes.
-
-
Field Summary
Fields Modifier and Type Field Description protected doubledistanceDistance according to other nodeprotected doubleheuristicInfoHeuristic informationprotected intindexIndex of the node in the graph
-
Constructor Summary
Constructors Constructor Description Node(int index, double distance, double heuristicInfo)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Node n)Implements Comparable interface.doublegetDistance()doublegetHeuristicInfo()intgetIndex()java.lang.StringtoString()Return the string representation of this node.
-
-
-
Method Detail
-
compareTo
public int compareTo(Node n)
Implements Comparable interface. Compares two nodes.- Specified by:
compareToin interfacejava.lang.Comparable<Node>- Parameters:
n- another node object
-
toString
public java.lang.String toString()
Return the string representation of this node. Useful for debugging.- Overrides:
toStringin classjava.lang.Object- Returns:
- An string with the index, distance and heuristic information of the node.
-
getIndex
public int getIndex()
- Returns:
- the index
-
getHeuristicInfo
public double getHeuristicInfo()
- Returns:
- the heuristicInfo
-
getDistance
public double getDistance()
- Returns:
- the distance
-
-