예제 #1
0
        public static void inspect_Irreducible(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref gProAnalyzer.GraphVariables.clsLoop clsLoop, int workLoop)
        {
            int curDepth = 1;

            do
            {
                for (int i = 0; i < clsLoop.Loop[workLoop].nLoop; i++)
                {
                    if (clsLoop.Loop[workLoop].Loop[i].depth != curDepth)
                    {
                        continue;
                    }
                    if (!clsLoop.Loop[workLoop].Loop[i].Irreducible)
                    {
                        continue;
                    }

                    for (int k = 0; k < clsLoop.Loop[workLoop].Loop[i].nEntry; k++)
                    {
                        if (clsLoop.Loop[workLoop].Loop[i].Entry[k] == clsLoop.Loop[workLoop].Loop[i].header)
                        {
                            continue;
                        }

                        gProAnalyzer.Ultilities.makeSubNetwork.make_subNetwork(ref graph, currentN, graph.subNet, ref clsLoop, workLoop, i, ref clsSESE, "II", clsLoop.Loop[workLoop].Loop[i].Entry[k]);    //5는 SubNetwork

                        add_subNatural(ref graph, graph.subNet, currentN, ref clsLoop, clsLoop.subLoop, workLoop, i);

                        break; //header가 다른 한 경우만 고려하면 됨....
                    }
                }
                curDepth++;
            } while (curDepth <= clsLoop.Loop[workLoop].maxDepth);
        }
예제 #2
0
        public static void Run_Split_Type1(ref gProAnalyzer.GraphVariables.clsGraph graph, int orgNet, int midNet)
        {
            Initialize_All();

            // Network(0)로 작업하여 Network(1) 생성

            int nNode = graph.Network[orgNet].nNode;
            int nLink = graph.Network[orgNet].nLink;

            searchNode  = new int[nNode];
            nSearchNode = 0;

            //nPre ~ Predecessor; nPost ~ Sucessor
            for (int i = 0; i < nNode; i++)
            {
                if (graph.Network[orgNet].Node[i].nPre >= 2 && graph.Network[orgNet].Node[i].nPost >= 2)
                {
                    searchNode[nSearchNode] = i;
                    nSearchNode++;
                }
            }

            // 새네트워크 생성 (복제)
            graph.Network[midNet] = graph.Network[orgNet];
            //midNet => save the extent_Network. Create more node for split
            //just extent the number (nSearchNode) of Node and Link with null value
            gProAnalyzer.Preprocessing.clsExtendNetwork.extent_Network(ref graph, midNet, nSearchNode);

            if (nSearchNode > 0)
            {
                Type_I_Split(ref graph, midNet, nNode, nLink);
            }
        }
예제 #3
0
        public static void make_Loop(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN)
        {
            //초기화 //intialize
            for (int i = 0; i < graph.Network[currentN].nNode; i++)
            {
                graph.Network[currentN].Node[i].depth   = 0;
                graph.Network[currentN].Node[i].Special = "";
                graph.Network[currentN].Node[i].done    = false;
            }
            for (int i = 0; i < graph.Network[currentN].nLink; i++)
            {
                graph.Network[currentN].Link[i].bBackJ = false;
                graph.Network[currentN].Link[i].bBackS = false;
            }

            //모든 Loop찾아서 // FIND ALL LOOP
            int tempN = graph.Network[currentN].nNode;

            Block = new strBlock[tempN];
            for (int i = 0; i < tempN; i++)
            {
                Block[i].LoopHeader   = false;
                Block[i].Irreducible  = false;
                Block[i].tranversed   = false;
                Block[i].DFSP_pos     = 0;
                Block[i].iloop_header = -1;

                Block[i].nBackEdge       = 0;
                Block[i].fromNodeBack    = new int[graph.Network[currentN].Node[i].nPre]; //.nPost];
                Block[i].nReentry        = 0;
                Block[i].fromNodeReentry = new int[graph.Network[currentN].Node[i].nPre]; //.nPost]; //Reentry => Loop-closing edges (or Backedges)
            }
            trav_loops_DFS(ref graph, currentN, graph.Network[currentN].header, 1);
        }
예제 #4
0
        private void verifySimpleStructure(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref gProAnalyzer.GraphVariables.clsSESE clsSESE, int currentSESE, int kSESE, int entrySESE, int exitSESE, bool flag)
        {
            int    index;
            string currName = null;

            if (flag == true)
            {
                index = graph.Network[currentN].Node[entrySESE].Name.Length;
                if (index > 1)
                {
                    currName = graph.Network[currentN].Node[entrySESE].Name.Substring(0, 2);
                }
                if (isSimpleStructure(ref graph, currentN, ref clsSESE, currentSESE, kSESE) == true && currName == "SS")
                {
                    graph.Network[currentN].Node[entrySESE].Kind = graph.Network[currentN].Node[exitSESE].Kind;
                }
            }
            else
            {
                index = graph.Network[currentN].Node[exitSESE].Name.Length;
                if (index > 1)
                {
                    currName = graph.Network[currentN].Node[exitSESE].Name.Substring(0, 2);
                }
                if (isSimpleStructure(ref graph, currentN, ref clsSESE, currentSESE, kSESE) == true && currName == "EE")
                {
                    graph.Network[currentN].Node[exitSESE].Kind = graph.Network[currentN].Node[entrySESE].Kind;
                }
            }
        }
