Exemplo n.º 1
0
        public static bool Node_In_SESE(GraphVariables.clsSESE clsSESE, int workSESE, int node, int currSESE)
        {
            bool inside = false;

            for (int i = 0; i < clsSESE.SESE[workSESE].SESE[currSESE].nNode; i++)
            {
                if (clsSESE.SESE[workSESE].SESE[currSESE].Node[i] == node)
                {
                    inside = true;
                    break;
                }
            }
            if (inside)
            {
                for (int i = 0; i < clsSESE.SESE[workSESE].SESE[currSESE].nChild; i++)
                {
                    if (currSESE != clsSESE.SESE[workSESE].SESE[currSESE].child[i])
                    {
                        for (int j = 0; j < clsSESE.SESE[workSESE].SESE[clsSESE.SESE[workSESE].SESE[currSESE].child[i]].nNode; j++)
                        {
                            if (clsSESE.SESE[workSESE].SESE[clsSESE.SESE[workSESE].SESE[currSESE].child[i]].Node[j] == node)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }
            else
            {
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
 //might not use
 private void reduceAllChild(ref GraphVariables.clsGraph graph, int currentN, GraphVariables.clsHWLS clsHWLS, int currBlock, GraphVariables.clsLoop clsLoop, int workLoop,
                             GraphVariables.clsSESE clsSESE, int workSESE, int orgIndex)
 {
     for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++)
     {
         if (clsHWLS.FBLOCK.FBlock[i].parentBlock == currBlock)
         {
             if (clsHWLS.FBLOCK.FBlock[i].SESE == true)
             {
                 gProAnalyzer.Ultilities.reduceGraph.reduce_SESE(ref graph, currentN, clsSESE, workSESE, orgIndex);
             }
             if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndex].nEntry == 1)
             {
                 gProAnalyzer.Ultilities.reduceGraph.reduce_Loop(ref graph, currentN, ref clsLoop, workLoop, orgIndex, "", false);
             }
             //if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndex].nEntry > 1)
             //reduceG.reduce_IrLoop(ref graph, currentN, clsLoop, workLoop, orgIndex);
         }
     }
 }
Exemplo n.º 3
0
        public void total_reduceSubgraph(ref GraphVariables.clsGraph graph, int currentN, GraphVariables.clsHWLS clsHWLS, GraphVariables.clsLoop clsLoop, int workLoop,
                                         GraphVariables.clsSESE clsSESE, int workSESE, int stopDepth) //Reduce all the loops inside (NL, IL)
        {
            int curDepth = clsHWLS.FBLOCK.maxDepth;

            if (curDepth == stopDepth)
            {
                return;
            }
            //curDepth = 1;
            do
            {
                for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++)
                {
                    if (clsHWLS.FBLOCK.FBlock[i].depth != curDepth)
                    {
                        continue;
                    }
                    int orgIndx = clsHWLS.FBLOCK.FBlock[i].refIndex;

                    //If SESE => Make subnetwork and find Dominator Behavior relation matrix (1 matrix)
                    if (clsHWLS.FBLOCK.FBlock[i].SESE)
                    {
                        reduce_SESE(ref graph, currentN, clsSESE, workSESE, orgIndx);
                    }

                    //If NL => Make subnetwork and find Dom/ Pdom Behavior relation matrix (2 matrices)
                    if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndx].nEntry == 1)
                    {
                        reduce_Loop(ref graph, currentN, ref clsLoop, workLoop, orgIndx, "", false);
                    }

                    //if IL => Find CIPd => Make subnetwork with CIPd and find Dom/ Pdom Behavior relation matrix (2 matrices)
                    if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndx].nEntry > 1)
                    {
                        reduce_IrLoop(ref graph, currentN, clsLoop, workLoop, orgIndx);
                    }
                }
                curDepth--;
            } while (curDepth > stopDepth);
        }
Exemplo n.º 4
0
        public void build_loopDAG(ref GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsLoop clsLoop, int currentLoop,
                                  ref GraphVariables.clsSESE clsSESE, ref GraphVariables.clsLoopDAG clsLoopDAG, int currentLoopDAG)
        {
            int init_n = Initialize_loopDAG(graph, currentN, clsLoop, currentLoop);

            clsLoopDAG.loopDAG[currentLoopDAG].loopDAG  = new GraphVariables.clsLoopDAG.strLoopDAGInfo[init_n];
            clsLoopDAG.loopDAG[currentLoopDAG].nLoopDAG = 0;

            //clsLoopDAG.loopDAG[currentLoopDAG].loopDAG[1].DAG.header;

            //int count_loopDAG = 0;

            for (int i = 0; i < clsLoop.Loop[currentLoop].nLoop; i++)
            {
                gProAnalyzer.GraphVariables.clsLoop.strLoopInform loop = clsLoop.Loop[currentLoop].Loop[i];
                if (loop.nEntry == 1) //NL
                {
                    gProAnalyzer.Ultilities.makeSubNetwork.make_subNetwork(ref graph, currentN, graph.acyclicNet, ref clsLoop, currentLoop, i, ref clsSESE, "FF", -1);
                }
                else //IL
                {
                }
            }
        }
