public void SelectNodeView(MyNode node)
        {
            Node nodeView = Desktop.Nodes.First(nw => (nw as MyNodeView).Node == node);

            if (nodeView != null)
                Desktop.FocusElement = nodeView;
        }
Example #2
0
 public void AssertInfo(bool result, MyNode sender, string failMessage)
 {
     if (!result)
     {
         AddMessage(MyValidationLevel.INFO, failMessage, sender);
     }
 }
Example #3
0
 public void AssertWarning(bool result, MyNode sender, string failMessage)
 {
     if (!result)
     {
         AddMessage(MyValidationLevel.WARNING, failMessage, sender);
     }
 }
        public void AddingNodesUpdatesCount()
        {
            MyNode node = new MyNode();
            rootNode.AddNode(node);

            Assert.AreEqual(1, rootNode.Nodes.Count);
        }
 public void AddTest()
 {
     MyNode node = new MyNode();
     rootNode.Nodes.Add(node);
     Assert.AreEqual(1, rootNode.Nodes.Count);
     Assert.AreSame(node, rootNode.Nodes[0]);
 }
 public void ClearTest()
 {
     MyNode[] localNodes = new MyNode[] {new MyNode(), new MyNode()};
     rootNode.Nodes.AddRange(localNodes);
     Assert.AreEqual(2, rootNode.Nodes.Count);
     rootNode.Nodes.Clear();
     Assert.AreEqual(0, rootNode.Nodes.Count);
 }
 public void IndexOfTest()
 {
     MyNode[] localNodes = new MyNode[] {new MyNode(), new MyNode()};
     rootNode.Nodes.AddRange(localNodes);
     Assert.AreEqual(2, rootNode.Nodes.Count);
     int index = rootNode.Nodes.IndexOf(localNodes[1]);
     Assert.AreEqual(localNodes[1].Index, index);
 }
Example #8
0
 public void AssertError(bool result, MyNode sender, string failMessage)
 {
     if (!result)
     {
         ValidationSucessfull = false;
         AddMessage(MyValidationLevel.ERROR, failMessage, sender);
     }
 }
 public void ContainsTest()
 {
     MyNode[] localNodes = new MyNode[] {new MyNode(), new MyNode()};
     rootNode.Nodes.AddRange(localNodes);
     Assert.AreEqual(2, rootNode.Nodes.Count);
     Assert.AreEqual(true, rootNode.Nodes.Contains(localNodes[0]));
     Assert.AreEqual(true, rootNode.Nodes.Contains(localNodes[1]));
     Assert.AreEqual(false, rootNode.Nodes.Contains(new MyNode()));
 }
Example #10
0
        public ObserverForm(MainForm mainForm, MyAbstractObserver observer, MyNode declaredOwner)
        {
            InitializeComponent();
            m_mainForm = mainForm;

            Observer = observer;
            observer.TriggerReset();

            Text = MyProject.ShortenNodeTypeName(observer.GetType()) + ": " + observer.GetTargetName(declaredOwner);
        }
Example #11
0
        public ObserverForm(MainForm mainForm, MyAbstractObserver observer, MyNode declaredOwner)
        {
            InitializeComponent();
            m_mainForm = mainForm;

            Observer = observer;
            observer.TriggerReset();

            Text = observer.GetTargetName(declaredOwner);
        }
        public void EnsureCanGetNodeByIndex()
        {
            MyNode nodeToCompare = new MyNode();
            rootNode.AddNode(new MyNode());
            rootNode.AddNode(nodeToCompare);
            rootNode.AddNode(new MyNode());

            MyNode foundNode = (MyNode)rootNode.Nodes[1];

            Assert.AreSame(nodeToCompare, foundNode);
        }
 public override void SetUp()
 {
     base.SetUp();
     parent = new MyNode();
     GeneratedApplicationNode.Nodes.Add(parent);
     parent.Name = "node";
     child = new MyNode();
     parent.Nodes.Add(child);
     parent.Name = "child";
     e = new ConfigurationNodeChangedEventArgs(Action, child, child.Parent);
 }
        public void EnsureCanGetANodeByName()
        {
            MyNode nodeToGet = new MyNode();
            nodeToGet.Name = "NodeName";
            rootNode.AddNode(new MyNode());
            rootNode.AddNode(nodeToGet);
            rootNode.AddNode(new MyNode());

            MyNode foundNode = (MyNode)rootNode.Nodes["NodeName"];

            Assert.AreSame(nodeToGet, foundNode);
        }
 public static void ClearTempData(MyNode node)
 {
     if (TempDataExists(node))
     {
         Directory.Delete(GetTempStorage(node.Owner) + "\\" + GetNodeFolder(node), true);
         MyLog.INFO.WriteLine(node.Name + ": Temporal data deleted.");
     }
     else
     {
         MyLog.WARNING.WriteLine(node.Name + ": No temporal data to delete.");
     }
 }
