Exemplo n.º 1
0
        public static void PrintBenchmarksResultInMatlab(IAlgorithm algorithm, int beginValues = 1, int endValues = 10,
                                                         int step      = 1, int repetitionsCount = 5, IАveragerResults averageResult = null, string title = "",
                                                         string xLabel = "", string y1Label      = "", string y2Label = "")
        {
            if (averageResult == null)
            {
                averageResult = new Average(0.8M);
            }

            var results = СomplicationEstimator.Estimate(algorithm, beginValues, endValues,
                                                         step, repetitionsCount, averageResult);

            var x = new int[results.Count];
            var y = new long[results.Count];
            var m = new double[results.Count];

            for (var i = 0; i < results.Count; i++)
            {
                x[i] = results[i].Size;
                y[i] = results[i].Time;
                m[i] = results[i].Memory;
            }

            MatlabOperations.Figure();
            MatlabOperations.PlotBenchmarksResult(x, y, m, title, xLabel, y1Label, y2Label);
            MatlabOperations.Pause();
        }
Exemplo n.º 2
0
        private static void Main(string[] args)
        {
            FileOperations.SetMatlabConfigFromJson("data/config.json");


            var graph1 = FileOperations.GetDirectedGraphFromJson("data/graph.json");
            var state  = graph1.GetMoralGraph();
            var tmp    = state.Item1;
            var final  = state.Item2;


            MatlabOperations.Figure();
            var figure0 = MatlabOperations.PlotGraph(graph1, "Исходный граф");

            MatlabOperations.Pause(5);

            MatlabOperations.Figure();
            var figure1 = MatlabOperations.PlotGraph(tmp, "Исходный неориентированный граф");

            MatlabOperations.Pause(5);

            MatlabOperations.Figure();
            var figure2 = MatlabOperations.PlotGraphAndHistory(tmp, final.GetEdgesHistory(), "Морализованный граф");

            MatlabOperations.Pause(5);

            var secondStage = graph1.TriangulateGraph(final);

            MatlabOperations.Figure();
            var figure3 = MatlabOperations.PlotGraph(secondStage, "Триангулированный граф");

            MatlabOperations.Pause();


            //BenchmarksHelper.PrintBenchmarksResultInMatlab(new MoralizationAlgorithm(), 0, 100, 5,
            //    title: "Бенчмарк для морализации", xLabel: "Число вершин", y1Label: "Время, мс.", y2Label: "Память, МБ");
        }