public void CheckIfDifferentAcAutomata(int size, int index) { IEnumerable <IOptionalAutomaton> optionalAutomatons = new BinaryAutomataIterator().GetAllAcAutomataToCheck(size, index); int maxLength = (size - 1) * (size - 1); AutomataIterator.ISolutionMapperReusable solutionMapper2 = AutomataIterator.ExtensionMapProblemsToSolutions.GetNewMapper(); List <byte[]>[] ListAc = new List <byte[]> [size]; for (int i = 0; i < size; i++) { ListAc[i] = new List <byte[]>(); } foreach (var AcAutomaton in solutionMapper2.SelectAsSolved(optionalAutomatons)) { if (AcAutomaton.SynchronizingWordLength == null || (AcAutomaton.SynchronizingWordLength * 2) + 1 > maxLength) { ListAc[AcAutomaton.TransitionFunctionsB[0]].Add(CopyArray(AcAutomaton.TransitionFunctionsB)); } } byte[][][] TabSolvedOptionalAutomatons = new byte[10][][]; for (int i = 0; i < size; i++) { TabSolvedOptionalAutomatons[i] = ListAc[i].ToArray(); } for (int k = 0; k < size; k++) { for (int i = 0; i < TabSolvedOptionalAutomatons[k].Length - 1; i++) { for (int j = i + 1; j < TabSolvedOptionalAutomatons[k].Length; j++) { Assert.NotEqual(TabSolvedOptionalAutomatons[k][i], TabSolvedOptionalAutomatons[k][j]); } } } }
private static void ShowCalculation(int size, int index) { var displayInterval = TimeSpan.FromSeconds(2); Console.WriteLine($"For size {size} there is {BinaryAutomataIterator.UnaryCount(size, index)} unaryAutomata to check."); DateTime dateTimeStart = DateTime.Now; ulong count = 0; ulong totalCount = 0; int wordLength = (size - 1) * (size - 1) / 7; var stopwatch = new Stopwatch(); stopwatch.Start(); var previouslyDisplayed = DateTime.MinValue; foreach (var automaton in new BinaryAutomataIterator().GetAllSolved(size, index)) { totalCount += 1; if (automaton.SynchronizingWordLength.HasValue && automaton.SynchronizingWordLength.Value >= wordLength) { // gromadzimy statystyki o tym co sie poszczesci tzn. dlugosc slowa synchr + ile takich automatow count += 1; } if (totalCount % 1000000 == 0) { previouslyDisplayed = DateTime.Now; Console.WriteLine($"size = {size}, Count = {count}"); Console.WriteLine($"Time {DateTime.Now}"); Console.WriteLine($"Total per second {totalCount / stopwatch.Elapsed.TotalSeconds:F1}"); //AutomataPrinter.PrintAB(automaton); Console.WriteLine($"Synchronizing word length: {automaton.SynchronizingWordLength}"); Console.WriteLine(); } } DateTime dateTimeEnd = DateTime.Now; Console.WriteLine($"For size {size}, start index {index} and count {1}\nthere is {count} fullAutomata with word length at least {wordLength}."); Console.WriteLine($"Time to generate them is {dateTimeEnd - dateTimeStart}"); }