Пример #1
0
        static void Main(string[] args)
        {
            BlackAndWhitePrinter bawPrinter = new BlackAndWhitePrinter();
            Secretary            eva        = new Secretary(bawPrinter);

            eva.Print("Secretary's bill");

            Console.WriteLine();

            ColourPrinter cPrinter    = new ColourPrinter();
            Director      herrSchulte = new Director(cPrinter);

            herrSchulte.Print("Director's order");

            Console.WriteLine();

            MatrixPrinter mPrinter = new MatrixPrinter();
            Trainee       kevin    = new Trainee(mPrinter);

            kevin.Print("Trainee's project");

            Console.WriteLine();

            PDFPrinter pdfPrinter = new PDFPrinter();
            Developer  heiko      = new Developer(pdfPrinter);

            heiko.Print("Developer's source code");

            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            //сначала строка потом ряд
            int[][] arr = new int[][]
            {
                new int[] { 1, 0, 0, 1, 0 },
                new int[] { 0, 1, 0, 0, 1 },
                new int[] { 0, 1, 1, 0, 1 },
                new int[] { 0, 1, 1, 1, 1 },
                new int[] { 1, 1, 1, 0, 1 }
            };

            int[][] arr2 = new int[][]
            {
                new int[] { 1, 0, 1, 1 },
                new int[] { 1, 0, 1, 0 },
                new int[] { 0, 1, 0, 0 },
            };
            //Транспонирование матрицы и получение единичной главной диагонали
            arr = MatrixTransposer.Transpose(arr);
            MatrixPrinter.Print(arr);
            Console.WriteLine();

            Simplifyer s = new Simplifyer(arr); //Если нет решений, выкинет ошибку

            MatrixPrinter.Print(s.Matrix);

            Table table = new Table(s.Matrix);

            Solver solver = new Solver(table, s.CoveredRows, s.MustBeInEveryAnswer);

            solver.Solve();
            MatrixPrinter.PrintList(solver.BestAnswer);
            Console.Read();
        }
Пример #3
0
        private void RunMatrixPrinter(object sender, RoutedEventArgs e)
        {
            var source = Grid.DataSource;
            var mp     = new MatrixPrinter();

            MessageBox.Show(mp.MatrixToStrings(source));
        }
Пример #4
0
        public void OnDecodePruferCall(List <int> code)
        {
            var graphMatrix = MinimumSpanningTree.DecodePrufer(code);

            if (_graphMatrix == null)
            {
                _graphMatrix = new GraphMatrix(code.Count + 2, 1, -10, 10);
                _graphMatrix.SetAdjacencyMatrix(graphMatrix);
                _graphMatrix.SetWeightMatrix(graphMatrix);
                _graphMatrix.SetSstMatrix(graphMatrix);
                _graphGenerated       = false;
                _sstGenerated         = true;
                _flowNetworkGenerated = false;
            }
            else
            {
                _graphMatrix.SetSstMatrix(graphMatrix);
            }

            string pruferCode = String.Join(" ", code);

            _view.AppendToLog($"{_logEntryNumber++}: Prufer's Decode:" +
                              Environment.NewLine +
                              "Matrix: " +
                              Environment.NewLine +
                              MatrixPrinter.GetMatrix(graphMatrix) +
                              $"Code: {pruferCode}" +
                              Environment.NewLine + Environment.NewLine);

            _graphMatrix.OutputToFileSst();
            UpdateViewGraphImage();
        }
Пример #5
0
        public string OnGetPruferCall()
        {
            var(tree, vertices) = MinimumSpanningTree.GetPruferCode(_graphMatrix);
            for (int i = 0; i < vertices.Count; ++i)
            {
                vertices[i] += 1;
            }

            string code = String.Join(" ", vertices);

            if (code.Equals(""))
            {
                code = "Empty";
            }

            _view.AppendToLog($"{_logEntryNumber++}: Prufer's code:" +
                              Environment.NewLine +
                              "Matrix: " +
                              Environment.NewLine +
                              MatrixPrinter.GetMatrix(tree) +
                              $"Code: {code}" +
                              Environment.NewLine + Environment.NewLine);

            return(code);
        }