예제 #5
0
 public static void Initialize_All(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN)
 {
     //makInst = new gProAnalyzer.Ultilities.makeInstanceFlow();
     //mapping = new gProAnalyzer.Ultilities.mappingGraph();
     gProAnalyzer.Ultilities.mappingGraph.to_adjList_bInstance(ref graph, currentN, ref adjList);
     //makInst = new gProAnalyzer.Ultilities.makeInstanceFlow();
 }
예제 #6
0
 public static void After_Type_II_Split(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref gProAnalyzer.GraphVariables.clsLoop clsLoop, int workLoop)
 {
     //Loop 재탐색
     gProAnalyzer.Functionalities.LoopIdentification.search_Loop(ref graph, currentN, ref clsLoop, workLoop);
     gProAnalyzer.Functionalities.LoopIdentification.merge_Irreducible(ref clsLoop, workLoop);
     gProAnalyzer.Functionalities.LoopIdentification.find_SpecialNode(ref graph, currentN, ref clsLoop, workLoop);
 }
예제 #7
0
        //New one for the case there are loops in the DFlow ============================================
        public static void find_Reach_2(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref gProAnalyzer.GraphVariables.clsLoop clsLoop,
                                        int workLoop, int loop, int sNode, int toNode, string Type, ref int[] searchNode, ref int nSearchNode) //it OK -> just change the Can_Reach_2() function
        {
            Initialize_All();

            if (sNode == toNode)
            {
                return;                                                         //Start node = end path Node
            }
            for (int i = 0; i < graph.Network[currentN].Node[sNode].nPost; i++) //Visit all potential path from sNode (Start)
            {
                /////////////////////////////////
                bool bEnd = false;

                if (Type == "CC")                                                      //sNode for this case is Header (searchNode[0])
                {
                    for (int k = 0; k < clsLoop.Loop[workLoop].Loop[loop].nEntry; k++) //Check nut lien ke tu sNode (header) toi entries dc hay ko (Duong di truc tiep)
                    {
                        if (graph.Network[currentN].Node[sNode].Post[i] == clsLoop.Loop[workLoop].Loop[loop].Entry[k])
                        {
                            bEnd = true;
                            break;
                        }
                    }
                }
                if (bEnd)
                {
                    continue;
                }
                ////////////////////////////////////////

                int fromNode = graph.Network[currentN].Node[sNode].Post[i]; //begining with a single path

                nReachNode = 0;
                //initiate reachNode by a array with scale of nNode (it will store the node, in "sequentially" - just guess)
                reachNode             = new int[graph.Network[currentN].nNode];
                reachNode[nReachNode] = fromNode; //Begining with the sucessor of start (sNode)
                nReachNode++;
                bool[] mark_reach = new bool[graph.Network[currentN].nNode * 2];

                if (can_Reach_2(ref graph, currentN, ref clsLoop, workLoop, loop, fromNode, toNode, Type, ref mark_reach))
                {
                    bool bSame = false;
                    for (int j = 0; j < nSearchNode; j++)
                    {
                        if (searchNode[j] == fromNode)
                        {
                            bSame = true;
                            break;
                        }
                    }
                    if (!bSame)
                    {
                        searchNode[nSearchNode] = fromNode;
                        nSearchNode++;
                    }
                    find_Reach_2(ref graph, currentN, ref clsLoop, workLoop, loop, fromNode, toNode, Type, ref searchNode, ref nSearchNode);
                }
            }
        }
예제 #8
0
        public static void add_aTask(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref gProAnalyzer.GraphVariables.clsLoop clsLoop, int workloop, int first_node, int second_node, ref int nNode, ref int nLink)
        {
            //int nNode = graph.Network[currentN].nNode;
            //int nLink = graph.Network[currentN].nLink;

            graph.Network[currentN].Node[nNode].Kind      = "TASK";
            graph.Network[currentN].Node[nNode].Name      = "Dummy";// node.ToString();
            graph.Network[currentN].Node[nNode].orgNum    = nNode;
            graph.Network[currentN].Node[nNode].parentNum = nNode;
            graph.Network[currentN].Node[nNode].Type_I    = "";
            graph.Network[currentN].Node[nNode].Type_II   = "";
            graph.Network[currentN].Node[nNode].Special   = "";

            //New Link 추가
            //find old link from Exit to its common Post[]
            for (int i = 0; i < nLink; i++)
            {
                if (graph.Network[currentN].Link[i].fromNode == second_node && graph.Network[currentN].Link[i].toNode == first_node)
                {
                    graph.Network[currentN].Link[i].fromNode = second_node; //exit
                    graph.Network[currentN].Link[i].toNode   = nNode;       //Dummy
                }
            }
            graph.Network[currentN].Link[nLink].fromNode = nNode;
            graph.Network[currentN].Link[nLink].toNode   = first_node;
            nLink++;

            nNode++;
        }