Example #16
0
        public override ArrayList GetNivelLocalizacao(long NivelID, long TrusteeID, IDbConnection conn)
		{
			SqlDataReader reader = CalculateNivelLocalizacao(NivelID, TrusteeID, conn);

			ArrayList result = new ArrayList();
			MyNode node;
			while (reader.Read())
			{
				node = new MyNode();
				node.IDNivel = System.Convert.ToInt64(reader.GetValue(0));
				if (reader.GetValue(1) != DBNull.Value)
					node.IDNivelUpper = System.Convert.ToInt64(reader.GetValue(1));
                node.Age = System.Convert.ToInt32(reader.GetValue(2));
				node.TipoNivelRelacionado = System.Convert.ToInt64(reader.GetValue(3));
				node.TipoNivel = reader.GetValue(4).ToString();
				node.Designacao = reader.GetValue(5).ToString();
                node.AnoInicio = reader.GetValue(6).ToString();
                node.AnoFim = reader.GetValue(7).ToString();

				result.Add(node);
			}
			reader.Close();

			return result;
		}
 public DashboardNodeProperty(MyNode node, PropertyInfo propertyInfo)
 {
     Node = node;
     PropertyInfo = propertyInfo;
 }
Example #18
0
 /** Initialize your data structure here. */
 public Solution()
 {
     Head = null;
 }
Example #19
0
 private bool TryAddChildNode(MyNode newNode)
 {
     try
     {
         Target.AddChild(newNode);
         return true;
     }
     catch (Exception e)
     {
         MyLog.ERROR.WriteLine("Failed to add node: " + e.Message);
         return false;
     }
 }
Example #20
0
 public override string GetTargetName(MyNode declaredOwner)
 {
     return(Target.Name);
 }
Example #21
0
 private void Window_Closed(object sender, EventArgs e)
 {
     MyNode.Close();
 }
Example #22
0
 private static void DestroyNode(MyNode node)
 {
     FreeMemory(node);
     node.Dispose();
 }
Example #23
0
 public void Clear()
 {
     Root = null;
 }
Example #24
0
 public void Setup()
 {
     myFirstNode  = new MyNode(56);
     mySecondNode = new MyNode(30);
     myThirdNode  = new MyNode(70);
 }
Example #25
0
 public MyOutgoingSignalTask(MyNode node) : base(node)
 {
 }
Example #26
0
 public MyIncomingSignalTask(MyNode node) : base(node)
 {
 }
Example #27
0
 public MySignalTask(MyNode node)
 {
     m_node = node;
 }
 public static bool TempDataExists(MyNode node)
 {
     return Directory.Exists(GetTempStorage(node.Owner) + "\\" + GetNodeFolder(node));
 }
Example #29
0
 public void AddInfo(MyNode sender, string message)
 {
     AssertInfo(false, sender, message);
 }
Example #30
0
 private void ValidateNode(MyNode node)
 {
     node.ValidateMandatory(Validator);
     node.Validate(Validator);
 }
 public static bool sameNode(MyNode p1, MyNode p2)
 {
     return(Math.Abs(p1.X - p2.X) < 0.01 && Math.Abs(p1.Y - p2.Y) < 0.01);
 }