Пример #6
0
        static void Main(string[] args)
        {
            Document      doc = new Document("Book", -13);
            LaserPrinter  l1  = new LaserPrinter();
            MatrixPrinter mp  = new MatrixPrinter();
            CopyCenter    cc  = new CopyCenter(mp);

            cc.CenterPrint(doc);
        }
Пример #7
0
        public void OnShimbelAlgorithmCall(IPresenterConnectedDialog dialog, int edgesAmount, bool shortestPaths)
        {
            var matrix = ShimbelAlgorithm.FindPaths(_graphMatrix, edgesAmount, shortestPaths);

            string matrixStr = MatrixPrinter.GetMatrix(matrix);

            _view.AppendToLog($"{_logEntryNumber++}: Shimbel's Algorithm for " +
                              (shortestPaths ? "shortest" : "longest") +
                              $" paths ({edgesAmount} edges):" +
                              Environment.NewLine +
                              matrixStr + Environment.NewLine);

            dialog.SetData(matrixStr);
        }
Пример #8
0
        public void OnCreateFlowNetworkCall()
        {
            FlowAlgorithms.TurnIntoFlowNetwork(_graphMatrix);
            _flowNetworkGenerated = true;

            _view.AppendToLog($"{_logEntryNumber++}: Flow Network Generated:" +
                              Environment.NewLine +
                              "Adjacency Matrix: " +
                              Environment.NewLine +
                              MatrixPrinter.GetMatrix(_graphMatrix.GetAdjacencyMatrix()) +
                              "Weight Matrix: " +
                              Environment.NewLine +
                              MatrixPrinter.GetMatrix(_graphMatrix.GetWeightMatrix()) +
                              "Capacities Matrix: " +
                              Environment.NewLine +
                              MatrixPrinter.GetMatrix(_graphMatrix.GetCapacitiesMatrix()) +
                              Environment.NewLine);

            _graphMatrix.OutputToFile();
            UpdateViewGraphImage();
        }
Пример #9
0
 public string GetStringWeightMatrix()
 {
     return(MatrixPrinter.GetMatrix(_weightMatrix));
 }
 public MatrixPrintCommand(MatrixPrinter printer)
 {
     this._Printer = printer;
 }
Пример #11
0
        static void Main(string[] args)
        {
            Console.WriteLine("Input amount of vertexes");
            int sizeOfGraph = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Input amount of graphs");
            int amountOfGraphs = Convert.ToInt32(Console.ReadLine());

            //среднее количество секунд на один граф
            double sWatch = 0.0;

            //проход по всем рандомным графам, количество которых amountOfGraphs
            for (int i = 0; i < amountOfGraphs; i++)
            {
                //объект для построения рандомного графа
                MatrixGeneratorMultidimensionalArray m = new MatrixGeneratorMultidimensionalArray(sizeOfGraph);

                //исследуемый рандомный граф
                /// <summary>
                /// Тут объект класса MatrixGeneratorArrayOfArrays содержит методы
                /// GetLowRarefactionMatrix, GetMediumRarefactionMatrix, GetHardRarefactionMatrix,
                /// то есть зависимость от разреженности. По умолчанию слаборазреженный граф
                /// изменяй их по своему усмотрению
                /// </summary>


                int[,] graph = m.GetHardRarefactionMatrix();

                //печатаем для наглядности
                MatrixPrinter.Print(graph);
                Stopwatch sw = new Stopwatch();

                //включаем счетчик
                sw.Start();

                //объект-анализатор, в котором есть методы построения матрицы Dn кратчайших путей, поиск эксцентриситетов и центров
                Analyser analyser = new Analyser();
                int[,] graphToFloydWarshall = analyser.FloydWarshall(graph);
                int[]       excentricities = analyser.Excentricity(graphToFloydWarshall);
                IList <int> centers        = analyser.GetCenters(excentricities);
                sw.Stop();

                //вывод вершин-центров
                Console.Write("Centers-vertexes: ");
                foreach (var center in centers)
                {
                    Console.Write(center + " ");
                }

                //прибвляем к общему времени время, затраченное на текущий граф
                sWatch = sWatch + sw.Elapsed.TotalSeconds;
                Console.WriteLine();
                Console.WriteLine("Time for a single graph: {0} seconds", sw.Elapsed.TotalSeconds);
            }

            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine();
            //среднее время
            Console.WriteLine("Average time for graph, which has a {0} vertexes: {1} seconds", amountOfGraphs, sWatch / amountOfGraphs);
            Console.WriteLine();
            Console.WriteLine();
            Console.ReadKey();
        }