예제 #9
0
        public static void to_adjList_bInstance(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref int[][] adjList) //must use the last index of each List ( <= N)
        {
            int nNode = graph.Network[currentN].nNode;
            int nLink = graph.Network[currentN].nLink;

            adjList = new int[nNode][];
            //initiate each List
            for (int i = 0; i < nNode; i++)
            {
                adjList[i]    = new int[nNode];
                adjList[i][0] = 0;
            }
            int fromNode, toNode;

            for (int i = 0; i < nLink; i++)
            {
                if (graph.Network[currentN].Link[i].bInstance == false)
                {
                    continue;
                }

                fromNode = graph.Network[currentN].Link[i].fromNode;
                toNode   = graph.Network[currentN].Link[i].toNode;
                adjList[fromNode][0]++;
                adjList[fromNode][adjList[fromNode][0]] = toNode;

                //adjList[toNode][0]++;
                //adjList[toNode][adjList[toNode][0]] = fromNode;
            }
        }
예제 #10
0
 public static int type_Node(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref gProAnalyzer.GraphVariables.clsSESE clsSESE, int currentSESE, int node, int nodeD, int nodeR) // return 1 for TASK/EVENT, return 2 for ENTRY SESE, return 3 for EXIT SESE
 {
     if (node != -1)
     {
         if (node == nodeD || node == nodeR)
         {
             return(0);
         }
         if (graph.Network[currentN].Node[node].nPre > 1 || graph.Network[currentN].Node[node].nPost > 1)
         {
             for (int i = 0; i < clsSESE.SESE[currentSESE].nSESE; i++)
             {
                 if (node == clsSESE.SESE[currentSESE].SESE[i].Entry)
                 {
                     return(2);
                 }
                 if (node == clsSESE.SESE[currentSESE].SESE[i].Exit)
                 {
                     return(3);
                 }
             }
         }
         else
         if (graph.Network[currentN].Node[node].Kind == "TASK" || graph.Network[currentN].Node[node].Kind == "EVENT" ||
             graph.Network[currentN].Node[node].Kind == "START" || graph.Network[currentN].Node[node].Kind == "END")
         {
             return(1);
         }
     }
     return(0);
 }
