Esempio n. 1
0
    /// Creation ///
    // Nodes ---
    ANNGraphicNode CreateGNode(ANNNode n)
    {
        if (n == null)
        {
            return(null);
        }
        GUIStyle style = new GUIStyle();

        if (n.GetLayerOrder() == (int)ANNLayerOrders.Input)
        {
            style = inStyle;
        }
        else if (n.GetLayerOrder() == (int)ANNLayerOrders.Output)
        {
            style = outStyle;
        }
        else
        {
            style = hdnStyle;
        }
        ANNGraphicNode gnode = new ANNGraphicNode(n, new Vector2(0, 0), nodeScale.x, nodeScale.y, style);

        gNodes.Add(gnode);
        return(gnode);
    }
Esempio n. 2
0
    // Connections ---
    private ANNGraphicConnection CreateGCon(ANNConnection c, ANNGraphicNode ingn, ANNGraphicNode outgn)
    {
        if (c == null || ingn == null || outgn == null)
        {
            return(null);
        }
        ANNGraphicConnection gc = new ANNGraphicConnection(c, ingn, outgn);

        gCons.Add(gc);
        return(gc);
    }
Esempio n. 3
0
    /// Updates ///
    public void UpdateGraphics()
    {
        if (network == null)
        {
            Debug.LogWarning(this.name + " => Trying to UpdateGraphics() with 'null' network reference");
            return;
        }
        gNodes.Clear();
        gCons.Clear();
        List <ANNNode>       closedNodes = new List <ANNNode>();
        List <ANNConnection> closedCons  = new List <ANNConnection>();

        foreach (ANNNode n in network.nodeList)
        {
            ANNGraphicNode gnodeA = null;
            if (IsInClosedNodes(n, closedNodes) == false)
            {
                closedNodes.Add(n);
                gnodeA = CreateGNode(n);
            }
            foreach (ANNConnection c in n.outputConnections)
            {
                ANNGraphicNode gnodeB = null;
                if (c.outNode == null)
                {
                    continue;
                }
                if (IsInClosedNodes(c.outNode, closedNodes) == false)
                {
                    closedNodes.Add(c.outNode);
                    gnodeB = CreateGNode(c.outNode);
                }
                if (IsInClosedCons(c, closedCons) == false)
                {
                    closedCons.Add(c);
                    if (gnodeA == null)
                    {
                        gnodeA = GetGNodeByNeuralNode(n);
                    }
                    if (gnodeB == null)
                    {
                        gnodeB = GetGNodeByNeuralNode(c.outNode);
                    }
                    CreateGCon(c, gnodeB, gnodeA);
                }
            }
        }
    }
Esempio n. 4
0
 public ANNGraphicConnection(ANNConnection c, ANNGraphicNode inp, ANNGraphicNode outp)
 {
     con = c;  inGNode = inp; outGNode = outp;
 }