Пример #12
0
        static void Main(string[] args)
        {
            #region EMPLOYEES

            Secretary eva         = new Secretary();
            Director  herrSchulte = new Director();
            Developer heiko       = new Developer();
            Trainee   kevin       = new Trainee();

            #endregion

            #region PRINTER

            BlackAndWhitePrinter bwPrinter  = new BlackAndWhitePrinter();
            ColourPrinter        cPrinter   = new ColourPrinter();
            MatrixPrinter        mPrinter   = new MatrixPrinter();
            PDFPrinter           pdfPrinter = new PDFPrinter();

            #endregion

            #region PRINT COMMANDS

            IPrintCommand blackAndWhitePrintCommand = new BlackAndWhitePrintCommand(bwPrinter);
            IPrintCommand colourPrintCommand        = new ColourPrintCommand(cPrinter);
            IPrintCommand matrixPrintCommand        = new MatrixPrintCommand(mPrinter);
            IPrintCommand pdfPrintCommand           = new PDFPrintCommand(pdfPrinter);

            PrintQueueCommand printQueueCommand = new PrintQueueCommand();
            printQueueCommand.AddCommand(blackAndWhitePrintCommand);
            printQueueCommand.AddCommand(colourPrintCommand);
            printQueueCommand.AddCommand(matrixPrintCommand);
            printQueueCommand.AddCommand(pdfPrintCommand);

            IPrintCommand directorPrintCommand = new DirectorPrintCommand(eva);

            #endregion

            eva.PrintCommand = blackAndWhitePrintCommand;
            eva.Print("Eva's bill");

            Console.WriteLine();

            eva.PrintCommand = colourPrintCommand;
            eva.Print("Eva's bill");

            Console.WriteLine();

            heiko.PrintCommand = pdfPrintCommand;
            heiko.Print("Heiko's source code");

            Console.WriteLine();

            heiko.PrintCommand = matrixPrintCommand;
            heiko.Print("Heiko's source code");

            Console.WriteLine();

            kevin.PrintCommand = printQueueCommand;
            kevin.Print("Kevin's print queue.");

            Console.WriteLine();

            herrSchulte.PrintCommand = directorPrintCommand;
            herrSchulte.Print("Order 666");

            Console.ReadKey();
        }
Пример #13
0
 public Trainee(MatrixPrinter printer)
 {
     this._Printer = printer;
 }