예제 #11
0
        public static bool check_SESE_Entry(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref gProAnalyzer.GraphVariables.clsSESE clsSESE, int currentSESE, int curNode, int curSESE)  //check outter edges of an entrySESE or exitSESE (if more than 1 => should split)
        {
            int count_outterEdges = 0;

            for (int i = 0; i < graph.Network[currentN].Node[curNode].nPost; i++)
            {
                int node = graph.Network[currentN].Node[curNode].Post[i];
                if (!node_insideSESE(clsSESE.SESE[currentSESE].SESE[curSESE].Node, node))
                {
                    count_outterEdges++;
                }
            }
            for (int i = 0; i < graph.Network[currentN].Node[curNode].nPre; i++)
            {
                int node = graph.Network[currentN].Node[curNode].Pre[i];
                if (!node_insideSESE(clsSESE.SESE[currentSESE].SESE[curSESE].Node, node))
                {
                    count_outterEdges++;
                }
            }
            if (count_outterEdges == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #12
0
        public static void find_Dom(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN)
        {
            Initialize_All();
            //초기 Dom
            for (int i = 0; i < graph.Network[currentN].nNode; i++) //Visit all node in graph (index range from 0 to nNode)
            {
                if (graph.Network[currentN].Node[i].nPre == 0)      //시작점 //Starting Point
                {
                    graph.Network[currentN].Node[i].nDom   = 1;
                    graph.Network[currentN].Node[i].Dom    = new int[1];
                    graph.Network[currentN].Node[i].Dom[0] = i; //If it is the first node => there is only its node dominate itself
                }
                else
                {
                    graph.Network[currentN].Node[i].nDom = 0;
                    graph.Network[currentN].Node[i].Dom  = null; //initiating all Dom[] array by null and 0 for further evaluation
                }
            }
            bool change;

            do
            {
                change = false;
                for (int i = 0; i < graph.Network[currentN].nNode; i++)
                {
                    // i from 0 to Total number of Node
                    int[] calDom = null;
                    for (int k = 0; k < graph.Network[currentN].Node[i].nPre; k++)
                    {
                        //k from 0 to Total number of "nPre"
                        //find the intersection of (calDom[] and B[]) => return calDom[]
                        calDom = gProAnalyzer.Ultilities.findIntersection.find_Intersection(graph.Network[currentN].nNode, calDom, graph.Network[currentN].Node[graph.Network[currentN].Node[i].Pre[k]].Dom); // calDOm = caDom (intersection) Dom(j)
                    }

                    if (calDom != null)
                    {
                        int[] newDom = new int[calDom.Length + 1];

                        for (int k = 0; k < calDom.Length; k++)
                        {
                            newDom[k] = calDom[k]; //교집합
                        }
                        newDom[calDom.Length] = i; //자기자신 // Node i dominated its self
                        //Check same and transfer the result
                        if (!gProAnalyzer.Ultilities.checkGraph.check_SameSet(newDom, graph.Network[currentN].Node[i].Dom))
                        {
                            graph.Network[currentN].Node[i].Dom = newDom;

                            change = true;
                        }

                        graph.Network[currentN].Node[i].nDom = graph.Network[currentN].Node[i].Dom.Length;
                    }
                }
            } while (change);
        }
예제 #13
0
        //================================================================================================================================

        public static bool can_Reach(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref gProAnalyzer.GraphVariables.clsLoop clsLoop,
                                     int workLoop, int loop, int fromNode, int toNode, string Type)
        {
            bool bReach = false;

            if (graph.Network[currentN].Node[fromNode].nPost == 0)
            {
                return(bReach);
            }

            for (int i = 0; i < graph.Network[currentN].Node[fromNode].nPost; i++)
            {
                bool bSame = false;
                for (int j = 0; j < nReachNode; j++)
                {
                    if (graph.Network[currentN].Node[fromNode].Post[i] == reachNode[j])
                    {
                        bSame = true;
                        break;
                    }
                }
                if (bSame)
                {
                    continue;
                }

                reachNode[nReachNode] = graph.Network[currentN].Node[fromNode].Post[i];
                nReachNode++;

                if (graph.Network[currentN].Node[fromNode].Post[i] == toNode)
                {
                    bReach = true;
                    break;
                }
                else if (Type == "CC")
                {
                    if (!gProAnalyzer.Ultilities.findNodeInLoop.Node_In_Loop(ref clsLoop, workLoop, graph.Network[currentN].Node[fromNode].Post[i], loop))  //???????????
                    {
                        if (can_Reach(ref graph, currentN, ref clsLoop, workLoop, loop, graph.Network[currentN].Node[fromNode].Post[i], toNode, Type))
                        {
                            bReach = true;
                            break;
                        }
                    }
                }
                else
                {
                    if (can_Reach(ref graph, currentN, ref clsLoop, workLoop, loop, graph.Network[currentN].Node[fromNode].Post[i], toNode, Type))
                    {
                        bReach = true;
                        break;
                    }
                }
            }
            return(bReach);
        }
예제 #14
0
        public static string[] convert_Readable(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, int[] InstantNode, int nInstantNode)
        {
            string[] readable = new string[nInstantNode];

            for (int i = 0; i < nInstantNode; i++)
            {
                readable[i] = graph.Network[currentN].Node[InstantNode[i]].Name;
            }
            return(readable);
        }
예제 #15
0
 public static int find_nodeName(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, string name)
 {
     for (int i = 0; i < graph.Network[currentN].nNode; i++)
     {
         if (graph.Network[currentN].Node[i].Kind == name)
         {
             return(i);
         }
     }
     return(-1);
 }
예제 #16
0
        public static void Run_Split_Type2(ref gProAnalyzer.GraphVariables.clsGraph graph, int midNet, int finalNet, ref gProAnalyzer.GraphVariables.clsLoop clsLoop, int orgLoop)
        {
            Initialize_All();

            // Network(2) 생성후 작업
            int nNode = graph.Network[midNet].nNode;
            int nLink = graph.Network[midNet].nLink;

            // 새네트워크 생성 (복제)
            graph.Network[finalNet] = graph.Network[midNet];

            //Loop없으면 건너뛰기
            if (clsLoop.Loop[orgLoop].nLoop == 0)
            {
                gProAnalyzer.Preprocessing.clsExtendNetwork.extent_Network(ref graph, finalNet, 0);
                return;
            }
            //Extent_network with the new number of node. (because we assign the fixed number of node of model when we read the model.
            //For example: nNode = 10; nLink = 14 => after extent => nNode = 10 + 10 (nNode); nLink = 14 + 10 (nNode)
            gProAnalyzer.Preprocessing.clsExtendNetwork.extent_Network(ref graph, finalNet, nNode);

            //Extension Type II split in Entry of Loop => (2 new node and 2 new link maybe create)
            int nSplit = Type_II_Split_Entry(ref graph, finalNet, ref clsLoop, orgLoop, nNode, nLink);

            nNode += nSplit;
            nLink += nSplit;

            //we need identify the loop after split entry (extension)
            //resize_Network(finalNet, nNode, nLink);
            gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, finalNet, ref clsLoop, orgLoop, ref clsLoop.IrreducibleError); //===> Because the extension of type_2 create nodes inside the loops => we need add it into a Loop[] structure.
            //extent_Network(finalNet, nNode);

            nSplit = 0;
            nSplit = Type_II_Split_Exit(ref graph, finalNet, ref clsLoop, orgLoop, nNode, nLink);
            nNode += nSplit;
            nLink += nSplit;

            //fix CIPd Exit (Direct join of exits)
            add_Dummy_Task(ref graph, finalNet, ref clsLoop, orgLoop, ref nNode, ref nLink);

            gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, finalNet, ref clsLoop, orgLoop, ref clsLoop.IrreducibleError);

            nSplit = 0;
            nSplit = Type_II_Split_Back(ref graph, finalNet, nNode, nLink); //(No split backward split)
            nNode += nSplit;
            nLink += nSplit;

            gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, finalNet, ref clsLoop, orgLoop, ref clsLoop.IrreducibleError);

            resize_Network(ref graph, finalNet, nNode, nLink);

            //After_Type_II_Split(ref graph, finalNet, ref clsLoop, orgLoop); //Remove on Otc27_2020 (Might turn back latter)
            gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, finalNet, ref clsLoop, orgLoop, ref clsLoop.IrreducibleError);
        }