Exemplo n.º 5
0
        public static void make_NestingForest(ref GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsHWLS clsHWLS, ref GraphVariables.clsLoop clsLoop,
                                              int workLoop, ref GraphVariables.clsSESE clsSESE, int workSESE)
        {
            int bIndex = 0;

            //FBLOCK.FBlock = new strFBlock[SESE[currentSESE].nSESE + Loop[currentLoop].nLoop];
            if (workSESE >= 0 && workLoop >= 0)
            {
                clsHWLS.FBLOCK.FBlock = new GraphVariables.clsHWLS.strFBlock[clsSESE.SESE[workSESE].nSESE + clsLoop.Loop[workLoop].nLoop];
            }
            else
            {
                if (workSESE >= 0)
                {
                    clsHWLS.FBLOCK.FBlock = new GraphVariables.clsHWLS.strFBlock[clsSESE.SESE[workSESE].nSESE];
                }
                else
                {
                    clsHWLS.FBLOCK.FBlock = new GraphVariables.clsHWLS.strFBlock[clsLoop.Loop[workLoop].nLoop];
                }
            }

            //Copy SESE
            if (workSESE >= 0 && clsSESE.SESE[workSESE].nSESE > 0)
            {
                //copy SESE and LOOP to FBlock;
                for (int i = 0; i < clsSESE.SESE[workSESE].nSESE; i++)
                {
                    //copy SESE to FBlock
                    //FBlock[bIndex].child = SESE[currentSESE].SESE[i].child;
                    //FBlock[bIndex].depth = SESE[currentSESE].SESE[i].depth;
                    clsHWLS.FBLOCK.FBlock[bIndex].Entry    = new int[1];
                    clsHWLS.FBLOCK.FBlock[bIndex].Entry[0] = clsSESE.SESE[workSESE].SESE[i].Entry;
                    clsHWLS.FBLOCK.FBlock[bIndex].Exit     = new int[1];
                    clsHWLS.FBLOCK.FBlock[bIndex].Exit[0]  = clsSESE.SESE[workSESE].SESE[i].Exit;
                    clsHWLS.FBLOCK.FBlock[bIndex].nEntry   = 1;
                    clsHWLS.FBLOCK.FBlock[bIndex].nExit    = 1;
                    clsHWLS.FBLOCK.FBlock[bIndex].Node     = clsSESE.SESE[workSESE].SESE[i].Node;
                    clsHWLS.FBLOCK.FBlock[bIndex].nNode    = clsSESE.SESE[workSESE].SESE[i].nNode;
                    //FBlock[bIndex].parentBlock ??
                    clsHWLS.FBLOCK.FBlock[bIndex].SESE     = true;
                    clsHWLS.FBLOCK.FBlock[bIndex].refIndex = i;
                    bIndex++;
                }
            }

            //Copy Loop
            if (workLoop >= 0 && clsLoop.Loop[workLoop].nLoop > 0)
            {
                copy_Loop(ref clsLoop, workLoop, clsLoop.newTempLoop);
                //modify tempLoop => expand the node
                for (int i = 0; i < clsLoop.Loop[clsLoop.newTempLoop].nLoop; i++)
                {
                    if (clsLoop.Loop[clsLoop.newTempLoop].Loop[i].parentLoop != -1)
                    {
                        continue;                                                             //only start with the outter loop //Log: Otc28_2020
                    }
                    //MAKE A SLIGHT CHANGE HERE ======================================
                    //if (clsLoop.Loop[clsLoop.newTempLoop].Loop[i].depth != 1) continue;
                    int   n    = 0;
                    int[] temp = GetFullNode(ref graph, currentN, ref clsLoop, clsLoop.newTempLoop, i, ref n); //get full node of Loop (newTempLoop) update this loop and all child (including header)
                    //remove redundancy in Loop[i].Node[];
                    //temp = removeRedundancyNode(temp);
                }
                //copy Loop to FBlock
                for (int i = 0; i < clsLoop.Loop[clsLoop.newTempLoop].nLoop; i++)
                {
                    //FBlock[bIndex].child = ??
                    //FBlock[bIndex].depth = ??
                    clsHWLS.FBLOCK.FBlock[bIndex].Entry  = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].Entry;
                    clsHWLS.FBLOCK.FBlock[bIndex].Exit   = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].Exit;
                    clsHWLS.FBLOCK.FBlock[bIndex].nEntry = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].nEntry;
                    clsHWLS.FBLOCK.FBlock[bIndex].nExit  = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].nExit;
                    clsHWLS.FBLOCK.FBlock[bIndex].Node   = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].Node;
                    clsHWLS.FBLOCK.FBlock[bIndex].nNode  = clsLoop.Loop[clsLoop.newTempLoop].Loop[i].nNode;
                    //FBlock[bIndex].parentBlock = ??
                    clsHWLS.FBLOCK.FBlock[bIndex].SESE     = false;
                    clsHWLS.FBLOCK.FBlock[bIndex].refIndex = i;
                    bIndex++;
                }
            }

            clsHWLS.FBLOCK.nFBlock = bIndex;

            //remove same block
            check_Block_Same(ref clsHWLS);
            //Find parent block
            for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++)
            {
                int j = find_nearestParentBlock(ref clsHWLS, i);
                clsHWLS.FBLOCK.FBlock[i].parentBlock = j;
            }
            //find Children
            for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++)
            {
                int[] child_of_i = new int[clsHWLS.FBLOCK.nFBlock];
                int   nChild     = 0;
                for (int j = 0; j < clsHWLS.FBLOCK.nFBlock; j++)
                {
                    if (clsHWLS.FBLOCK.FBlock[j].parentBlock == i)
                    {
                        child_of_i[nChild] = j;
                        nChild++;
                    }
                }
                clsHWLS.FBLOCK.FBlock[i].child  = child_of_i;
                clsHWLS.FBLOCK.FBlock[i].nChild = nChild;
            }
            //find Depth
            clsHWLS.FBLOCK.maxDepth = 0;
            //int maxDepth = 0;
            int curDepth = 0;

            for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++)
            {
                curDepth = 1;
                //FBLOCK.maxDepth = 1;
                if (clsHWLS.FBLOCK.FBlock[i].parentBlock != -1)
                {
                    continue;
                }
                clsHWLS.FBLOCK.FBlock[i].depth = curDepth;
                find_BlockDepth(ref clsHWLS, i, ref curDepth);
            }
            if (clsHWLS.FBLOCK.nFBlock > 0 && clsHWLS.FBLOCK.maxDepth == 0)
            {
                clsHWLS.FBLOCK.maxDepth = 1;
            }
        }
