Class ContiguousNeatNodeLayout
java.lang.Object
net.bmahe.genetics4j.neat.spec.ContiguousNeatNodeLayout
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final longprivate final longprivate final intprivate final intFields inherited from interface NeatNodeLayout
MAX_NODE_ID_EXCLUSIVE -
Constructor Summary
ConstructorsConstructorDescriptionContiguousNeatNodeLayout(int _numInputs, int _numOutputs, long _hiddenNodeIdStartInclusive, long _hiddenNodeIdEndExclusive) Creates a contiguous node layout. -
Method Summary
Modifier and TypeMethodDescriptionbooleaninthashCode()longReturns the exclusive end of the hidden-node namespace.longReturns the first ID reserved for hidden nodes.Returns input node IDs in external vector order.booleanisInput(int nodeId) Tests whether an ID identifies an input node.booleanisOutput(int nodeId) Tests whether an ID identifies an output node.intintReturns output node IDs in external vector order.toString()Methods inherited from interface NeatNodeLayout
isCompatibleWith, isExternal, isHidden
-
Field Details
-
numInputs
private final int numInputs -
numOutputs
private final int numOutputs
-
-
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:
numInputsin interfaceNeatNodeLayout- Returns:
- the number of declared input nodes
-
numOutputs
public int numOutputs()- Specified by:
numOutputsin interfaceNeatNodeLayout- Returns:
- the number of declared output nodes
-
inputNodeIds
Description copied from interface:NeatNodeLayoutReturns input node IDs in external vector order.- Specified by:
inputNodeIdsin interfaceNeatNodeLayout- Returns:
- an ordered, non-empty list of input node IDs
-
outputNodeIds
Description copied from interface:NeatNodeLayoutReturns output node IDs in external vector order.- Specified by:
outputNodeIdsin interfaceNeatNodeLayout- Returns:
- an ordered, non-empty list of output node IDs
-
isInput
public boolean isInput(int nodeId) Description copied from interface:NeatNodeLayoutTests whether an ID identifies an input node.- Specified by:
isInputin interfaceNeatNodeLayout- Parameters:
nodeId- node ID to test- Returns:
truewhen the ID is a declared input
-
isOutput
public boolean isOutput(int nodeId) Description copied from interface:NeatNodeLayoutTests whether an ID identifies an output node.- Specified by:
isOutputin interfaceNeatNodeLayout- Parameters:
nodeId- node ID to test- Returns:
truewhen the ID is a declared output
-
hashCode
-
equals
-
toString
-