예제 #17
0
파일: Testing.cs 프로젝트: ngoclongha/PBR
        public int RunTest(ref gProAnalyzer.GraphVariables.clsGraph graph, ref gProAnalyzer.GraphVariables.clsHWLS clsHWLS, ref gProAnalyzer.GraphVariables.clsLoop clsLoop,
                           ref gProAnalyzer.GraphVariables.clsSESE clsSESE, int numRun)
        {
            duration = 0;
            HiPerfTimer pt = new HiPerfTimer();

            pt.Start();

            for (int i = 0; i < numRun; i++)
            {
                Initialize_All();

                //SplitType1.Run_Split_Type1(ref graph, graph.orgNet, graph.midNet);

                //findLoop.Run_FindLoop(ref graph, graph.midNet, ref clsLoop, clsLoop.orgLoop, ref clsLoop.IrreducibleError);

                graph.Network[graph.finalNet] = graph.Network[graph.orgNet];
                //SplitType2.Run_Split_Type2(ref graph, graph.midNet, graph.finalNet, ref clsLoop, clsLoop.orgLoop);

                gProAnalyzer.Functionalities.DominanceIdentification.find_Dom(ref graph, graph.finalNet);
                gProAnalyzer.Functionalities.DominanceIdentification.find_Pdom(ref graph, graph.finalNet);
                gProAnalyzer.Functionalities.DominanceIdentification.find_DomEI(ref graph, graph.finalNet, -2);
                gProAnalyzer.Functionalities.DominanceIdentification.find_PdomEI(ref graph, graph.finalNet);

                //sese.find_SESE_WithLoop(ref graph, graph.finalNet, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE, -2);
                gProAnalyzer.Functionalities.SESEIdentification.find_SESE_Dummy(ref graph, graph.finalNet, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE, -2);


                gProAnalyzer.Functionalities.NodeSplittingType3.Run_Split_Type3(ref graph, graph.finalNet, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE, true);

                //Decompose cyclic subgraphs

                //Make nesting forest?
                gProAnalyzer.Ultilities.makeNestingForest.make_NestingForest(ref graph, graph.finalNet, ref clsHWLS, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE);
            }

            pt.Stop();
            duration += pt.Duration;

            duration = duration / (double)numRun;
            duration = duration * 1000;

            //makInst.make_InstanceFlow(ref graph, graph.finalNet, 0, "", "");

            //==================================================
            //== get initial behavior profile ==
            //graph.Network[graph.reduceNet] = graph.Network[graph.finalNet];
            //extendG.full_extentNetwork(ref graph, graph.reduceNet, 0, 0);
            //indexing.get_InitialBehaviorProfile(ref graph, graph.reduceNet, ref clsHWLS, ref clsLoop, clsLoop.orgLoop, ref clsSESE, clsSESE.finalSESE);
            //Database storing

            return(0);
        }
예제 #18
0
 public frmSplitModels_Rigids()
 {
     InitializeComponent();
     graph           = new gProAnalyzer.GraphVariables.clsGraph();
     clsSESE         = new gProAnalyzer.GraphVariables.clsSESE();
     clsLoop         = new gProAnalyzer.GraphVariables.clsLoop();
     clsHWLS         = new gProAnalyzer.GraphVariables.clsHWLS();
     clsError        = new gProAnalyzer.GraphVariables.clsError();
     loadGraph       = new gProAnalyzer.Preprocessing.clsLoadGraph();
     runSESE         = new gProAnalyzer.Run_Analysis_SESE();
     runVerification = new gProAnalyzer.Run_Analysis_Verification();
 }
예제 #19
0
        public static void find_NodeInfo(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, int node)
        {
            int cntPre = 0;

            int[] find_Pre = new int[graph.Network[currentN].nNode];
            int   cntPost  = 0;

            int[] find_Post = new int[graph.Network[currentN].nNode];

            graph.Network[currentN].Node[node].nPre  = 0;
            graph.Network[currentN].Node[node].nPost = 0;
            graph.Network[currentN].Node[node].Pre   = null;
            graph.Network[currentN].Node[node].Post  = null;

            for (int j = 0; j < graph.Network[currentN].nLink; j++)
            {
                if (graph.Network[currentN].Link[j].fromNode == node && graph.Network[currentN].Link[j].toNode != node)
                {
                    find_Post[cntPost] = graph.Network[currentN].Link[j].toNode;
                    cntPost++;
                }
                if (graph.Network[currentN].Link[j].toNode == node && graph.Network[currentN].Link[j].fromNode != node)
                {
                    find_Pre[cntPre] = graph.Network[currentN].Link[j].fromNode;
                    cntPre++;
                }
            }

            if (cntPre > 0)
            {
                graph.Network[currentN].Node[node].nPre = cntPre;
                graph.Network[currentN].Node[node].Pre  = new int[cntPre];
                for (int k = 0; k < cntPre; k++)
                {
                    graph.Network[currentN].Node[node].Pre[k] = find_Pre[k];
                }
            }

            if (cntPost > 0)
            {
                graph.Network[currentN].Node[node].nPost = cntPost;
                graph.Network[currentN].Node[node].Post  = new int[cntPost];
                for (int k = 0; k < cntPost; k++)
                {
                    graph.Network[currentN].Node[node].Post[k] = find_Post[k];
                }
            }
            if (cntPre == 0 && cntPost > 0)
            {
                graph.Network[currentN].header = node;
            }
        }
