Package libai.ants

Class 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 double distance
      Distance according to other node
      protected double heuristicInfo
      Heuristic information
      protected int index
      Index of the node in the graph
    • Constructor Summary

      Constructors 
      Constructor Description
      Node​(int index, double distance, double heuristicInfo)
      Constructor.
    • Field Detail

      • index

        protected int index
        Index of the node in the graph
      • distance

        protected double distance
        Distance according to other node
      • heuristicInfo

        protected double heuristicInfo
        Heuristic information
    • Constructor Detail

      • Node

        public Node​(int index,
                    double distance,
                    double heuristicInfo)
        Constructor. Allocates the basic information of a node.
        Parameters:
        index - index of the node
        distance - distance according to another node
        heuristicInfo - heuristic information
    • Method Detail

      • compareTo

        public int compareTo​(Node n)
        Implements Comparable interface. Compares two nodes.
        Specified by:
        compareTo in interface java.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:
        toString in class java.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