Example #32
0
 private static void AllocateNode(MyNode node)
 {
     // TODO(HonzaS): Does the allocation need to be done in a separate loop?
     MyMemoryManager.Instance.AllocateBlocks(node, false);
 }
Example #33
0
 public abstract string GetTargetName(MyNode declaredOwner);
Example #34
0
        static void Main(string[] args)
        {
            #region Create Instance - Input - Insert - Properties
            // Create New Instace of Class MyBinaryTree
            MyBinaryTree myTree = new MyBinaryTree();

            //Input
            //myTree.Input();
            //Insert
            myTree.Insert(25);
            myTree.Insert(15);
            myTree.Insert(50);
            myTree.Insert(10);
            myTree.Insert(22);
            myTree.Insert(35);
            myTree.Insert(70);
            myTree.Insert(4);
            myTree.Insert(12);
            myTree.Insert(18);
            myTree.Insert(24);
            myTree.Insert(31);
            myTree.Insert(44);
            myTree.Insert(66);
            myTree.Insert(90);

            // Test 2 properties
            Console.WriteLine("Count: {0} ", myTree.Count);
            Console.WriteLine("Height: {0}", myTree.Height);

            #endregion

            #region Method - Exer 4 & 5

            /* Duyệt cây */
            Console.Write("LNR: ");
            myTree.InOrder();
            Console.WriteLine();

            Console.Write("NLR: ");
            myTree.PreOrder();
            Console.WriteLine();

            Console.Write("LRN: ");
            myTree.PostOrder();
            Console.WriteLine();

            // Số lượng lá trong cây
            Console.WriteLine("Number Of Leafs In Tree: {0}", myTree.CountLeaf(myTree.Root));
            // In ra các giá trị của node theo từng mức
            myTree.ListByLevel();
            // In ra các giá trị của node ở mức cuối cùng của cây
            myTree.ListLastLevel();

            /*Tìm Node có trong cây không ? */
            MyNode node = new MyNode(10);
            MyNode temp = new MyNode();
            temp = myTree.SearchNode(node.Data);
            if (temp != null)
            {
                Console.WriteLine("FOUND " + temp.Data);
            }
            else
            {
                Console.WriteLine("NOT FOUND");
            }

            /* Min-Max Node của cây */
            MyNode maxNode = new MyNode();
            MyNode minNode = new MyNode();
            maxNode = myTree.MaxNode();
            minNode = myTree.MinNode();
            if (maxNode != null)
            {
                Console.WriteLine("Max Node -> " + maxNode.Data);
            }
            else
            {
                Console.WriteLine("Node is NULL");
            }

            if (minNode != null)
            {
                Console.WriteLine("Min Node -> " + minNode.Data);
            }
            else
            {
                Console.WriteLine("Node is NULL");
            }

            /* Xóa Node trong cây */
            myTree.Remove(25);
            Console.Write("NLR: ");
            myTree.PreOrder();
            Console.WriteLine();

            #endregion
        }
Example #35
0
 public override void ResponseNode(string content, MyNode node, Ice.Current current)
 {
     Console.Out.WriteLine($"{current.ctx["user_name"]}:{content}    Id:{node.NodeId}   NodeText:{node.NodeText}   ParetnId:{node.ParentId}");
 }