Exemplo n.º 6
0
        //Get concurrency combination of IL<entries> from their CID (Output => SubNet)
        public static void check_Concurrency(ref GraphVariables.clsGraph graph, int currentN, int conNet, int subNet, GraphVariables.clsLoop clsLoop, int workLoop, int loop, ref GraphVariables.clsSESE clsSESE)
        {
            Initialize_All();

            //make_ConcurrencyFlow
            graph.Network[conNet] = graph.Network[currentN]; //CIDFlow begining is stored in conNet (Network[8])
            gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, conNet, 0, 0);

            gProAnalyzer.Ultilities.copyLoop.copy_Loop(ref clsLoop, workLoop, clsLoop.tempLoop);

            //reduce all loop except "loop" and its parents. (Applied NEW TYPE OF IL REDUCTION) ==>> REDUCE SAME DEPTH??? => ITS OK!!
            gProAnalyzer.Ultilities.reduceGraph.Preprocessing_total_reduceSubgraph(ref graph, conNet, clsLoop, workLoop, loop);

            //make DFlow() + CID in this procedure.
            gProAnalyzer.Ultilities.makeSubNetwork.make_subNetwork(ref graph, conNet, subNet, ref clsLoop, clsLoop.tempLoop, loop, ref clsSESE, "CC", -1); //find concurrency set
            //============ (by pass) using "CC" subgraph to find other parameter (just lazy) ==============
            DFlow_IL_Flow        = null;
            nNodeDFlow_IL        = 0;
            expand_DFlow_IL_Flow = null; //combine DFlow+IL and expand nested loops (if any)
            expand_nNodeDFlow_IL = 0;

            DFlow         = null;
            nDFlow        = 0;
            expand_DFlow  = null;
            expand_nDFlow = 0;

            orgCID = getCID_IL(graph, conNet, clsLoop, workLoop, loop); //CID of original graph index (All entries)

            expand_boundaryNodes = getBoundaryNode(graph, conNet, subNet, clsLoop, workLoop, loop, ref expand_DFlow_IL_Flow, ref expand_nNodeDFlow_IL, ref expand_DFlow, ref expand_nDFlow, true);
            boundaryNodes        = getBoundaryNode(graph, conNet, subNet, clsLoop, workLoop, loop, ref DFlow_IL_Flow, ref nNodeDFlow_IL, ref DFlow, ref nDFlow, false);
            //==============================================================================================

            gProAnalyzer.Ultilities.makeSubNetwork.make_subGraph_DFlow(ref graph, conNet, subNet, ref clsLoop, clsLoop.tempLoop, loop, DFlow, nDFlow, boundaryNodes, orgCID); //subgraph contains DFlow + boundaryNode

            //========>>>>> NEED FIX THE CONCURRENT ENTRY SET IDENTIFICATION => Recording all set, not optimize anything
            make_ConcurrencyInstance(graph, subNet, ref clsLoop, clsLoop.tempLoop, loop); //find concurrency entry sets using DFlow() => store in clsLoop.
            //========>>>>> MUST FIX <<<<<============

            //some ERRORS here, check it for QUERY paper (Next paper)
            make_ConcurrencyInstance_Untangling(ref graph, subNet, ref clsLoop, clsLoop.tempLoop, loop); //find the instanceNode to each concurrencySet => store in clsLoop also

            //copy concurrency inform =============== THIS IS FOR THE VERIFICATION PAPER ONLY
            clsLoop.Loop[workLoop].Loop[loop].nConcurrency = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nConcurrency; //tranfer all the concurrency value from tempLoop [3] to workloop [2]
            if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].Concurrency != null)
            {
                clsLoop.Loop[workLoop].Loop[loop].Concurrency = new int[clsLoop.Loop[workLoop].Loop[loop].nEntry];
                for (int k = 0; k < clsLoop.Loop[workLoop].Loop[loop].nEntry; k++)
                {
                    clsLoop.Loop[workLoop].Loop[loop].Concurrency[k] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].Concurrency[k];
                }
            }

            //copy InstanceNode_DFlow to workLoop - Concurrent Entry
            clsLoop.Loop[workLoop].Loop[loop].nConcurrInst = new int[clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nConcurrInst.Length]; //tranfer all the concurrency value from tempLoop [3] to workloop [2]
            for (int i = 0; i < clsLoop.Loop[workLoop].Loop[loop].nConcurrInst.Length; i++)
            {
                clsLoop.Loop[workLoop].Loop[loop].nConcurrInst[i] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nConcurrInst[i];
            }

            if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].concurrInst != null)
            {
                clsLoop.Loop[workLoop].Loop[loop].concurrInst = new int[clsLoop.Loop[workLoop].Loop[loop].nConcurrInst.Length][];
                for (int k = 0; k < clsLoop.Loop[workLoop].Loop[loop].nConcurrInst.Length; k++)
                {
                    if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].concurrInst[k] == null)
                    {
                        continue;
                    }
                    clsLoop.Loop[workLoop].Loop[loop].concurrInst[k] = new int[clsLoop.Loop[clsLoop.tempLoop].Loop[loop].concurrInst[k].Length];
                    for (int l = 0; l < clsLoop.Loop[workLoop].Loop[loop].nConcurrInst[k]; l++)
                    {
                        clsLoop.Loop[workLoop].Loop[loop].concurrInst[k][l] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].concurrInst[k][l];
                    }
                }
            }

            //copy InstanceNode_DFlow to workLoop - Exclusive entries
            clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst = new int[clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nExclusiveInst.Length]; //tranfer all the concurrency value from tempLoop [3] to workloop [2]
            for (int i = 0; i < clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst.Length; i++)
            {
                clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst[i] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].nExclusiveInst[i];
            }

            if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].exclusiveInst != null)
            {
                clsLoop.Loop[workLoop].Loop[loop].exclusiveInst = new int[clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst.Length][];
                for (int k = 0; k < clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst.Length; k++)
                {
                    if (clsLoop.Loop[clsLoop.tempLoop].Loop[loop].exclusiveInst[k] == null)
                    {
                        continue;
                    }
                    clsLoop.Loop[workLoop].Loop[loop].exclusiveInst[k] = new int[clsLoop.Loop[clsLoop.tempLoop].Loop[loop].exclusiveInst[k].Length];
                    for (int l = 0; l < clsLoop.Loop[workLoop].Loop[loop].nExclusiveInst[k]; l++)
                    {
                        clsLoop.Loop[workLoop].Loop[loop].exclusiveInst[k][l] = clsLoop.Loop[clsLoop.tempLoop].Loop[loop].exclusiveInst[k][l];
                    }
                }
            }
            //output is the model in Network.SUBNET
            //output: Get Concurrency[] and ConcurrencyInst of DFlow().
        }
