Exemplo n.º 1
0
        protected CNF2Result StronglyCoherentComponents()
        {
            var result = new CNF2Result();

            // dfs
            DFS();

            // graph transposition
            var transposedGraph = TransposeGraph(_graph);

            // DSF na transponowanym grafie, ale główna pętla DFS analizuje wierzchołki w kolejności
            // wartości czasu przetworzenia, czyli ProcessingTime
            result.StronglyCoherentComponents = CreateStronglyCoherentComponents(transposedGraph);

            // sprawdzenie czy kazda silnie spojna skladowa jest ok, tzn czy nie ma w niej np a i ~a
            for (int i = 0; i < result.StronglyCoherentComponents.Count; i++)
            {
                if (!result.StronglyCoherentComponents[i].IsValid())
                {
                    result.IsValidResult = false;
                    return(result);
                }
            }

            // utworzenie sąsiadów dla silnie spójnych składowych
            CreateNeighoursInCoherentComponents(result.StronglyCoherentComponents);

            // ustawienie wartości dla silnie spójnych składowych (0,1)
            var stronglyCoherentComponentsTransposed = result.StronglyCoherentComponents.OrderByDescending(x => x.ProcessingTime)
                                                       .ToList();

            SetLogicValuesInCoherentComponents(stronglyCoherentComponentsTransposed);

            return(result);
        }
Exemplo n.º 2
0
        public virtual async Task Start()
        {
            await Task.Run(() =>
            {
                _stopwatch.Start();

                _result = StronglyCoherentComponents();

                _stopwatch.Stop();
                LastActionTime = _stopwatch.Elapsed;
            });
        }