/// <summary>
        /// link places which have a lot of predecessors and followers
        /// </summary>
        /// <author>Krystian Zielonka</author>
        private void AddsPlacesTogether()
        {
            foreach (KeyValuePair<String, HashSet<String>> pair in _listOfAllParallelPairs)
            {
                if (_listOfAllPairs.ContainsKey(pair.Key) && _listOfAllPairs[pair.Key].Item2.Overlaps(pair.Value))
                {
                    _listOfAllPairs[pair.Key].Item2.ExceptWith(pair.Value);
                    _listOfAllPairs[pair.Key].Item1.ExceptWith(pair.Value);
                }
            }

            foreach (KeyValuePair<String, Tuple<HashSet<String>, HashSet<String>>> Pair in _listOfAllPairs)
            {
                HashSet<String> _ListOfInComingSet = Pair.Value.Item1;
                HashSet<String> _ListOfOutComingSet = Pair.Value.Item2;

                for (int i = 0; i < _ListOfInComingSet.Count; ++i)
                {
                    String InComingEvent_1 = _ListOfInComingSet.ElementAt(i);

                    HashSet<String> _ListForCombinePlaces = new HashSet<String>() { InComingEvent_1 };

                    for (int j = i + 1; j < _ListOfInComingSet.Count; ++j)
                    {
                        String InComingEvent_2 = _ListOfInComingSet.ElementAt(j);

                        if (!_listOfAllParallelPairs.ContainsKey(InComingEvent_1))
                        {
                            _ListForCombinePlaces.Add(InComingEvent_2);
                        }
                        else if (!_listOfAllParallelPairs[InComingEvent_1].Contains(InComingEvent_2))
                        {
                            _ListForCombinePlaces.Add(InComingEvent_2);
                        }
                    }

                    if (_ListForCombinePlaces.Count > 0)
                    {
                        AlphaMinerPlaces NewAlphaPlace = new AlphaMinerPlaces(_ListForCombinePlaces, new HashSet<String>() { Pair.Key });

                        int Count = _listOfAlphaPlaces
                                            .Count(k => k.PredecessorHashSet.SetEquals(NewAlphaPlace.PredecessorHashSet) &&
                                                        k.FollowerHashSet.SetEquals(NewAlphaPlace.FollowerHashSet));
                        if (Count == 0)
                        {
                            _listOfAlphaPlaces.Add(NewAlphaPlace);
                        }
                    }
                }

                for (int i = 0; i < _ListOfOutComingSet.Count; ++i)
                {
                    String OutComingEvent_1 = _ListOfOutComingSet.ElementAt(i);

                    HashSet<String> _ListForCombinePlaces = new HashSet<String>() { OutComingEvent_1 };

                    for (int j = i + 1; j < _ListOfOutComingSet.Count; ++j)
                    {
                        String OutComingEvent_2 = _ListOfOutComingSet.ElementAt(j);

                        if (!_listOfAllParallelPairs.ContainsKey(OutComingEvent_1))
                        {
                            _ListForCombinePlaces.Add(OutComingEvent_2);
                        }
                        else if (!_listOfAllParallelPairs[OutComingEvent_1].Contains(OutComingEvent_2))
                        {
                            _ListForCombinePlaces.Add(OutComingEvent_2);
                        }
                    }

                    if (_ListForCombinePlaces.Count > 0)
                    {
                        AlphaMinerPlaces NewAlphaPlace = new AlphaMinerPlaces(new HashSet<String>() { Pair.Key }, _ListForCombinePlaces);

                        int Count = _listOfAlphaPlaces
                                            .Count(k => k.PredecessorHashSet.SetEquals(NewAlphaPlace.PredecessorHashSet) &&
                                                        k.FollowerHashSet.SetEquals(NewAlphaPlace.FollowerHashSet));
                        if (Count == 0)
                        {
                            _listOfAlphaPlaces.Add(NewAlphaPlace);
                        }
                    }
                }
            }
        }