Exemplo n.º 7
0
        public static void start_Indexing(ref GraphVariables.clsGraph graph, ref GraphVariables.clsHWLS clsHWLS, ref GraphVariables.clsHWLS clsHWLS_Untangle,
                                          ref GraphVariables.clsLoop clsLoop, ref GraphVariables.clsSESE clsSESE, bool[] flag_Check)
        {
            Initialize_All();

            gProAnalyzer.Functionalities.NodeSplittingType1.Run_Split_Type1(ref graph, graph.orgNet, graph.midNet);

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

            graph.Network[graph.finalNet] = graph.Network[graph.midNet];
            gProAnalyzer.Functionalities.NodeSplittingType2.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);

            gProAnalyzer.Functionalities.SESEIdentification.find_SESE_WithLoop(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);

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

            int  workNet       = graph.finalNet;
            int  workLoop      = clsLoop.orgLoop;
            int  workSESE      = clsSESE.finalSESE;
            bool checkUntangle = false;

            //Untangling of Irreducible loops ==> USING UNTANGLE NET only (new graph)
            if (gProAnalyzer.Functionalities.UntanglingIL.make_UntanglingIL(ref graph, graph.finalNet, graph.untangleNet, clsHWLS, clsLoop, clsLoop.orgLoop, clsSESE, clsSESE.finalSESE))
            {
                //return;

                //frmAnl.displayProcessModel(ref graph, graph.untangleNet, ref clsLoop, -1, ref clsSESE, -1);
                //frmAnl.Show();
                //return;
                gProAnalyzer.Functionalities.NodeSplittingType1.Run_Split_Type1(ref graph, graph.untangleNet, graph.midNet);
                gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, graph.midNet, ref clsLoop, clsLoop.untangleLoop, ref clsLoop.IrreducibleError);
                gProAnalyzer.Functionalities.NodeSplittingType2.Run_Split_Type2(ref graph, graph.midNet, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop);

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

                gProAnalyzer.Functionalities.SESEIdentification.find_SESE_WithLoop(ref graph, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop, ref clsSESE, clsSESE.untangleSESE, -2);
                gProAnalyzer.Functionalities.NodeSplittingType3.Run_Split_Type3(ref graph, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop, ref clsSESE, clsSESE.untangleSESE, true);
                gProAnalyzer.Ultilities.makeNestingForest.make_NestingForest(ref graph, graph.untangleNet, ref clsHWLS_Untangle, ref clsLoop, clsLoop.untangleLoop, ref clsSESE, clsSESE.untangleSESE);

                workNet       = graph.untangleNet;
                workLoop      = clsLoop.untangleLoop;
                workSESE      = clsSESE.untangleSESE;
                checkUntangle = true;

                graph.check_untangle = true;

                //frmAnl.displayProcessModel(ref graph, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop, ref clsSESE, clsSESE.untangleSESE);
                //frmAnl.Show();
            }

            //== get initial behavior profile ==
            graph.Network[graph.reduceNet] = graph.Network[workNet];
            gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, graph.reduceNet, 0, 0);
            if (checkUntangle)
            {
                get_InitialBehaviorProfile(ref graph, graph.reduceNet, ref clsHWLS_Untangle, ref clsLoop, workLoop, ref clsSESE, workSESE, flag_Check);
            }
            else
            {
                get_InitialBehaviorProfile(ref graph, graph.reduceNet, ref clsHWLS, ref clsLoop, workLoop, ref clsSESE, workSESE, flag_Check);
            }
            //Database storing
        }
