com.anji.neat
Class NeatIdMap

java.lang.Object
  extended bycom.anji.neat.NeatIdMap

public class NeatIdMap
extends java.lang.Object

Extension of JGAP configuration with NEAT-specific features added.

Author:
Philip Tucker

Field Summary
static java.lang.String CONNECTION_ID_MAP_XML_TAG
          XML tag for NEAT ID mapping,connection ID
static java.lang.String CONNECTION_ID_XML_TAG
          XML tag for NEAT ID mapping, connection ID
static java.lang.String CONNECTION_TO_CONNECTION_XML_TAG
          XML tag for NEAT ID mapping, connection
static java.lang.String CONNECTION_TO_NEURON_XML_TAG
          XML tag for NEAT ID mapping, neuron
static java.lang.String DEST_NEURON_ID_XML_TAG
          XML tag for NEAT ID mapping, destination neuron ID
static java.lang.String ID_XML_TAG
          XML tag for NEAT ID mapping, innovation ID
static java.lang.String NEAT_ID_MAP_FILE_KEY
          properties key, file containing mappings of NEAT innovation IDs
static java.lang.String NEAT_ID_MAP_XML_TAG
          base XML tag for NEAT ID mapping
static java.lang.String NEURON_ID_MAP_XML_TAG
          XML tag for NEAT ID mapping, neuron ID
static java.lang.String SRC_NEURON_ID_XML_TAG
          XML tag for NEAT ID mapping, source neuron ID
 
Constructor Summary
NeatIdMap(Properties newProps)
          See Parameter Details for specific property settings.
 
Method Summary
protected  java.util.List buildList(java.lang.Long srcNeuronId, java.lang.Long destNeuronId)
          creates list used us key between src/dest neuron pairs and connection
 java.lang.Long findConnectionId(java.lang.Long srcNeuronId, java.lang.Long destNeuronId)
           
 java.lang.Long findNeuronId(java.lang.Long connectionId)
           
 void load()
          Load ID factories and maps.
 void log(org.apache.log4j.Logger aLogger, org.apache.log4j.Priority pri)
          log stats for id maps
protected  void putConnectionId(java.lang.Long srcNeuronId, java.lang.Long destNeuronId, java.lang.Long newConnectionId)
          store mapping between neurons srcNeuronId and destNeuronId and the connection that mutated between them via NEAT add connection mutation, newConnectionId
protected  void putNeuronId(java.lang.Long connectionId, java.lang.Long newNeuronId)
          store mapping between connection connectionId and the neuron that replaced it via NEAT add neuron mutation, newNeuronId
 boolean store()
          Persist ID factories and maps.
 java.lang.String toXml()
          Convert NEAT ID mappings (enables re-use of innovation IDs) to XML string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NEAT_ID_MAP_FILE_KEY

public static final java.lang.String NEAT_ID_MAP_FILE_KEY
properties key, file containing mappings of NEAT innovation IDs

See Also:
Constant Field Values

NEAT_ID_MAP_XML_TAG

public static final java.lang.String NEAT_ID_MAP_XML_TAG
base XML tag for NEAT ID mapping

See Also:
Constant Field Values

NEURON_ID_MAP_XML_TAG

public static final java.lang.String NEURON_ID_MAP_XML_TAG
XML tag for NEAT ID mapping, neuron ID

See Also:
Constant Field Values

CONNECTION_ID_MAP_XML_TAG

public static final java.lang.String CONNECTION_ID_MAP_XML_TAG
XML tag for NEAT ID mapping,connection ID

See Also:
Constant Field Values

CONNECTION_TO_NEURON_XML_TAG

public static final java.lang.String CONNECTION_TO_NEURON_XML_TAG
XML tag for NEAT ID mapping, neuron

See Also:
Constant Field Values

ID_XML_TAG

public static final java.lang.String ID_XML_TAG
XML tag for NEAT ID mapping, innovation ID

See Also:
Constant Field Values

CONNECTION_ID_XML_TAG

public static final java.lang.String CONNECTION_ID_XML_TAG
XML tag for NEAT ID mapping, connection ID

See Also:
Constant Field Values

CONNECTION_TO_CONNECTION_XML_TAG

public static final java.lang.String CONNECTION_TO_CONNECTION_XML_TAG
XML tag for NEAT ID mapping, connection

See Also:
Constant Field Values

SRC_NEURON_ID_XML_TAG

public static final java.lang.String SRC_NEURON_ID_XML_TAG
XML tag for NEAT ID mapping, source neuron ID

See Also:
Constant Field Values

DEST_NEURON_ID_XML_TAG

public static final java.lang.String DEST_NEURON_ID_XML_TAG
XML tag for NEAT ID mapping, destination neuron ID

See Also:
Constant Field Values
Constructor Detail

NeatIdMap

public NeatIdMap(Properties newProps)
See Parameter Details for specific property settings.

Parameters:
newProps -
See Also:
NeatIdMap#init(Properties)
Method Detail

findNeuronId

public java.lang.Long findNeuronId(java.lang.Long connectionId)
Parameters:
connectionId -
Returns:
return id of previous neuron, if any, that mutated on connection connectionId

findConnectionId

public java.lang.Long findConnectionId(java.lang.Long srcNeuronId,
                                       java.lang.Long destNeuronId)
Parameters:
srcNeuronId -
destNeuronId -
Returns:
return id of previous connection, if any, that mutated from neuron srcNeuronId to neuron destNeuronId

putNeuronId

protected void putNeuronId(java.lang.Long connectionId,
                           java.lang.Long newNeuronId)
store mapping between connection connectionId and the neuron that replaced it via NEAT add neuron mutation, newNeuronId

Parameters:
connectionId -
newNeuronId -

putConnectionId

protected void putConnectionId(java.lang.Long srcNeuronId,
                               java.lang.Long destNeuronId,
                               java.lang.Long newConnectionId)
store mapping between neurons srcNeuronId and destNeuronId and the connection that mutated between them via NEAT add connection mutation, newConnectionId

Parameters:
srcNeuronId -
destNeuronId -
newConnectionId -

buildList

protected java.util.List buildList(java.lang.Long srcNeuronId,
                                   java.lang.Long destNeuronId)
creates list used us key between src/dest neuron pairs and connection

Parameters:
srcNeuronId -
destNeuronId -
Returns:
List contains Long objects

load

public void load()
          throws java.io.IOException
Load ID factories and maps.

Throws:
java.io.IOException

store

public boolean store()
              throws java.io.IOException
Persist ID factories and maps.

Returns:
true if file is stored
Throws:
java.io.IOException

toXml

public java.lang.String toXml()
Convert NEAT ID mappings (enables re-use of innovation IDs) to XML string.

Returns:
XML string

log

public void log(org.apache.log4j.Logger aLogger,
                org.apache.log4j.Priority pri)
log stats for id maps

Parameters:
aLogger -
pri -