Example #36
0
        public override void Execute()
        {
            if (SimulationStep == 0)
            {
                return;
            }

            switch (Owner.LearningTasks)
            {
            case MyLSTMLayer.LearningTasksType.RTRL:
            {
                // propagate delta to output gates
                m_deltaKernel.Run(
                    Owner.CellStateErrors,
                    Owner.OutputGateDeltas,
                    Owner.CellStates,
                    Owner.OutputGateActivations,
                    Owner.OutputGateActivationDerivatives,
                    Owner.Delta,

                    Owner.CellStates.Count,
                    Owner.CellsPerBlock
                    );
                break;
            }

            case MyLSTMLayer.LearningTasksType.BPTT:
            {
                // propagate delta to output gates
                m_deltaKernel.Run(
                    Owner.Delta,
                    Owner.CellStates,
                    Owner.CellStates.GetTimeShiftedBlock(-1),
                    Owner.CellStateErrors,
                    Owner.CellStateErrors.GetTimeShiftedBlock(+1),

                    Owner.OutputGateDeltas,
                    Owner.ForgetGateDeltas,
                    Owner.ForgetGateDeltas.GetTimeShiftedBlock(+1),
                    Owner.InputGateDeltas,
                    Owner.InputGateDeltas.GetTimeShiftedBlock(+1),
                    Owner.CellInputDeltas,

                    Owner.CellInputActivations,
                    Owner.CellStateActivations,
                    Owner.OutputGateActivations,
                    Owner.ForgetGateActivations.GetTimeShiftedBlock(+1),
                    Owner.InputGateActivations,

                    Owner.CellInputActivationDerivatives,
                    Owner.CellStateActivationDerivatives,
                    Owner.OutputGateActivationDerivatives,
                    Owner.ForgetGateActivationDerivatives,
                    Owner.InputGateActivationDerivatives,

                    Owner.CellInputWeights,
                    Owner.OutputGateWeights,
                    Owner.ForgetGateWeights,
                    Owner.InputGateWeights,

                    Owner.Input.Count,
                    Owner.CellStates.Count,
                    Owner.CellsPerBlock
                    );

                m_gateGradientKernel.Run(
                    Owner.Input,
                    Owner.Output.GetTimeShiftedBlock(-1),
                    Owner.CellStates,

                    Owner.InputGateDeltas,
                    Owner.ForgetGateDeltas,
                    Owner.OutputGateDeltas,

                    Owner.OutputGateWeightGradient,
                    Owner.InputGateWeightGradient,
                    Owner.ForgetGateWeightGradient,

                    Owner.Input.Count,
                    Owner.CellStates.Count,
                    Owner.CellsPerBlock
                    );

                m_cellInputGradientKernel.Run(
                    Owner.Input,
                    Owner.Output.GetTimeShiftedBlock(-1),

                    Owner.CellInputDeltas,
                    Owner.CellInputWeightGradient,

                    Owner.Input.Count,
                    Owner.CellStates.Count,
                    Owner.CellsPerBlock
                    );
                break;
            }
            }

            MyNode node = Owner.GetInput(0).Owner;

            if (node is MyAbstractLayer)
            {
                MyAbstractLayer previousLayer = node as MyAbstractLayer;

                CUdeviceptr prevInputPtr = nullCUdeviceptr;

                // reset delta
                if (Owner.ParentNetwork.TimeStep == 0)
                {
                    previousLayer.Delta.Fill(0);
                }

                // determine input to previous layer
                prevInputPtr = MyAbstractLayer.DetermineInput(previousLayer);

                switch (Owner.LearningTasks)
                {
                case MyLSTMLayer.LearningTasksType.RTRL:
                {
                    // propagate delta to previous layer
                    m_deltaBackKernel.SetupExecution(previousLayer.Neurons);
                    m_deltaBackKernel.Run(
                        (int)previousLayer.ActivationFunction,
                        prevInputPtr,
                        previousLayer.Delta,
                        Owner.CellStateErrors,
                        Owner.PreviousCellStates,
                        Owner.InputGateActivations,
                        Owner.CellInputActivationDerivatives,
                        Owner.InputGateActivationDerivatives,
                        Owner.ForgetGateActivationDerivatives,
                        Owner.CellInputWeights,
                        Owner.InputGateWeights,
                        Owner.ForgetGateWeights,
                        Owner.OutputGateWeights,
                        Owner.OutputGateDeltas,

                        previousLayer.Neurons,
                        Owner.CellStates.Count,
                        Owner.CellsPerBlock
                        );
                    break;
                }

                case MyLSTMLayer.LearningTasksType.BPTT:
                {
                    // propagate delta to previous layer
                    m_deltaBackKernel.SetupExecution(previousLayer.Neurons);
                    m_deltaBackKernel.Run(
                        (int)previousLayer.ActivationFunction,
                        prevInputPtr,
                        previousLayer.Delta,

                        Owner.CellInputDeltas,
                        Owner.OutputGateDeltas,
                        Owner.ForgetGateDeltas,
                        Owner.InputGateDeltas,

                        Owner.CellInputWeights,
                        Owner.InputGateWeights,
                        Owner.ForgetGateWeights,
                        Owner.OutputGateWeights,

                        previousLayer.Neurons,
                        Owner.CellStates.Count,
                        Owner.CellsPerBlock
                        );
                    break;
                }
                }
            }
        }