Exemplo n.º 8
0
        //Build behavior profile for each header of each decomposed acyclic structure. each matrix for each pair?
        public static void get_InitialBehaviorProfile(ref GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsHWLS clsHWLS,
                                                      ref GraphVariables.clsLoop clsLoop, int workLoop, ref GraphVariables.clsSESE clsSESE, int workSESE, bool[] flag_Check)
        {
            //input: a decomposed DAG
            //output: behavior profile of it header and its children

            //makeSubNetwork of clsDASPT
            //make instantFlow (AnalyseBehavior_InstF) of HEADER and its childs.
            //create behaviorProfile matrix for HEADER

            Initialize_All();
            //bool[] flag_Check = new bool[8];

            int curDepth = clsHWLS.FBLOCK.maxDepth;

            //curDepth = 1;
            do
            {
                for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++)
                {
                    if (clsHWLS.FBLOCK.FBlock[i].depth != curDepth)
                    {
                        continue;
                    }
                    int orgIndx = clsHWLS.FBLOCK.FBlock[i].refIndex;

                    //If SESE => Make subnetwork and find Dominator Behavior relation matrix (1 matrix)
                    if (clsHWLS.FBLOCK.FBlock[i].SESE)
                    {
                        //Make subnet
                        gProAnalyzer.Ultilities.makeSubNetwork.make_subNetwork(ref graph, currentN, graph.subNet, ref clsLoop, workSESE, orgIndx, ref clsSESE, "SESE", -1);

                        int    nNode        = graph.Network[graph.subNet].nNode;
                        int    x            = graph.Network[graph.subNet].Node[graph.Network[graph.subNet].header].Post[0];
                        bool[] returnBhPrfl = new bool[8];

                        clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl       = new int[9, nNode + 1];
                        clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[x].orgNum; //ENTRY SESE org index.
                        clsHWLS.FBLOCK.FBlock[i].nDomBh           = 1;
                        //get behavior matrix of SESE ENTRY
                        for (int j = 0; j < graph.Network[graph.subNet].nNode; j++)
                        {
                            int y = j;
                            if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1)
                            {
                                continue;                                                             //Exclude VS, VE
                            }
                            gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check);
                            store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[x].orgNum, graph.Network[graph.subNet].Node[y].orgNum, returnBhPrfl, true);
                        }
                        //reduce current Block LASTLY (already imply by depth pick)
                        gProAnalyzer.Ultilities.reduceGraph.reduce_SESE(ref graph, currentN, clsSESE, workSESE, orgIndx);
                    }

                    //If NL => Make subnetwork and find Dom/ Pdom Behavior relation matrix (2 matrices)
                    if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndx].nEntry == 1)
                    {
                        //Make subnet
                        gProAnalyzer.Ultilities.makeSubNetwork.make_AcyclicSubGraph(ref graph, currentN, graph.subNet, ref clsLoop, workLoop, orgIndx, "NL");

                        int nNode = graph.Network[graph.subNet].nNode;
                        int x, y;

                        //get behavior matrix of HEADER ENTRY and its childs
                        x = graph.Network[graph.subNet].Node[graph.Network[graph.subNet].header].Post[0];       //Get NL Loop HEADER
                        bool[] returnBhPrfl = new bool[8];
                        clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl       = new int[9, nNode + 2];                      //store itself behavior
                        clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[x].orgNum; //Header org index.
                        clsHWLS.FBLOCK.FBlock[i].nDomBh           = 1;
                        for (int j = 0; j < graph.Network[graph.subNet].nNode; j++)
                        {
                            y = j;
                            if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1)
                            {
                                continue;
                            }
                            gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check);
                            store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[x].orgNum, graph.Network[graph.subNet].Node[y].orgNum, returnBhPrfl, true);
                        }

                        //get behavior matrix of Its childs and HEADER (Pdom)
                        y = get_NodeByName(graph, graph.subNet, "V_HEADER");
                        if (y == -1)
                        {
                            continue;
                        }
                        returnBhPrfl = new bool[8];
                        clsHWLS.FBLOCK.FBlock[i].Pdom_BhPrfl       = new int[9, nNode + 2];
                        clsHWLS.FBLOCK.FBlock[i].Pdom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[y].orgNum; //Header index.
                        clsHWLS.FBLOCK.FBlock[i].nPdomBh           = 1;
                        for (int j = 0; j < graph.Network[graph.subNet].nNode; j++)
                        {
                            x = j;
                            if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1)
                            {
                                continue;
                            }
                            gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check);
                            store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[y].orgNum, graph.Network[graph.subNet].Node[x].orgNum, returnBhPrfl, false);
                        }
                        //reduce current Block (NL)
                        gProAnalyzer.Ultilities.reduceGraph.reduce_Loop(ref graph, currentN, ref clsLoop, workLoop, orgIndx, "", false);
                    }

                    //if IL => Find CIPd => Make subnetwork with CIPd and find Dom/ Pdom Behavior relation matrix (2 matrices)
                    if (clsHWLS.FBLOCK.FBlock[i].SESE == false && clsLoop.Loop[workLoop].Loop[orgIndx].nEntry > 1)
                    {
                        //Make subnet
                        gProAnalyzer.Ultilities.makeSubNetwork.make_AcyclicSubGraph(ref graph, currentN, graph.subNet, ref clsLoop, workLoop, orgIndx, "IL");

                        int nNode = graph.Network[graph.subNet].nNode;
                        int x, y;

                        //get behavior matrix of HEADER ENTRY and its childs
                        x = graph.Network[graph.subNet].Node[graph.Network[graph.subNet].header].Post[0]; //Get CIPd of IL
                        clsHWLS.FBLOCK.FBlock[i].CIPd = graph.Network[graph.subNet].Node[x].orgNum;
                        bool[] returnBhPrfl = new bool[8];
                        clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl       = new int[9, nNode + 2];                      //store itself behavior
                        clsHWLS.FBLOCK.FBlock[i].Dom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[x].orgNum; //CIPd org index.
                        clsHWLS.FBLOCK.FBlock[i].nDomBh           = 1;
                        for (int j = 0; j < graph.Network[graph.subNet].nNode; j++)
                        {
                            y = j;
                            if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1)
                            {
                                continue;
                            }
                            gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check);
                            store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[x].orgNum, graph.Network[graph.subNet].Node[y].orgNum, returnBhPrfl, true);
                        }
                        //combine from CID(x, y) ==>> MISSING => SOLVED (no need)

                        //get behavior matrix of Its childs and HEADER (Pdom)
                        y = get_NodeByName(graph, graph.subNet, "V_CIPd");
                        if (y == -1)
                        {
                            continue;
                        }
                        returnBhPrfl = new bool[8];
                        clsHWLS.FBLOCK.FBlock[i].Pdom_BhPrfl       = new int[9, nNode + 2];
                        clsHWLS.FBLOCK.FBlock[i].Pdom_BhPrfl[0, 0] = graph.Network[graph.subNet].Node[y].orgNum; //Header index.
                        clsHWLS.FBLOCK.FBlock[i].nPdomBh           = 1;
                        for (int j = 0; j < graph.Network[graph.subNet].nNode; j++)
                        {
                            x = j;
                            if (x == y || graph.Network[graph.subNet].Node[x].orgNum == -1)
                            {
                                continue;
                            }
                            gProAnalyzer.Ultilities.AnalyseBehavior_InstF.check_InstanceBehavior(graph, graph.subNet, x, y, ref returnBhPrfl, flag_Check);
                            store_BehaviorProfile(ref clsHWLS, i, graph.Network[graph.subNet].Node[y].orgNum, graph.Network[graph.subNet].Node[x].orgNum, returnBhPrfl, false);
                        }
                        //combine from CID(x, y) ==>> MISSING => SOLVED (no need)

                        //reduce current Block (IL)
                        gProAnalyzer.Ultilities.reduceGraph.reduce_IrLoop(ref graph, currentN, clsLoop, workLoop, orgIndx);
                    }
                }
                curDepth--;
            } while (curDepth > 0);
        }
