private void OutputSaveValueNodes()
        {
            var nodes = GraphNodeContext.GetNodes().Where(n => n.IsMonitoring);

            foreach (var node in nodes)
            {
                Console.Write(node.NodeName + "==>");
                Utils.Utils.DisplayListList(node.ComputedResults);
            }
        }
 private void SetInputs2Node(Dictionary <string, double[]> inputs)
 {
     foreach (var k in inputs)
     {
         foreach (var n in GraphNodeContext.GetNodes())
         {
             if (n.GetType().Equals(typeof(InputNode)))
             {
                 InputNode iNode = n as InputNode;
                 if (iNode.NodeName == k.Key)
                 {
                     iNode.InputData = k.Value.ToList();
                 }
             }
         }
     }
 }
        public void Execute(Dictionary <string, double[]> inputs)
        {
            GraphNodeContext.GetNodes().ForEach(n => n.IsProcessed     = false);
            GraphNodeContext.GetNodes().ForEach(n => n.IsWalked        = false);
            GraphNodeContext.GetNodes().ForEach(n => n.ComputedResults = null);

            SetInputs2Node(inputs);

            while (HasUnProcessedNodes())
            {
                foreach (var node in GraphNodeContext.GetNodes())
                {
                    VisitNode(node);
                }
            }

            OutputSaveValueNodes();
        }
예제 #4
0
        private List <string> ParseDirections()
        {
            List <string> lst = new List <string>();

            foreach (var node in GraphNodeContext.GetNodes())
            {
                lst.AddRange(ParseDirections(node));
            }

            //foreach (var node in savableNodes)
            //    lst.Add(string.Format("\"{0}\"[color=orange]", node.Name));

            //foreach (var node in graphHeaders)
            //    lst.Add(string.Format("\"{0}\"[color=lightblue]", node.Name));

            //foreach (var node in allNodes)
            //    if (!graphHeaders.Contains(node))
            //        if (node.Value != null)
            //            lst.Add(string.Format("\"{0}\"[color=yellow]", node.Name));

            return(lst);
        }
 private bool HasUnProcessedNodes()
 {
     return(GraphNodeContext.GetNodes().Count(n => !n.IsProcessed || !n.IsWalked) > 0);
 }