Example #37
0
        public void Test_Destroy()
        {
            var wld = new MyWorld ("World");
            var node1 = new MyNode ("Node1");
            var node2 = new MyNode ("Node2");
            var node3 = new MyNode ("Node3");
            wld.AddChild (node1);
            node1.AddChild (node2);
            node2.AddChild (node3);

            // 即時ファイナライズ
            wld.Destroy ();

            Assert.AreEqual (true, node1.IsDestroyed);
            Assert.AreEqual (true, node2.IsDestroyed);
            Assert.AreEqual (true, node3.IsDestroyed);

            Assert.AreEqual (true, node1.IsFinalized);
            Assert.AreEqual (true, node2.IsFinalized);
            Assert.AreEqual (true, node3.IsFinalized);

            Assert.AreEqual (true, node1.IsDisposed);
            Assert.AreEqual (true, node2.IsDisposed);
            Assert.AreEqual (true, node3.IsDisposed);

            Assert.AreEqual (true, wld.IsDestroyed);
            Assert.AreEqual (true, wld.IsFinalized);
            Assert.AreEqual (true, wld.IsDisposed);
            Assert.AreEqual (0, wld.ChildCount);
        }
 public static string GetNodeFolder(MyNode node)
 {
     return(node.GetType().Name + "_" + node.Id);
 }
Example #39
0
        private void VisitNode(MyNode node)
        {
            if (node.TopologicalOrder == -2)
            {
                MyLog.DEBUG.WriteLine("TopoOrdering: cycle detected");
            }
            //skip visited nodes
            if (node.TopologicalOrder != -1) return;

            //mark node as processed
            node.TopologicalOrder = -2;

            for (int i = 0; i < node.InputBranches; i++)
            {
                MyMemoryBlock<float> ai = node.GetInput(i);

                if (ai != null)
                {
                    VisitNode(ai.Owner);
                }
            }

            node.TopologicalOrder = currentOrder;
            currentOrder++;
        }
 public static bool TempDataExists(MyNode node)
 {
     return(Directory.Exists(GetTempStorage(node.Owner) + "\\" + GetNodeFolder(node)));
 }
Example #41
0
        public override ArrayList GetNivelChildren(long NivelID, long TrusteeID, long IDTipoNivelRelLimit, IDbConnection conn) 
		{
            SqlCommand command = new SqlCommand(string.Empty, (SqlConnection) conn);
			command.CommandText = "sp_genTreeLevel";
			command.CommandType = CommandType.StoredProcedure;
			command.Parameters.Add("@NivelID", SqlDbType.BigInt).Value = NivelID;
			command.Parameters.Add("@TrusteeID", SqlDbType.BigInt).Value = TrusteeID;
            command.Parameters.Add("@MaxExceptIDTipoNivelRel", SqlDbType.Int).Value = IDTipoNivelRelLimit;
			SqlDataReader reader = command.ExecuteReader();

			ArrayList result = new ArrayList();
			MyNode node;
			while (reader.Read())
			{
				node = new MyNode();
				node.IDNivel = System.Convert.ToInt64(reader.GetValue(0));
				if (reader.GetValue(1) != DBNull.Value)
					node.IDNivelUpper = System.Convert.ToInt64(reader.GetValue(1));
				node.Age = System.Convert.ToInt32(reader.GetValue(2));
				node.TipoNivelRelacionado = System.Convert.ToInt64(reader.GetValue(3));
				node.TipoNivel = reader.GetValue(4).ToString();
				node.Designacao = reader.GetValue(5).ToString();
				node.AnoInicio = reader.GetValue(6).ToString();
				node.AnoFim = reader.GetValue(7).ToString();

				result.Add(node);
			}

			reader.Close();

			return result;
		}
 public bool IsRegistered(MyNode holder)
 {
     return(m_memoryBlocks.ContainsKey(holder));
 }
 public static string GetNodeFolder(MyNode node)
 {
     return node.GetType().Name + "_" + node.Id;
 }
 public void RemoveBlocks(MyNode holder)
 {
     m_memoryBlocks.Remove(holder);
 }