Exemplo n.º 9
0
        public static void start_Indexing_Acyclic(ref GraphVariables.clsGraph graph, ref GraphVariables.clsHWLS clsHWLS, ref GraphVariables.clsHWLS clsHWLS_Untangle,
                                                  ref GraphVariables.clsLoop clsLoop, ref GraphVariables.clsSESE clsSESE, bool[] flag_Check)
        {
            Initialize_All();

            gProAnalyzer.Functionalities.NodeSplittingType1.Run_Split_Type1(ref graph, graph.orgNet, graph.midNet);

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

            graph.Network[graph.finalNet] = graph.Network[graph.midNet];
            gProAnalyzer.Functionalities.NodeSplittingType2.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);

            gProAnalyzer.Functionalities.SESEIdentification.find_SESE_WithLoop(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);

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

            GraphVariables.clsError clsError = new gProAnalyzer.GraphVariables.clsError();

            //Fix each SOS entry for Bond and Rigid
            gProAnalyzer.Functionalities.VerificationG.Initialize_Verification(ref graph, ref clsError, ref clsLoop, ref clsSESE, ref clsHWLS);


            //verify bond first =>>

            int workNet  = graph.finalNet;
            int workLoop = clsLoop.orgLoop;
            int workSESE = clsSESE.finalSESE;

            //== get initial behavior profile ==
            graph.Network[graph.reduceNet] = graph.Network[workNet];
            gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, graph.reduceNet, 0, 0);
            get_InitialBehaviorProfile(ref graph, graph.reduceNet, ref clsHWLS, ref clsLoop, workLoop, ref clsSESE, workSESE, flag_Check);
            //Database storing
        }