Пример #14
0
        /// <summary>
        /// Tests the hash table.
        /// </summary>
        private static void TestHashTable()
        {
            /* Concept:
             * The "database" dictionary holds all the strokes from the DB (once)
             * stored under the name of their md5-hash
             *
             * The "inputlist" List<Stroke> contains all the
             * strokes that come in from the user.
             *
             * The value is a dictionary with keys: md5hash of input
             * and value: input stroke
             *
             * Open question:
             * where are the real strokes stored?
             * proposal: in a second dictionary
             * Dictionary<byte[], Stroke> database = new Dictionary<byte[], Stroke>();
             */

            Dictionary <byte[], Dictionary <byte[], double> > matchingscores =
                new Dictionary <byte[], Dictionary <byte[], double> >();

            List <Character> characterdatabase =
                UPXReader.ParseUPXFile(
                    File.Open("C:\\Diplom\\kanjiteacher\\data\\exampleFormat.upx", FileMode.Open));

            //Dictionary<byte[], Stroke> database = new Dictionary<byte[], Stroke>();

            List <Stroke> inputlist = null;

            //take random strokes as inputlist
            inputlist = new List <Stroke>()
            {
                GetAlmostRandomStroke(0), GetAlmostRandomStroke(1)
            };
            //takes strokes of the same character from inputlist
            inputlist = InkMLReader.ReadInkMLFile("char00255.inkml");

            ////fill the stroke database with the strokes from all the characters
            ////stored under their hash codes
            //foreach (Character c in characterdatabase)
            //    foreach (Stroke s in c.StrokeList)
            //        database.Add(s.Hash(false), s);

            //go through all the strokes in the database
            foreach (Character c in characterdatabase)
            {
                //go through all the strokes in the list of input strokes
                foreach (Stroke s in inputlist)
                {
                    foreach (Stroke dbStroke in c.StrokeList)
                    {
                        //calculate the matching score
                        double score = dbStroke.MatchingScore(s, new TWStrokeMatcher());

                        //store the score in big matrix of stroke match values
                        if (!matchingscores.Keys.Contains(dbStroke.Hash()))
                        {
                            //add the score under the correct key in a new dictionary
                            //under the current strokes key
                            matchingscores.Add(
                                dbStroke.Hash(),
                                new Dictionary <byte[], double>()
                            {
                                { s.Hash(false), score }
                            });
                        }
                        else
                        {
                            //add new score for the input stroke to the
                            //existing matching dict at the entry of the current database stroke
                            matchingscores[dbStroke.Hash()].Add(s.Hash(), score);
                        }
                    }
                }
            }

            MatrixPrinter m = new MatrixPrinter(matchingscores);

            Console.WriteLine(m.print());

            Console.WriteLine(
                "Now find total minimum of these scores" +
                "i.e. go ahead and do some matrix operation in order to find" +
                "the minimum of each row." +
                "if stroke number is identical, consider position within matrix" +
                "each row can only have one best matching column" +
                "each column can only have one best matching row" +
                "find total minimum and return it"
                );
        }