Пример #2
0
        /// <summary>
        /// link places which have a lot of predecessors and followers
        /// </summary>
        /// <author>Krystian Zielonka</author>
        private void AddsPlacesTogether()
        {
            foreach (KeyValuePair <String, HashSet <String> > pair in _listOfAllParallelPairs)
            {
                if (_listOfAllPairs.ContainsKey(pair.Key) && _listOfAllPairs[pair.Key].Item2.Overlaps(pair.Value))
                {
                    _listOfAllPairs[pair.Key].Item2.ExceptWith(pair.Value);
                    _listOfAllPairs[pair.Key].Item1.ExceptWith(pair.Value);
                }
            }

            foreach (KeyValuePair <String, Tuple <HashSet <String>, HashSet <String> > > Pair in _listOfAllPairs)
            {
                HashSet <String> _ListOfInComingSet  = Pair.Value.Item1;
                HashSet <String> _ListOfOutComingSet = Pair.Value.Item2;

                for (int i = 0; i < _ListOfInComingSet.Count; ++i)
                {
                    String InComingEvent_1 = _ListOfInComingSet.ElementAt(i);

                    HashSet <String> _ListForCombinePlaces = new HashSet <String>()
                    {
                        InComingEvent_1
                    };

                    for (int j = i + 1; j < _ListOfInComingSet.Count; ++j)
                    {
                        String InComingEvent_2 = _ListOfInComingSet.ElementAt(j);

                        if (!_listOfAllParallelPairs.ContainsKey(InComingEvent_1))
                        {
                            _ListForCombinePlaces.Add(InComingEvent_2);
                        }
                        else if (!_listOfAllParallelPairs[InComingEvent_1].Contains(InComingEvent_2))
                        {
                            _ListForCombinePlaces.Add(InComingEvent_2);
                        }
                    }

                    if (_ListForCombinePlaces.Count > 0)
                    {
                        AlphaMinerPlaces NewAlphaPlace = new AlphaMinerPlaces(_ListForCombinePlaces, new HashSet <String>()
                        {
                            Pair.Key
                        });

                        int Count = _listOfAlphaPlaces
                                    .Count(k => k.PredecessorHashSet.SetEquals(NewAlphaPlace.PredecessorHashSet) &&
                                           k.FollowerHashSet.SetEquals(NewAlphaPlace.FollowerHashSet));
                        if (Count == 0)
                        {
                            _listOfAlphaPlaces.Add(NewAlphaPlace);
                        }
                    }
                }

                for (int i = 0; i < _ListOfOutComingSet.Count; ++i)
                {
                    String OutComingEvent_1 = _ListOfOutComingSet.ElementAt(i);

                    HashSet <String> _ListForCombinePlaces = new HashSet <String>()
                    {
                        OutComingEvent_1
                    };

                    for (int j = i + 1; j < _ListOfOutComingSet.Count; ++j)
                    {
                        String OutComingEvent_2 = _ListOfOutComingSet.ElementAt(j);

                        if (!_listOfAllParallelPairs.ContainsKey(OutComingEvent_1))
                        {
                            _ListForCombinePlaces.Add(OutComingEvent_2);
                        }
                        else if (!_listOfAllParallelPairs[OutComingEvent_1].Contains(OutComingEvent_2))
                        {
                            _ListForCombinePlaces.Add(OutComingEvent_2);
                        }
                    }

                    if (_ListForCombinePlaces.Count > 0)
                    {
                        AlphaMinerPlaces NewAlphaPlace = new AlphaMinerPlaces(new HashSet <String>()
                        {
                            Pair.Key
                        }, _ListForCombinePlaces);

                        int Count = _listOfAlphaPlaces
                                    .Count(k => k.PredecessorHashSet.SetEquals(NewAlphaPlace.PredecessorHashSet) &&
                                           k.FollowerHashSet.SetEquals(NewAlphaPlace.FollowerHashSet));
                        if (Count == 0)
                        {
                            _listOfAlphaPlaces.Add(NewAlphaPlace);
                        }
                    }
                }
            }
        }