Exemplo n.º 10
0
        public static string Bond_Check(ref GraphVariables.clsGraph graph, int currentN, ref GraphVariables.clsSESE clsSESE, int workSESE, int currentSESE, ref GraphVariables.clsHWLS clsHWLS) //should upgrade bond check ===
        {
            int count_gateway = 0;
            //check SESE nested with Loops (2 cases) (if SESE have at least 1 directly child is loop => rigid.
            int f_index = getFblockIndex(currentSESE, clsHWLS);

            for (int i = 0; i < clsHWLS.FBLOCK.FBlock[f_index].nChild; i++)
            {
                int child = clsHWLS.FBLOCK.FBlock[f_index].child[i];
                if (clsHWLS.FBLOCK.FBlock[child].SESE == false && !(clsHWLS.FBLOCK.FBlock[child].nEntry == 1 && clsHWLS.FBLOCK.FBlock[child].nExit == 1))
                {
                    return("R");
                }
            }

            for (int i = 0; i < clsSESE.SESE[workSESE].SESE[currentSESE].nNode; i++)
            {
                int node = clsSESE.SESE[workSESE].SESE[currentSESE].Node[i];
                if (Node_In_SESE(clsSESE, workSESE, node, currentSESE))
                {
                    if (graph.Network[currentN].Node[node].nPre > 1 || graph.Network[currentN].Node[node].nPost > 1)
                    {
                        count_gateway++;
                        if (count_gateway > 2)
                        {
                            return("R");
                        }
                    }
                }
            }
            if (count_gateway == 0)
            {
                return("P");
            }

            return("B");
        }