Пример #15
0
        private static void TestTimeWarping()
        {
            List <Point> p = new List <Point>();

            p.Add(new Point(1, 1));
            p.Add(new Point(2, 2));
            p.Add(new Point(4, 2));
            p.Add(new Point(5, 3));
            p.Add(new Point(6, 2));

            List <Point> q = new List <Point>();

            q.Add(new Point(2, 4));
            q.Add(new Point(3, 5));
            q.Add(new Point(5, 5));
            q.Add(new Point(6, 6));
            q.Add(new Point(7, 5));

            List <Point> r = new List <Point>();

            r.Add(new Point(2, 6));
            r.Add(new Point(3, 7));
            r.Add(new Point(5, 7));
            r.Add(new Point(6, 8));
            r.Add(new Point(7, 7));

            List <Point> s = new List <Point>();

            s.Add(new Point(0.5, 4.5));
            s.Add(new Point(2, 6));
            s.Add(new Point(5.5, 5));
            s.Add(new Point(6.5, 6.5));
            s.Add(new Point(7.5, 7));
            s.Add(new Point(8.5, 5.5));
            s.Add(new Point(9.5, 5));

            TimeWarping tw = new TimeWarping(r, q);

            tw.CalculateDistances((p1, p2) => p1.Distance(p2));
            MatrixPrinter m = new MatrixPrinter(tw.Distances);

            m.NewlineChar = "\r\n";
            m.BlankChar   = " ";

            Console.WriteLine(m.print());

            Console.WriteLine("\n\n\n");

            Point myStop = new Point(r.Count - 1, q.Count - 1);

            Console.WriteLine("Cummulative distance of <{0},{1}>", myStop.X, myStop.Y);
            Console.WriteLine(
                tw.CalculateCumulativeDistanceOf((int)myStop.X, (int)myStop.Y));
            foreach (Point mp in tw.GetWarpingPath((int)myStop.X, (int)myStop.Y))
            {
                Console.WriteLine(mp);
            }

            BoundingBox bp = new BoundingBox(p);
            BoundingBox bq = new BoundingBox(q);
            BoundingBox br = new BoundingBox(r);

            br.Stretch(2);
            BoundingBox bs = new BoundingBox(s);

            //resize bs in a way that it is similar to p
            if (bs.Width > bp.Width)
            {
                bs.Stretch(bp.Width / bs.Width);
            }
            else
            {
                bs.Stretch(bs.Width / bp.Width);
            }

            List <Point> newP = Vector2.CreatePointList(bp.VectorsFromAnchor[0]);
            List <Point> newQ = Vector2.CreatePointList(bq.VectorsFromAnchor[0]);
            List <Point> newR = Vector2.CreatePointList(br.VectorsFromAnchor[0]);
            List <Point> newS = Vector2.CreatePointList(bs.VectorsFromAnchor[0]);

            TimeWarping tw2 = new TimeWarping(newR, newQ);

            tw2.CalculateDistances((p1, p2) => p1.Distance(p2));

            myStop.X = newR.Count - 1;
            myStop.Y = newQ.Count - 1;

            Console.WriteLine(m.printNewMatrix(tw2.Distances));

            Console.WriteLine("\n\n\n");

            Console.WriteLine("Cummulative distance of <{0},{1}>", myStop.X, myStop.Y);
            Console.WriteLine(tw2.CalculateCumulativeDistance());
            foreach (Point mp in tw2.WarpingPath)
            {
                Console.WriteLine(mp);
            }


            TimeWarping tw3 = new TimeWarping(newP, newS);

            tw3.CalculateDistances(delegate(Point p1, Point p2) { return(p1.Distance(p2)); });
            Console.WriteLine("Euclidian distances:");
            Console.WriteLine(m.printNewMatrix(tw3.Distances));
            tw3.CalculateDistances(delegate(Point p1, Point p2) { return(Math.Pow(p1.X - p2.X, 2) + Math.Pow(p1.Y - p2.Y, 2)); });
            Console.WriteLine("Added squares, no square root:");
            Console.WriteLine(m.printNewMatrix(tw3.Distances));



            Console.WriteLine("\n\n\n");

            Console.WriteLine("Cummulative distance of <{0},{1}>", newP.Count - 1, newS.Count - 1);
            Console.WriteLine(tw3.CalculateCumulativeDistance());
            foreach (Point mp in tw3.WarpingPath)
            {
                Console.WriteLine(mp);
            }

            Console.WriteLine("Warping distance r / q: " + tw.WarpingDistance.ToString());
            Console.WriteLine("Warping distance newR / newQ (newR is the same shape but double size): " + tw2.WarpingDistance.ToString());
            Console.WriteLine("Warping distance newP / newS (are resized to the same bounding box and then moved on top of each other): " + tw3.WarpingDistance.ToString());
        }
