Exemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     tabPageManual.Controls.Add(_dataGridViewManual);
     RandomWorkspace = new RandomWorkspace();
     Experiments     = new BindingList <Experiment>();
     Tasks           = new BindingList <Task>();
     LastTaskIndex   = 0;
     propertyGrid1.SelectedObject       = RandomWorkspace;
     dataGridViewTask.RowTemplate       = new DataGridViewRow();
     dataGridViewTask.DataSource        = Tasks;
     dataGridViewExperiment.RowTemplate = new DataGridViewRow();
     dataGridViewExperiment.DataSource  = Experiments;
     GammaAlgorithm = new GammaAlgorithm
     {
         WorkerBegin    = GammaAlgorithmStartTimer,
         WorkerComplite = GammaAlgorithmStopTimer,
         WorkerLog      = WorkerLog
     };
     MacLaneAlgorithm = new MacLaneAlgorithm
     {
         WorkerBegin    = MacLaneAlgorithmStartTimer,
         WorkerComplite = MacLaneAlgorithmStopTimer,
         WorkerLog      = WorkerLog
     };
     Settings.EnableCudafy = SettingsDialog.EnableCudafy;
 }
Exemplo n.º 2
0
        private void backgroundWorkerRun_DoWork(object sender, DoWorkEventArgs e)
        {
            var This = e.Argument as Form1;

            while (This.LastTaskIndex < This.Tasks.Count)
            {
                Task task = This.Tasks[This.LastTaskIndex++];
                WorkerLog("Эксперимент №" + This.LastTaskIndex);
                GammaAlgorithmTotalExecutionTime   = new TimeSpan(0);
                MacLaneAlgorithmTotalExecutionTime = new TimeSpan(0);
                var graph      = new Graph(task.Graph);
                var experiment = new Experiment
                {
                    Graph            = graph.ToString(),
                    NumberOfVertixes = graph.Vertices.Count,
                    NumberOfSegments = graph.Count
                };
                experiment.StartDateTime = DateTime.Now;
                experiment.IsPlanarByMacLaneAlgorithm = MacLaneAlgorithm.IsPlanar(graph);
                experiment.IsPlanarByGammaAlgorithm   = GammaAlgorithm.IsPlanar(graph);
                experiment.EndDateTime     = DateTime.Now;
                experiment.ResultsAreEqual = (experiment.IsPlanarByGammaAlgorithm ==
                                              experiment.IsPlanarByMacLaneAlgorithm);
                experiment.GammaAlgorithmExecutionTime   = GammaAlgorithmTotalExecutionTime;
                experiment.MacLaneAlgorithmExecutionTime = MacLaneAlgorithmTotalExecutionTime;
                This.AddExperiment(experiment);
            }
        }