Exemplo n.º 1
0
        public void CreateCommodityGraphs()
        {
            lock (objectToLock)
            {
                log.DebugFormat(
                    "CreateCommodityGraphs: {0}",
                    meapContext.Commodities.Count);

                foreach (KeyValuePair <long, Commodity> p in meapContext.Commodities)
                {
                    long      commodityId = p.Key;
                    Commodity commodity   = p.Value;

                    DAG Gi = new("Gi");
                    DAG.MakeCommodity(meapContext.TArbSeqCFG, commodity.sNodeId, commodity.tNodeId, Gi);

                    commodity.Gi = Gi;
                }

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

                if (commonOptions.CheckDataStructures)
                {
                    checkDataStructures.CheckCommoditiesHaveNoSingleNodes(meapContext);
                }

                ExcludeDefs();

                if (commonOptions.CheckDataStructures)
                {
                    checkDataStructures.CheckCommoditiesHaveNoSingleNodes(meapContext);
                }
            }
        }
        public override void Run(uint[] states)
        {
            log.InfoFormat("mu: {0}", meapContext.mu);

            CreateTASGBuilder();

            tasgBuilder.CreateTArbitrarySeqGraph();
            tasgBuilder.CreateTArbSeqCFG(states);
            meapContext.TArbSeqCFG.Trace();

            if (meapContext.TArbSeqCFG.IsTrivial())
            {
                return;
            }

            ComputeNodeVLevels(meapContext.TArbSeqCFG);

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

            if (commonOptions.CheckDataStructures)
            {
                checkDataStructures.CheckTASGHasNoBackAndCrossEdges(meapContext.TArbSeqCFG);
            }

            log.DebugFormat("states = {0}", AppHelper.ArrayToString(states));

            IDebugOptions debugOptions = configuration.Get <IDebugOptions>();

            if (!debugOptions.RunRDA)
            {
                return;
            }

            ComputeCommodities();

            DetermineIfExistsTCPath determineIfExistsTCSeq = new(meapContext);

            determineIfExistsTCSeq.RunForMultipleTapeSegs();

            CopyResultFromTapeSegContext();
        }
Exemplo n.º 3
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);
        }
        public override void Run(uint[] states)
        {
            log.InfoFormat("mu: {0}", meapContext.mu);
            log.DebugFormat("states = {0}", AppHelper.ArrayToString(states));

            tasgBuilder.CreateTArbitrarySeqGraph();
            IDebugOptions debugOptions = configuration.Get <IDebugOptions>();

            if (!debugOptions.RunRDA)
            {
                return;
            }

            uint maxMu = meapContext.MEAPSharedContext.CPLTMInfo.PathLength;

            if (meapContext.mu < maxMu)
            {
                return;
            }

            tasgBuilder.CreateTArbSeqCFG(states);

            if (meapContext.TArbSeqCFG.IsTrivial())
            {
                return;
            }

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

            ComputeDUPairs();

            meapContext.CommoditiesBuilder = new CommoditiesBuilderFactCPLTM(meapContext);
            meapContext.CommoditiesBuilder.EnumeratePairs();
            meapContext.Commodities        = meapContext.CommoditiesBuilder.CreateCommodities();
            meapContext.CommoditiesBuilder = default !;
        public override void Run(uint[] states)
        {
            log.InfoFormat("mu: {0}", meapContext.mu);

            ITASGBuilder tasgBuilder = configuration.Get <ITASGBuilder>();

            meapContext.TASGBuilder = tasgBuilder;
            tasgBuilder.meapContext = meapContext;

            tasgBuilder.Init();
            tasgBuilder.CreateTArbitrarySeqGraph();
            tasgBuilder.CreateTArbSeqCFG(states);
            meapContext.TArbSeqCFG.Trace();

            if (meapContext.TArbSeqCFG.IsTrivial())
            {
                return;
            }

            ComputeNodeVLevels(meapContext.TArbSeqCFG);

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

            if (commonOptions.CheckDataStructures)
            {
                checkDataStructures.CheckTASGHasNoBackAndCrossEdges(meapContext.TArbSeqCFG);
            }

            meapContext.DUPairCount       = 0;
            meapContext.TConsistPairCount = 0;

            TConsistPairSetBuilderOrd tConsistPairSetBuilder = new(meapContext);

            tConsistPairSetBuilder.Run();

            log.InfoFormat("defUsePairSet: {0}", meapContext.DUPairCount);
            log.InfoFormat("TConsistPairSet: {0}", meapContext.TConsistPairCount);

            meapContext.CommoditiesBuilder = new CommoditiesBuilderOrd(meapContext);
            meapContext.CommoditiesBuilder.EnumeratePairs();

            IDebugOptions debugOptions = configuration.Get <IDebugOptions>();

            if (debugOptions.ComputeCommoditiesExplicitely)
            {
                meapContext.Commodities = meapContext.CommoditiesBuilder.CreateCommodities();
                meapContext.CommoditiesBuilder.CreateCommodityGraphs();
            }
            else
            {
                meapContext.Commodities = new SortedDictionary <long, Commodity>();
            }

            log.DebugFormat("states = {0}", AppHelper.ArrayToString(states));

            DetermineIfExistsTCPath determineIfExistsTCSeq = new(meapContext);

            determineIfExistsTCSeq.RunForMultipleTapeSegs();

            CopyResultFromTapeSegContext();
        }