Пример #16
0
        public static void RunTests()
        {
            var exercises = new Exercises();
            var printer   = new MatrixPrinter();
            var builder   = new MatrixBuilder();

            //5 7 [2,2]
            //[4,4]
            //[[3,0], [2,5]] Expected 12
            exercises.MinDistance(5, 7, new int[] { 2, 2 }, new int[] { 4, 4 }, new int[][] { new int[] { 3, 0 }, new int[] { 2, 5 } });

            /*
             * //var flights = new int[,] { { 0, 1, 1 }, { 1, 0, 1 }, { 1, 1, 0 } };
             * //var days = new int[,] { { 1, 3 }, { 6, 0 }, { 3, 3 } };
             * var flights = new int[,] { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
             * var days = new int[,] { { 1, 1, 1 }, { 7, 7, 7 }, { 7, 7, 7 } };
             * Utility.WriteLine("Max vacation days: {0}", exercises.MaxVacationDays(flights, days));
             */

            /*
             * //var nums = new int[,] { { 1, 2 }, { 3, 4 } };
             * //var nums = new int[,] { { 1, 2 }, { 3, 4 } };
             * var nums = new int[,] { { 1, 2, 3 }, { 4, 5, 6 } };
             * for (var i = 0; i <= nums.GetUpperBound(0); i++)
             * {
             *  for (var j = 0; j <= nums.GetUpperBound(1); j++)
             *  {
             *      Utility.Write("{0} ", nums[i, j]);
             *  }
             *  Utility.WriteLine(string.Empty);
             * }
             * //var res = MatrixReshape(nums, 1, 4);
             * //var res = MatrixReshape(nums, 2, 4);
             * var res = exercises.MatrixReshape(nums, 3, 2);
             * for (var i = 0; i <= res.GetUpperBound(0); i++)
             * {
             *  for (var j = 0; j <= res.GetUpperBound(1); j++)
             *  {
             *      Utility.Write("{0} ", res[i, j]);
             *  }
             *  Utility.WriteLine(string.Empty);
             * }
             */
            /*
             * var matrices = TestableMatrices.BuildTestMatrix();
             * printer.PrintMatrix(matrices[0]);
             * Utility.WriteLine("Shortest distaince between (1, 0) and (0, 1) is {0}", exercises.ShortestDistanceBetweenPoints(matrices[0], new Point(1, 0), new Point(0, 1), 0));
             *
             * printer.PrintMatrix(matrices[1]);
             * Utility.WriteLine("Shortest distaince between (0, 1) and (1, 2) is {0}", exercises.ShortestDistanceBetweenPoints(matrices[1], new Point(0, 1), new Point(1, 2), 0));
             *
             * printer.PrintMatrix(matrices[2]);
             * Utility.WriteLine("Shortest distaince between (1, 0) and (2, 1) is {0}", exercises.ShortestDistanceBetweenPoints(matrices[2], new Point(1, 0), new Point(2, 1), 0));
             *
             * printer.PrintMatrix(matrices[3]);
             * Utility.WriteLine("Shortest distaince between (0, 0) and (2, 2) is {0}", exercises.ShortestDistanceBetweenPoints(matrices[3], new Point(0, 0), new Point(2, 2), 0));
             *
             * printer.PrintMatrix(matrices[4]);
             * Utility.WriteLine("Shortest distaince between (0, 0) and (3, 3) is {0}", exercises.ShortestDistanceBetweenPoints(matrices[4], new Point(0, 0), new Point(3, 3), 0));
             */
            /*
             * var matrix = builder.BuildMatrix(3, 5, new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 });
             * printer.PrintMatrix(matrix);
             * var timer = new Timer();
             * var result2 = timer.TimedFunc(() => { return printer.SpiralOrderInLoops(matrix); });
             * var result1 = timer.TimedFunc(() => { return printer.SpiralOrder(matrix); });
             * Utility.WriteLine(string.Empty);
             * Utility.WriteLine("SpiralOrder took {0}ms", result1.Item1.TotalMilliseconds);
             * foreach (var item in result1.Item2)
             * {
             *  Utility.Write("{0} ", item);
             * }
             * Utility.WriteLine(string.Empty);
             * Utility.WriteLine("SpiralOrderInLoops took {0}ms", result2.Item1.TotalMilliseconds);
             * foreach (var item in result2.Item2)
             * {
             *  Utility.Write("{0} ", item);
             * }
             * Utility.WriteLine(string.Empty);
             */
        }
