示例#1
0
        public override void CreateTArbSeqCFG(uint[] states)
        {
            log.Info("Building TArbSeqCFG");

            Ensure.That(meapContext.AcceptingNodes).HasItems();

            log.Info("Create sink node");
            CreateSinkNode();

            log.Info("Connect bottomNodes with sink node");
            ConnectBottomNodesWithSinkNode(G, states);

            log.Info("Create TArbSeqGraph copy");
            TypedDAG <TASGNodeInfo, StdEdgeInfo> cfg = new("CFG");

            DAG.CreateCopy(G, cfg);
            cfg.CopyIdToNodeInfoMap(idToInfoMap);

            log.Info("Cut chains");
            meapContext.TArbSeqCFG = new TypedDAG <TASGNodeInfo, StdEdgeInfo>("CFG");
            DAG.CutChains(cfg, meapContext.TArbSeqCFG);

            log.Info("Create CFG idToInfoMap");
            meapContext.TArbSeqCFG.CopyIdToNodeInfoMap(idToInfoMap);

            RemoveUnusedNodeVLevels();

            log.InfoFormat(
                "idToInfoMap: {0} {1}",
                idToInfoMap.Count,
                meapContext.TArbSeqCFG.IdToNodeInfoMap.Count);

            Trace_TArbSeqCFG();
        }
示例#2
0
        private void ExcludeDefs()
        {
            foreach (KeyValuePair <long, Commodity> p in meapContext.Commodities)
            {
                Commodity commodity = p.Value;
                long      commVar   = commodity.Variable;

                List <long> toRemove = new();

                foreach (long uNodeId in commodity.Gi.GetInnerNodeIds())
                {
                    ICollection <long> uVars = meapContext.Assignments[uNodeId];

                    if (uVars.Contains(commVar))
                    {
                        toRemove.Add(uNodeId);
                    }
                }

                toRemove.ForEach(r => commodity.Gi.RemoveNode(commodity.Gi.NodeEnumeration[r]));

                toRemove.ForEach(r =>
                                 log.Debug(
                                     "var " + commVar + " " +
                                     commodity.Gi.GetSourceNodeId() + ", " +
                                     commodity.Gi.GetSinkNodeId() +
                                     " remove: " + r));

                DAG newGi = new("Gi");
                DAG.CutChains(commodity.Gi, newGi);
                commodity.Gi = newGi;

                excludedDefs.AddRange(toRemove);
            }

            ICheckDataStructures checkDataStructures = configuration.Get <ICheckDataStructures>();

            checkDataStructures.CheckCommoditiesHaveNoSingleNodes(meapContext);
        }