public SplittableRunExplorer(AlgorithmController <TIn, TOut> controller, BindingList <AlgorithmRun <TIn, TOut> > selectedRuns) { this.selectedRuns = selectedRuns; this.controller = controller; Clear(); }
public AlgorithmView(AlgorithmController <TIn, TOut> controller) { InitializeComponent(); workloadTableAmountColumn.ValueType = typeof(int); this.controller = controller; VisualizationContainer = new Control(); //exploration selectedRuns = new BindingList <AlgorithmRun <TIn, TOut> >(); explorationView = new SplittableRunExplorer <TIn, TOut>(controller, selectedRuns); selectedRuns.ListChanged += OnSelectedRunsChanged; InitializeExplorationView(); //input editing inputView = new InputEditorChooser <TIn>(controller.InputEditors); //populate controls InitializeBindings(); //set up default algo's, inputs, runs LoadDefaultConfiguration(); //initialize view SetExploring(true); }
private void StartThread(object sender, EventArgs e) { if (AlgorithmThread != null && AlgorithmThread.IsAlive) { return; } AlgorithmThread = new Thread(() => { algorithmController = new AlgorithmController(MainDispatcher); }); this.AlgorithmThread.Start(); }
public RunExplorerChooser(AlgorithmController <TIn, TOut> controller, BindingList <AlgorithmRun <TIn, TOut> > activeSelection, Type defaultExplorerType = null) { InitializeComponent(); this.controller = controller; this.activeSelection = activeSelection; //bring options to front optionsContainer.BringToFront(); optionsContainer.Visible = false; //set to auto selection by default autoChooseRunsCheckBox.CheckState = CheckState.Checked; //default run selection lastSelection = new List <AlgorithmRun <TIn, TOut> >(); UsingActiveSelection = false; //initialize run explorers RunExplorers = new BindingList <RunExplorer <TIn, TOut> >(controller.RunExplorerFactories .ToList() .Select(fac => fac.Create()) .ToList()); //setup mouse hover event mouseMessageFilter = new MouseMessageFilter(); mouseMessageFilter.MouseMoved += HandleMouseMove; Application.AddMessageFilter(mouseMessageFilter); //populate combobox var availableRunExplorers = RunExplorers .ToList() .OrderBy(ex => ex.Priority) .ToArray(); runExplorerComboBox.DataSource = availableRunExplorers; runExplorerComboBox.Format += (s, e) => { e.Value = ((RunExplorer <TIn, TOut>)e.Value).Name; }; runExplorerComboBox.Enabled = (availableRunExplorers.Length > 0); if (availableRunExplorers.Length > 0) { var defaultExplorer = availableRunExplorers .ToList() .Find(ex => ex.GetType() == defaultExplorerType); runExplorerComboBox.SelectedItem = defaultExplorer ?? availableRunExplorers[0]; } }
// Przycisk GENERUJ private void buttonStart_Click(object sender, EventArgs e) { dataGridViewSchedule.AutoGenerateColumns = false; //Set Columns Count dataGridViewSchedule.DataSource = null; dataGridViewSchedule.ColumnCount = DaysCount + 2; dataGridViewSchedule.Columns[0].Frozen = true; //Add Columns dataGridViewSchedule.Columns[0].Name = "OsrodekKod"; dataGridViewSchedule.Columns[0].HeaderText = "Kod ośrodka"; dataGridViewSchedule.Columns[0].DataPropertyName = "OsrodekKod"; dataGridViewSchedule.Columns[1].Name = "KwalifikacjaKod"; dataGridViewSchedule.Columns[1].HeaderText = "Kwalifikacja"; dataGridViewSchedule.Columns[1].DataPropertyName = "KwalifikacjaKod"; chart1.ChartAreas[0].AxisX.Maximum = MAX_GENERATION; chart1.ChartAreas[0].AxisX.Interval = 20; chart1.ChartAreas[0].AxisY.Maximum = 1; chart1.ChartAreas[0].AxisX.LineDashStyle = System.Windows.Forms.DataVisualization.Charting.ChartDashStyle.Dash; chart1.ChartAreas[0].AxisY.Minimum = 0.5; chart1.ChartAreas[0].AxisY.Interval = 0.125; _algorithm = new AlgorithmController(ParametryAlgorytmu); for (int i = 2; i < dataGridViewSchedule.ColumnCount; i++) { dataGridViewSchedule.Columns[i].HeaderText = _dtStart.AddDays(i - 2).ToShortDateString(); } dataGridViewSchedule.DataSource = Exam.GetListExams().Distinct().ToList(); _best.SetNumDays(DaysCount); _best.SetNumExams(Exam.RecordCount); _algorithm.Population(Examiner.GetListEgzaminatorzy(), Exam.GetListExams()); if (backgroundGeneruj.IsBusy != true) { buttonStart.Enabled = false; buttonStop.Enabled = true; // Uruchomienie działanie asynchroniczne szukanie nalepszego chromosomu wśród najlepszych backgroundGeneruj.RunWorkerAsync(new ThreadModelView()); } }