Пример #17
0
 public string GetStringAdjacencyMatrix()
 {
     return(MatrixPrinter.GetMatrix(_adjacencyMatrix));
 }
        private void InitToolBarCommands()
        {
            ToolBarCommands = new ObservableCollection <ToolBarCommandBase>();

            // Выбор множества External stability
            var selectDsCommand = new ToolBarToggleCommand(
                () =>
            {
                if (_task == Task.TaskSelectDomSets)
                {
                    VertexClickCmd = new DelegateCommand(
                        o => SelectRMouseClick((IVertex)o),
                        o => true);
                    _state = State.SetEs;
                    IsMouseVerticesMovingEnabled = false;
                }
            },

                () =>
            {
                _state = State.Nothing;
                IsMouseVerticesMovingEnabled = true;
            },

                () => _state == State.Nothing,
                () => true
                )
            {
                Image       = new BitmapImage(GetImageUri("es.png")),
                Description = "Выбор множества внешней устойчивости"
            };

            // Вызов окна со справкой
            var helpM = new ToolBarInstantCommand(
                () => MessageBox.Show
                (
                    "Лабораторная работа \"Устойчивость графов \"\n "
                    +
                    "Задание \"Множество внешней устойчивости\"\n"
                    +
                    "Цель: найти число внешней устойчивости графа\n"
                    +
                    "\n"
                    +
                    "для перехода к следующему заданию нажмите ОК\n"
                    +
                    "Для изменения матрицы необходимо изменить значение в ячейке и нажать \"Enter\"\n"
                    +
                    "Либо дважды кликнуть мышью по ячейке матрицы\n"
                    +
                    "\n"
                    +
                    "Задания:\n"
                    +
                    "1.1 Заполнить матрицу смежности\n"
                    +
                    "1.2 Измените матрицу смежности под выполнение алгоритма красно-синих вершин\n"
                    +
                    "2.Выделите несколько доминирующих множеств графа\n (выделение множества доступно по кнопке <ES>\nзакрытие множества происходит по кнопке <{}>)\n"
                    +
                    "3.Определить число внешней устойчивости (пометить соответствующее множество вершин)"
                ),
                () => _state == State.Nothing
                )
            {
                Image       = new BitmapImage(GetImageUri("help.png")),
                Description = "Справка"
            };

            // Проверка задания
            var checkButton = new ToolBarInstantCommand(
                () =>
            {
                var mp = new MatrixPrinter();
                var m  = Matrix;
                switch (_task)
                {
                case Task.TaskAdjacencyMatrix:
                    UserActionsManager.RegisterInfo("Внешняя устойчивость. Задание 1.1. На проверку отправлена матрица: " + mp.MatrixToString(m));
                    CheckMatrix();
                    break;

                case Task.TaskModifiedAdjMatrix:
                    UserActionsManager.RegisterInfo("Внешняя устойчивость. Задание 1.2. На проверку отправлена матрица: " + mp.MatrixToString(m));
                    CheckMatrixforAghorithm();
                    break;

                case Task.TaskSelectDomSets:
                    MessageBox.Show(string.Format(
                                        "Необходимо найти еще {0} множеств(о) внешней устойчивости", _countOfSes));
                    break;

                case Task.TaskFindMinDomSets:
                    IsMinDS();
                    break;

                case Task.TaskEnd:
                    UserActionsManager.ReportThatTaskFinished();
                    break;
                }
            },
                () => _state == State.Nothing
                )
            {
                Image       = new BitmapImage(GetImageUri("ok.png")),
                Description = "Проверить матрицу"
            };

            // Проверка множества и его сохранение
            var addSetofES = new ToolBarInstantCommand(
                () =>
            {
                if (_task == Task.TaskSelectDomSets)
                {
                    ValidateSet();
                }
            },
                () => _state == State.Nothing
                )
            {
                Image       = new BitmapImage(GetImageUri("add.png")),
                Description = "Добавить множество"
            };

            // Проверка задания
            var debugButton = new ToolBarInstantCommand(
                () =>
            {
                var counter = new MatrixErrorCounter();
                if (_task == Task.TaskAdjacencyMatrix)
                {
                    counter.FillInMatrix(Matrix, GivenGraph);
                }
                if (_task == Task.TaskModifiedAdjMatrix)
                {
                    counter.ModifyMatrix(Matrix);
                }
            },
                () => _state == State.Nothing
                )
            {
                Image       = new BitmapImage(GetImageUri("ok.png")),
                Description = "Автозаполнение"
            };

            ToolBarCommands.Add(checkButton);
            ToolBarCommands.Add(selectDsCommand);
            ToolBarCommands.Add(addSetofES);
            ToolBarCommands.Add(helpM);
            //ToolBarCommands.Add(debugButton);
        }