Example #45
0
 public void AddError(MyNode sender, string message)
 {
     AssertError(false, sender, message);
 }
Example #46
0
        public static MyNodeView CreateNodeView(MyNode node, GraphControl owner)
        {
            MyNodeView nodeView = CreateNodeView(node.GetType(), owner);
            nodeView.Node = node;

            return nodeView;
        }
Example #47
0
 public void AddWarning(MyNode sender, string message)
 {
     AssertWarning(false, sender, message);
 }
Example #48
0
 public MyList()
 {
     head = null;
 }
 public CudaRandDevice GetRandDevice(MyNode callee)
 {
     return(m_randDevices[callee.GPU]);
 }
Example #50
0
 public MyConnection(MyNode from, MyNode to) : this(from, to, 0, 0)
 {
 }
Example #51
0
        private void AddMessage(MyValidationLevel level, string message, MyNode sender)
        {
            string[] lines = message.Split('\n');

            Messages.Add(new MyValidationMessage(level, lines[0], sender));

            for (int i = 1; i < lines.Length; i++)
            {
                Messages.Add(new MyValidationMessage(level, lines[i], null));
            }
        }
 private void UnboundNode(MyNode node)
 {
     node.ForceX = 0;
     node.ForceY = 0;
 }
 private bool UpdateAndCheckChange(MyNode node)
 {
     node.PushOutputBlockSizes();
     node.UpdateMemoryBlocks();
     return node.AnyOutputSizeChanged();
 }
Example #54
0
 public void AddError(MyNode sender, string message)
 {
     AssertError(false, sender, message);
 }
Example #55
0
 public void AddWarning(MyNode sender, string message)
 {
     AssertWarning(false, sender, message);
 }
Example #56
0
 public void AddInfo(MyNode sender, string message)
 {
     AssertInfo(false, sender, message);
 }
 public MyMemoryBlock <T> CreateMemoryBlock <T>(MyNode holder) where T : struct
 {
     return((MyMemoryBlock <T>)CreateMemoryBlock(holder, typeof(MyMemoryBlock <T>)));
 }
Example #58
0
 private bool UpdateAndCheckChange(MyNode node)
 {
     node.PushOutputBlockSizes();
     node.UpdateMemoryBlocks();
     return(node.AnyOutputSizeChanged());
 }
        private void RestoreConnections(MyNode node, Dictionary<MyNode, MyNodeView> nodeViewTable)
        {
            MyNodeView toNodeView = nodeViewTable[node];

            for (int i = 0; i < node.InputBranches; i++)
            {
                MyConnection connection = node.InputConnections[i];

                if (connection != null)
                {
                    MyNodeView fromNodeView = nodeViewTable[connection.From];
                    NodeItem fromNodeViewItem = fromNodeView.GetOuputBranchItem(connection.FromIndex);

                    NodeConnection c = Desktop.Connect(fromNodeViewItem, toNodeView.GetInputBranchItem(connection.ToIndex));
                    c.Tag = connection;
                }
            }
        }
 public MyNodeLabelItem(MyNode target, bool inputEnabled, bool outputEnabled) :
     base("", inputEnabled, outputEnabled)
 {
     m_target = target;
 }