C# Класс SharpNeat.Network.NetworkXmlIO

Static class for reading and writing Network Definitions(s) to and from XML.
Показать файл Открыть проект

Открытые методы

Метод Описание
GetActivationFunction ( string name ) : IActivationFunction

Gets an IActivationFunction from its short name.

GetNodeType ( string type ) : NodeType

Gets the NodeType for the specified node type string. Note. we use our own type strings in place of Enum.ToString() to provide more compact XML.

GetNodeTypeString ( NodeType nodeType ) : string

Gets the node type string for the specified NodeType. Note. we use our own type strings in place of Enum.ToString() to provide more compact XML.

LoadCompleteGenomeList ( XmlNode xmlNode, bool nodeFnIds ) : List

Reads a list of NetworkDefinition(s) from XML that has a containing 'Root' element. The root element also contains the activation function library that the network definitions are associated with.

ReadActivationFunctionLibrary ( XmlReader xr ) : IActivationFunctionLibrary

Reads an IActivationFunctionLibrary from the provided XmlReader.

ReadAttributeAsNodeType ( XmlReader xr, string attrName ) : NodeType

Read the named attribute and parse its string value as a NodeType.

ReadCompleteNetworkDefinitionList ( XmlReader xr, bool nodeFnIds ) : List

Reads a list of NetworkDefinition(s) from XML that has a containing 'Root' element. The root element also contains the activation function library that the genomes are associated with.

ReadGenome ( XmlNode xmlNode, IActivationFunctionLibrary activationFnLib, bool nodeFnIds ) : NetworkDefinition

Reads a NetworkDefinition from XML.

ReadNetworkDefinition ( XmlReader xr, IActivationFunctionLibrary activationFnLib, bool nodeFnIds ) : NetworkDefinition

Reads a network definition from XML. An activation function library is required to decode the function ID at each node, typically the library is stored alongside the network definition XML and will have already been read elsewhere and passed in here.

Save ( NetworkDefinition networkDef, bool nodeFnIds ) : XmlDocument

Writes a single NetworkDefinition to XML. The XML is returned as a newly created XmlDocument.

SaveComplete ( IList networkDefList, bool nodeFnIds ) : XmlDocument

Writes a list of NetworkDefinition(s) to XML within a containing 'Root' element and the activation function library that the genomes are associated with. The XML is returned as a newly created XmlDocument.

SaveComplete ( NetworkDefinition networkDef, bool nodeFnIds ) : XmlDocument

Writes a single NetworkDefinition to XML within a containing 'Root' element and the activation function library that the genome is associated with. The XML is returned as a newly created XmlDocument.

Write ( XmlWriter xw, IActivationFunctionLibrary activationFnLib ) : void

Writes an activation function library to XML. This links activation function names to the integer IDs used by network nodes, which allows us emit just the ID for each node thus resulting in XML that is more compact compared to emitting the activation function name for each node.

Write ( XmlWriter xw, INetworkDefinition networkDef, bool nodeFnIds ) : void

Writes an INetworkDefinition to XML.

WriteComplete ( XmlWriter xw, IList networkDefList, bool nodeFnIds ) : void

Writes a list of INetworkDefinition(s) to XML within a containing 'Root' element and the activation function library that the genomes are associated with.

WriteComplete ( XmlWriter xw, IList networkDefList, bool nodeFnIds ) : void

Writes a list of INetworkDefinition(s) to XML within a containing 'Root' element and the activation function library that the genomes are associated with.

WriteComplete ( XmlWriter xw, INetworkDefinition networkDef, bool nodeFnIds ) : void

Writes a single INetworkDefinition to XML within a containing 'Root' element and the activation function library that the genome is associated with.

Приватные методы

Метод Описание
NormalizeSelectionProbabilities ( IList fnList ) : void

Normalize the selection probabilities of the provided ActivationFunctionInfo items.

Описание методов

GetActivationFunction() публичный статический Метод

Gets an IActivationFunction from its short name.
public static GetActivationFunction ( string name ) : IActivationFunction
name string
Результат IActivationFunction

GetNodeType() публичный статический Метод

Gets the NodeType for the specified node type string. Note. we use our own type strings in place of Enum.ToString() to provide more compact XML.
public static GetNodeType ( string type ) : NodeType
type string
Результат NodeType

GetNodeTypeString() публичный статический Метод

Gets the node type string for the specified NodeType. Note. we use our own type strings in place of Enum.ToString() to provide more compact XML.
public static GetNodeTypeString ( NodeType nodeType ) : string
nodeType NodeType
Результат string

LoadCompleteGenomeList() публичный статический Метод

Reads a list of NetworkDefinition(s) from XML that has a containing 'Root' element. The root element also contains the activation function library that the network definitions are associated with.
public static LoadCompleteGenomeList ( XmlNode xmlNode, bool nodeFnIds ) : List
xmlNode System.Xml.XmlNode The XmlNode to read from. This can be an XmlDocument or XmlElement.
nodeFnIds bool Indicates if node activation function IDs should be read. If false then /// all node activation function IDs default to 0.
Результат List

ReadActivationFunctionLibrary() публичный статический Метод

Reads an IActivationFunctionLibrary from the provided XmlReader.
public static ReadActivationFunctionLibrary ( XmlReader xr ) : IActivationFunctionLibrary
xr XmlReader
Результат IActivationFunctionLibrary

ReadAttributeAsNodeType() публичный статический Метод

Read the named attribute and parse its string value as a NodeType.
public static ReadAttributeAsNodeType ( XmlReader xr, string attrName ) : NodeType
xr XmlReader
attrName string
Результат NodeType