예제 #20
0
        public static int count_UnDepth(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN)
        {
            int count = 0;

            for (int i = 0; i < graph.Network[currentN].nNode; i++)
            {
                if (graph.Network[currentN].Node[i].depth == 0)
                {
                    count++;
                }
            }
            return(count);
        }
예제 #21
0
        public frmBasicSimulation()
        {
            loadG    = new Preprocessing.clsLoadGraph();
            graph    = new GraphVariables.clsGraph();
            clsLoop  = new GraphVariables.clsLoop();
            clsSESE  = new GraphVariables.clsSESE();
            clsHWLS  = new gProAnalyzer.GraphVariables.clsHWLS();
            clsError = new gProAnalyzer.GraphVariables.clsError();

            test            = new gProAnalyzer.Testing();
            runVerification = new gProAnalyzer.Run_Analysis_Verification();

            InitializeComponent();
        }
예제 #22
0
        //Post Dominance (find_DomRev)
        public static void find_Pdom(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN)
        {
            Initialize_All();
            for (int i = 0; i < graph.Network[currentN].nNode; i++)
            {
                if (graph.Network[currentN].Node[i].nPost == 0)
                {
                    graph.Network[currentN].Node[i].nDomRev   = 1;
                    graph.Network[currentN].Node[i].DomRev    = new int[1];
                    graph.Network[currentN].Node[i].DomRev[0] = i;
                }
                else
                {
                    graph.Network[currentN].Node[i].nDomRev = 0;
                    graph.Network[currentN].Node[i].DomRev  = null;
                }
            }
            bool change;

            do
            {
                change = false;
                for (int i = 0; i < graph.Network[currentN].nNode; i++)
                {
                    int[] calDom = null;
                    for (int k = 0; k < graph.Network[currentN].Node[i].nPost; k++)
                    {
                        calDom = gProAnalyzer.Ultilities.findIntersection.find_Intersection(graph.Network[currentN].nNode, calDom, graph.Network[currentN].Node[graph.Network[currentN].Node[i].Post[k]].DomRev);
                    }

                    if (calDom != null)
                    {
                        int[] newDom = new int[calDom.Length + 1];

                        newDom[0] = i; //자기자신
                        for (int k = 0; k < calDom.Length; k++)
                        {
                            newDom[k + 1] = calDom[k];                                     //교집합
                        }
                        if (!gProAnalyzer.Ultilities.checkGraph.check_SameSet(newDom, graph.Network[currentN].Node[i].DomRev))
                        {
                            graph.Network[currentN].Node[i].DomRev = newDom;

                            change = true;
                        }
                        graph.Network[currentN].Node[i].nDomRev = graph.Network[currentN].Node[i].DomRev.Length;
                    }
                }
            } while (change);
        }
예제 #23
0
        public static void find_SpecialNode_ReducedLoop(ref gProAnalyzer.GraphVariables.clsGraph graph, int reduceN, ref gProAnalyzer.GraphVariables.clsLoop clsLoop, int workLoop, int curLoop)
        {
            int[] node_set = new int[clsLoop.Loop[workLoop].Loop[curLoop].nNode + 1];
            node_set[0] = clsLoop.Loop[workLoop].Loop[curLoop].header;
            for (int i = 0; i < clsLoop.Loop[workLoop].Loop[curLoop].nNode; i++)
            {
                node_set[i + 1] = clsLoop.Loop[workLoop].Loop[curLoop].Node[i];
            }

            for (int i = 0; i < clsLoop.Loop[workLoop].Loop[curLoop].nNode; i++)
            {
                int node = clsLoop.Loop[workLoop].Loop[curLoop].Node[i];
                if (graph.Network[reduceN].Node[node].Special == "E")
                {
                    for (int j = 0; j < graph.Network[reduceN].nLink; j++)
                    {
                        if (graph.Network[reduceN].Link[j].fromNode == node)
                        {
                            if (Ultilities.checkGraph.Node_In_Set(node_set, node_set.Length, graph.Network[reduceN].Link[j].toNode) == false)
                            {
                                graph.Network[reduceN].Node[node].Special = "X";
                            }
                        }
                    }
                }
            }

            for (int i = 0; i < clsLoop.Loop[workLoop].Loop[curLoop].nNode; i++)
            {
                int node = clsLoop.Loop[workLoop].Loop[curLoop].Node[i];
                for (int j = 0; j < graph.Network[reduceN].nLink; j++)
                {
                    if (graph.Network[reduceN].Link[j].fromNode == node)
                    {
                        if (graph.Network[reduceN].Node[node].Special == "X")
                        {
                            if (graph.Network[reduceN].Link[j].bBackS == true) //backward split
                            {
                                graph.Network[reduceN].Node[node].Special = "T";
                            }
                        }
                        else
                        if (graph.Network[reduceN].Link[j].bBackS == true && graph.Network[reduceN].Node[node].Special != "T")
                        {
                            graph.Network[reduceN].Node[node].Special = "B";
                        }
                    }
                }
            }
        }
