Class ContiguousNeatNodeLayout

java.lang.Object
net.bmahe.genetics4j.neat.spec.ContiguousNeatNodeLayout
All Implemented Interfaces:
NeatNodeLayout

public class ContiguousNeatNodeLayout extends Object implements NeatNodeLayout
Node layout using the traditional contiguous NEAT external IDs.

Inputs occupy [0, numInputs) and outputs occupy [numInputs, numInputs + numOutputs). The configured hidden-node range must not overlap those external IDs.

  • Field Details

    • numInputs

      private final int numInputs
    • numOutputs

      private final int numOutputs
    • hiddenNodeIdStartInclusive

      private final long hiddenNodeIdStartInclusive
    • hiddenNodeIdEndExclusive

      private final long hiddenNodeIdEndExclusive
  • Constructor Details

    • ContiguousNeatNodeLayout

      public ContiguousNeatNodeLayout(int _numInputs, int _numOutputs, long _hiddenNodeIdStartInclusive, long _hiddenNodeIdEndExclusive)
      Creates a contiguous node layout.
      Parameters:
      _numInputs - number of input nodes; must be positive
      _numOutputs - number of output nodes; must be positive
      _hiddenNodeIdStartInclusive - inclusive hidden-node range start
      _hiddenNodeIdEndExclusive - exclusive hidden-node range end
      Throws:
      IllegalArgumentException - if the counts or hidden-node range are invalid, or if the ranges overlap
  • Method Details

    • numInputs

      public int numInputs()
      Specified by:
      numInputs in interface NeatNodeLayout
      Returns:
      the number of declared input nodes
    • numOutputs

      public int numOutputs()
      Specified by:
      numOutputs in interface NeatNodeLayout
      Returns:
      the number of declared output nodes
    • hiddenNodeIdStartInclusive

      public long hiddenNodeIdStartInclusive()
      Description copied from interface: NeatNodeLayout
      Returns the first ID reserved for hidden nodes.
      Specified by:
      hiddenNodeIdStartInclusive in interface NeatNodeLayout
      Returns:
      the inclusive hidden-node range start
    • hiddenNodeIdEndExclusive

      public long hiddenNodeIdEndExclusive()
      Description copied from interface: NeatNodeLayout
      Returns the exclusive end of the hidden-node namespace.
      Specified by:
      hiddenNodeIdEndExclusive in interface NeatNodeLayout
      Returns:
      the exclusive hidden-node range end
    • inputNodeIds

      public List<Integer> inputNodeIds()
      Description copied from interface: NeatNodeLayout
      Returns input node IDs in external vector order.
      Specified by:
      inputNodeIds in interface NeatNodeLayout
      Returns:
      an ordered, non-empty list of input node IDs
    • outputNodeIds

      public List<Integer> outputNodeIds()
      Description copied from interface: NeatNodeLayout
      Returns output node IDs in external vector order.
      Specified by:
      outputNodeIds in interface NeatNodeLayout
      Returns:
      an ordered, non-empty list of output node IDs
    • isInput

      public boolean isInput(int nodeId)
      Description copied from interface: NeatNodeLayout
      Tests whether an ID identifies an input node.
      Specified by:
      isInput in interface NeatNodeLayout
      Parameters:
      nodeId - node ID to test
      Returns:
      true when the ID is a declared input
    • isOutput

      public boolean isOutput(int nodeId)
      Description copied from interface: NeatNodeLayout
      Tests whether an ID identifies an output node.
      Specified by:
      isOutput in interface NeatNodeLayout
      Parameters:
      nodeId - node ID to test
      Returns:
      true when the ID is a declared output
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object