Exemplo n.º 11
0
        public static bool make_UntanglingIL(ref GraphVariables.clsGraph graph, int currentN, int untangleNet, GraphVariables.clsHWLS clsHWLS, GraphVariables.clsLoop clsLoop, int workLoop,
                                             GraphVariables.clsSESE clsSESE, int workSESE)
        {
            Initialize_All();

            bool existUntangle = false;

            //scan for all IL and analyze at the lowest lever first.

            graph.Network[untangleNet] = graph.Network[currentN];
            gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, untangleNet, 0, 0); //now work in untangleNet

            gProAnalyzer.Ultilities.copyLoop.copy_Loop(ref clsLoop, workLoop, clsLoop.untangleLoop);

            int curDepth = clsHWLS.FBLOCK.maxDepth;

            do
            {
                for (int i = 0; i < clsHWLS.FBLOCK.nFBlock; i++)
                {
                    if (clsHWLS.FBLOCK.FBlock[i].depth != curDepth || clsHWLS.FBLOCK.FBlock[i].nEntry == 1)
                    {
                        continue;                                                                                     //only get IL
                    }
                    int orgLoopIndx = clsHWLS.FBLOCK.FBlock[i].refIndex;

                    int newLoopIndx = find_newLoopIndex(graph, untangleNet, clsLoop, workLoop, clsLoop.untangleLoop, orgLoopIndx);

                    gProAnalyzer.Ultilities.findConcurrencyEntriesIL.check_Concurrency(ref graph, untangleNet, graph.conNet, graph.subNet, clsLoop, clsLoop.untangleLoop, newLoopIndx, ref clsSESE); //concurrency[] and concurrencyInst[] were found in clsLoop.

                    //find CID again =>
                    int CID = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.orgCID;
                    //we can access searchNode[] in fndConcurrencyIL to get DF => then find boundaries nodes of current IL
                    int[] DFlow_IL_Flow        = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.DFlow_IL_Flow;;
                    int   nNodeDFlow_IL        = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.nNodeDFlow_IL;
                    int[] expand_DFlow_IL_Flow = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_DFlow_IL_Flow;
                    int   expand_nNodeDFlow_IL = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_nNodeDFlow_IL;

                    int[] DFlow         = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.DFlow;
                    int   nDFlow        = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.nDFlow;
                    int[] expand_DFlow  = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_DFlow;
                    int   expand_nDFlow = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_nDFlow;

                    int[] boundaryNodes       = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.boundaryNodes;//get the boundaryNode of currentN graph.
                    int[] expand_boundaryNode = gProAnalyzer.Ultilities.findConcurrencyEntriesIL.expand_boundaryNodes;

                    //check whether need to untangle the IL or not? => if need -> next step (Check PdFlow? also)
                    if (!check_UntanglingIL(clsLoop, clsLoop.untangleLoop, newLoopIndx))
                    {
                        continue;
                    }

                    graph.Network[graph.nickNet] = graph.Network[untangleNet];
                    gProAnalyzer.Ultilities.extendGraph.full_extentNetwork(ref graph, graph.nickNet, 0, 0);                                                                        //Using NICKNET for reference of Link
                    remove_DFlow_IL(ref graph, untangleNet, ref clsLoop, clsLoop.untangleLoop, newLoopIndx, expand_boundaryNode, CID, expand_DFlow_IL_Flow, expand_nNodeDFlow_IL); //must use expand version

                    //Next: make_subNet of new Untangling subGraph based on concurrencyInst[] of current IL
                    //Next: plug into original network + expand loops in DFlow (if any) - links/ edges' index should be modified also
                    gProAnalyzer.Ultilities.makeSubNetwork.combine_subGraph_Untangling(ref graph, graph.nickNet, untangleNet, graph.conNet, graph.subNet, graph.dummyNet, clsLoop, clsLoop.untangleLoop, newLoopIndx,
                                                                                       expand_boundaryNode, boundaryNodes, CID); //using subNet as referrence    (also //Using NICKNET for reference of Link)

                    //return true;

                    //final step => polishing the subgraph by removing some unnecessary node (gateways only have 1 incoming/ outgoing edge?)
                    //remove disconnected nodes (~ mark Done = true)
                    removing_disconnectedNode(ref graph, untangleNet);

                    existUntangle = true; //At least done 1 untangle of 1 IL
                    //return true;;


                    for (int k = 0; k < graph.Network[untangleNet].nNode; k++)
                    {
                        gProAnalyzer.Ultilities.clsFindNodeInfo.find_NodeInfo(ref graph, untangleNet, k);
                    }
                    gProAnalyzer.Functionalities.NodeSplittingType1.Run_Split_Type1(ref graph, graph.untangleNet, graph.midNet);
                    gProAnalyzer.Functionalities.LoopIdentification.Run_FindLoop(ref graph, graph.midNet, ref clsLoop, clsLoop.untangleLoop, ref clsLoop.IrreducibleError);
                    gProAnalyzer.Functionalities.NodeSplittingType2.Run_Split_Type2(ref graph, untangleNet, graph.untangleNet, ref clsLoop, clsLoop.untangleLoop);
                }
                curDepth--;
            } while (curDepth > 0);

            //find PRE/POST DOM/ PDOM + LOOP + SESE + Node splitting again
            for (int i = 0; i < graph.Network[untangleNet].nNode; i++)
            {
                gProAnalyzer.Ultilities.clsFindNodeInfo.find_NodeInfo(ref graph, untangleNet, i);
            }

            return(existUntangle);
        }