예제 #24
0
        public Dashboard_Experiment()
        {
            InitializeComponent();
            loadG           = new Preprocessing.clsLoadGraph();
            graph           = new GraphVariables.clsGraph();
            clsLoop         = new GraphVariables.clsLoop();
            clsSESE         = new GraphVariables.clsSESE();
            clsHWLS         = new gProAnalyzer.GraphVariables.clsHWLS();
            clsError        = new gProAnalyzer.GraphVariables.clsError();
            runVerification = new gProAnalyzer.Run_Analysis_Verification();

            progressBar1.Visible = false;
            btnRun.Visible       = false;
            exportExcel.Visible  = false;
        }
예제 #25
0
        public static int get_depthBFS(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, bool[,] Tree, bool isEntrySet)
        {
            int Start = find_nodeName(ref graph, currentN, "START");
            int End   = find_nodeName(ref graph, currentN, "END");

            Queue <int> Q = new Queue <int>();

            if (isEntrySet)
            {
                Q.Enqueue(graph.Network[currentN].Node[Start].Post[0]);
                graph.Network[currentN].Node[Start].DepthDom    = 0;
                graph.Network[currentN].Node[Q.Peek()].DepthDom = 1;
            }
            else
            {
                Q.Enqueue(graph.Network[currentN].Node[End].Pre[0]);
                graph.Network[currentN].Node[End].DepthPdom      = 0;
                graph.Network[currentN].Node[Q.Peek()].DepthPdom = 1;
            }
            int maxDepth = 0;

            do
            {
                int u = Q.Dequeue();
                for (int v = 0; v < graph.Network[currentN].nNode; v++)
                {
                    if (isEntrySet && Tree[u, v] == true)
                    {
                        graph.Network[currentN].Node[v].DepthDom = graph.Network[currentN].Node[u].DepthDom + 1;
                        if (graph.Network[currentN].Node[v].DepthDom > maxDepth)
                        {
                            maxDepth = graph.Network[currentN].Node[v].DepthDom;
                        }
                        Q.Enqueue(v);
                    }
                    else if (!isEntrySet && Tree[v, u] == true)
                    {
                        graph.Network[currentN].Node[v].DepthPdom = graph.Network[currentN].Node[u].DepthPdom + 1;
                        if (graph.Network[currentN].Node[v].DepthPdom > maxDepth)
                        {
                            maxDepth = graph.Network[currentN].Node[v].DepthPdom;
                        }
                        Q.Enqueue(v);
                    }
                }
            } while (Q.Count != 0);
            return(maxDepth);
        }
예제 #26
0
 public static void resize_Network(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, int nNode, int nLink)
 {
     graph.Network[currentN].nNode = nNode;
     gProAnalyzer.GraphVariables.clsNode.strNode[] newNode = new gProAnalyzer.GraphVariables.clsNode.strNode[nNode];
     for (int i = 0; i < nNode; i++)
     {
         newNode[i] = graph.Network[currentN].Node[i];
     }
     graph.Network[currentN].nLink = nLink;
     gProAnalyzer.GraphVariables.clsEdge.strEdge[] newLink = new gProAnalyzer.GraphVariables.clsEdge.strEdge[nLink];
     for (int i = 0; i < nLink; i++)
     {
         newLink[i] = graph.Network[currentN].Link[i];
     }
     graph.Network[currentN].Node = newNode;
     graph.Network[currentN].Link = newLink;
 }
예제 #27
0
        public static void to_adjacencyMatrix(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref int[,] A, ref int nNode)
        {
            nNode = graph.Network[currentN].nNode;
            //initiate adjacency matrix
            A = new int[nNode, nNode];
            for (int i = 0; i < nNode; i++)
            {
                for (int j = 0; j < nNode; j++)
                {
                    A[i, j] = -1;
                }
            }

            for (int i = 0; i < graph.Network[currentN].nLink; i++)
            {
                A[graph.Network[currentN].Link[i].fromNode, graph.Network[currentN].Link[i].toNode] = 1;
            }
        }