ReadCompleteNetworkDefinitionList() публичный статический Метод

Reads a list of NetworkDefinition(s) from XML that has a containing 'Root' element. The root element also contains the activation function library that the genomes are associated with.
public static ReadCompleteNetworkDefinitionList ( XmlReader xr, bool nodeFnIds ) : List
xr XmlReader The XmlReader to read from.
nodeFnIds bool Indicates if node activation function IDs should be read. They are required /// for HyperNEAT genomes but not NEAT
Результат List

ReadGenome() публичный статический Метод

Reads a NetworkDefinition from XML.
public static ReadGenome ( XmlNode xmlNode, IActivationFunctionLibrary activationFnLib, bool nodeFnIds ) : NetworkDefinition
xmlNode System.Xml.XmlNode The XmlNode to read from. This can be an XmlDocument or XmlElement.
activationFnLib IActivationFunctionLibrary The activation function library used to decode node activation function IDs.
nodeFnIds bool Indicates if node activation function IDs should be read. They are required /// for HyperNEAT genomes but not for NEAT. If false then all node activation function IDs default to 0.
Результат NetworkDefinition

ReadNetworkDefinition() публичный статический Метод

Reads a network definition from XML. An activation function library is required to decode the function ID at each node, typically the library is stored alongside the network definition XML and will have already been read elsewhere and passed in here.
public static ReadNetworkDefinition ( XmlReader xr, IActivationFunctionLibrary activationFnLib, bool nodeFnIds ) : NetworkDefinition
xr XmlReader The XmlReader to read from.
activationFnLib IActivationFunctionLibrary The activation function library used to decode node activation function IDs.
nodeFnIds bool Indicates if node activation function IDs should be read. They are required /// for HyperNEAT genomes but not NEAT
Результат NetworkDefinition

Save() публичный статический Метод

Writes a single NetworkDefinition to XML. The XML is returned as a newly created XmlDocument.
public static Save ( NetworkDefinition networkDef, bool nodeFnIds ) : XmlDocument
networkDef NetworkDefinition The genome to save.
nodeFnIds bool Indicates if node activation function IDs should be emitted. They are required /// for HyperNEAT genomes but not for NEAT.
Результат System.Xml.XmlDocument

SaveComplete() публичный статический Метод

Writes a list of NetworkDefinition(s) to XML within a containing 'Root' element and the activation function library that the genomes are associated with. The XML is returned as a newly created XmlDocument.
public static SaveComplete ( IList networkDefList, bool nodeFnIds ) : XmlDocument
networkDefList IList List of genomes to write as XML.
nodeFnIds bool Indicates if node activation function IDs should be emitted. They are required /// for HyperNEAT genomes but not for NEAT.
Результат System.Xml.XmlDocument

SaveComplete() публичный статический Метод

Writes a single NetworkDefinition to XML within a containing 'Root' element and the activation function library that the genome is associated with. The XML is returned as a newly created XmlDocument.
public static SaveComplete ( NetworkDefinition networkDef, bool nodeFnIds ) : XmlDocument
networkDef NetworkDefinition The NetworkDefinition to save.
nodeFnIds bool Indicates if node activation function IDs should be emitted. They are required /// for HyperNEAT genomes but not for NEAT.
Результат System.Xml.XmlDocument

Write() публичный статический Метод

Writes an activation function library to XML. This links activation function names to the integer IDs used by network nodes, which allows us emit just the ID for each node thus resulting in XML that is more compact compared to emitting the activation function name for each node.
public static Write ( XmlWriter xw, IActivationFunctionLibrary activationFnLib ) : void
xw System.Xml.XmlWriter
activationFnLib IActivationFunctionLibrary
Результат void

Write() публичный статический Метод

Writes an INetworkDefinition to XML.
public static Write ( XmlWriter xw, INetworkDefinition networkDef, bool nodeFnIds ) : void
xw System.Xml.XmlWriter XmlWriter to write XML to.
networkDef INetworkDefinition Network definition to write as XML.
nodeFnIds bool Indicates if node activation function IDs should be emitted. They are required /// for HyperNEAT genomes but not for NEAT.
Результат void

WriteComplete() публичный статический Метод

Writes a list of INetworkDefinition(s) to XML within a containing 'Root' element and the activation function library that the genomes are associated with.
public static WriteComplete ( XmlWriter xw, IList networkDefList, bool nodeFnIds ) : void
xw System.Xml.XmlWriter XmlWriter to write XML to.
networkDefList IList List of network definitions to write as XML.
nodeFnIds bool Indicates if node activation function IDs should be emitted. They are required /// for HyperNEAT genomes but not for NEAT.
Результат void

WriteComplete() публичный статический Метод

Writes a list of INetworkDefinition(s) to XML within a containing 'Root' element and the activation function library that the genomes are associated with.
public static WriteComplete ( XmlWriter xw, IList networkDefList, bool nodeFnIds ) : void
xw System.Xml.XmlWriter XmlWriter to write XML to.
networkDefList IList List of network definitions to write as XML.
nodeFnIds bool Indicates if node activation function IDs should be emitted. They are required /// for HyperNEAT genomes but not for NEAT.
Результат void

WriteComplete() публичный статический Метод

Writes a single INetworkDefinition to XML within a containing 'Root' element and the activation function library that the genome is associated with.
public static WriteComplete ( XmlWriter xw, INetworkDefinition networkDef, bool nodeFnIds ) : void
xw System.Xml.XmlWriter XmlWriter to write XML to.
networkDef INetworkDefinition Network definition to write as XML.
nodeFnIds bool Indicates if node activation function IDs should be emitted. They are required /// for HyperNEAT genomes but not for NEAT.
Результат void