예제 #28
0
        private static void Initialize_All(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref gProAnalyzer.GraphVariables.clsSESE clsSESE, int currentSESE)
        {
            //mapping = new gProAnalyzer.Ultilities.mappingGraph();
            //copySE = new gProAnalyzer.Ultilities.copySESE();
            //check = new gProAnalyzer.Ultilities.checkGraph();
            //fndIntersect = new gProAnalyzer.Ultilities.findIntersection();


            gProAnalyzer.Ultilities.mappingGraph.to_adjList_Directed(ref graph, currentN, ref adjList);
            Mark     = new bool[graph.Network[currentN].nNode];
            Mark     = Array.ConvertAll <bool, bool>(Mark, b => b = false);
            curDepth = clsSESE.SESE[currentSESE].maxDepth;

            getPolygons = new int[graph.Network[currentN].nNode * 2];
            nPolygons   = 0;

            gProAnalyzer.Ultilities.copySESE.copy_SESE(ref clsSESE, currentSESE, clsSESE.tempSESE);
        }
예제 #29
0
        //MAIN()
        public static int make_InstanceFlow(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, int loop, string errType, string strLoop, ref gProAnalyzer.GraphVariables.clsError clsError) //loop = -1 => final-Acyclic ; loop = -2 => SESE (new)
        {
            SearchXOR   = new int[graph.Network[currentN].nNode];                                                                                                                                      // 0-탐색
            nSearchXOR  = 0;
            nCurrentXOR = 0;
            nInst       = 0;

            System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
            watch.Start();
            do
            {
                nCurrentXOR = 0;
                for (int j = 0; j < graph.Network[currentN].nLink; j++) //fill all this subnetwork is un-visit
                {
                    graph.Network[currentN].Link[j].bInstance = false;  //bInstance is used for mark the node which have token (instance flow)
                }

                int[]    InstantNode       = new int[graph.Network[currentN].nNode];
                int      nInstantNode      = 0;
                string[] strCombination_OR = new string[graph.Network[currentN].nNode]; //for indexing the current propagation of OR split e.g., which successors are activated.
                //int nOR_SplitIndex = 0;

                int sNode = graph.Network[currentN].header;
                InstantNode[nInstantNode] = sNode;
                nInstantNode++;

                if (find_InstanceNode(ref graph, currentN, sNode, ref InstantNode, ref nInstantNode, ref SearchXOR, ref nSearchXOR, ref nCurrentXOR, ref strCombination_OR)) //find_InstanceNode() => output will be stored in InstantNode[] (Global variable!) - all the node which is activated in currentN.
                {
                    string[] readable = new string[nInstantNode];
                    readable = convert_Readable(ref graph, currentN, InstantNode, nInstantNode);
                    //Make_InstantNetwork(currentN, dummyNet); // 삭제 ??????????????

                    check_InstanceFlow(ref graph, currentN, loop, errType, strLoop, ref InstantNode, ref nInstantNode, ref clsError);  //bFor = true; => Forward// bFor = false; => Backward error reporting. (Errors[])
                    if (nInst == 100)
                    {
                    }

                    nInst++;
                }
            } while (nSearchXOR > 0);

            //MessageBox.Show(nInst.ToString() + " in " + watch.ElapsedMilliseconds.ToString() + "miliseconds", "Number of Instance");
            return(nInst);
        }
예제 #30
0
        public static void Run_Split_Type3(ref gProAnalyzer.GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsLoop clsLoop, int orgLoop,
                                           ref gProAnalyzer.GraphVariables.clsSESE clsSESE, int currentSESE, bool isRigidSplit) //isRigidSplit is used for flag to determine whether to split entry of rigid containing start events or not!!
        {
            Initialize_All();

            bool mStop = false;
            int  sNode;
            int  eNode;
            int  curDepth = clsSESE.SESE[currentSESE].maxDepth;

            do
            {
                for (int j = 0; j < clsSESE.SESE[currentSESE].nSESE; j++) //Visit all the SESE flow
                {
                    if (clsSESE.SESE[currentSESE].SESE[j].depth != curDepth)
                    {
                        continue;
                    }

                    sNode = clsSESE.SESE[currentSESE].SESE[j].Entry;
                    eNode = clsSESE.SESE[currentSESE].SESE[j].Exit;

                    if (!check_SESE_Entry(ref graph, currentN, ref clsSESE, currentSESE, sNode, j))
                    {
                        Type_III_Split_Entry(ref graph, currentN, ref clsSESE, currentSESE, j, 1, sNode, eNode, "");
                    }

                    if (!check_SESE_Entry(ref graph, currentN, ref clsSESE, currentSESE, eNode, j))
                    {
                        Type_III_Split_Exit(ref graph, currentN, ref clsSESE, currentSESE, j, 1, eNode, eNode);
                    }
                }
                curDepth--;
            } while (curDepth > 0 && !mStop);

            gProAnalyzer.Functionalities.DominanceIdentification.find_Dom(ref graph, currentN);       //Dom
            gProAnalyzer.Functionalities.DominanceIdentification.find_Pdom(ref graph, currentN);      //Postdom

            gProAnalyzer.Functionalities.DominanceIdentification.find_DomEI(ref graph, currentN, -1); //SS split node만..... //eDom^-1(NodeD)
            gProAnalyzer.Functionalities.DominanceIdentification.find_PdomEI(ref graph, currentN);    // join node만..... //ePdom^-1(NodeR)

            gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, currentN, ref clsLoop, orgLoop, ref clsLoop.IrreducibleError);
        }