public FormExperimentSetting(ExperimentType currentExperimentType)
        {
            InitializeComponent();
            this.currentExperimentType = currentExperimentType;
        
            dropDownListOfWorkerSelectionMethod.Items.AddRange(Enum.GetNames(typeof(WorkerSelectionMethod)));

            //set current FormActiveLearningSetting instance pointer
            currentFormInstance = this;
            //Obtain all available datasets
            comboBoxForSelectingDataset.Items.AddRange(GlobalVariables.getAllDatasetNames());
            comboBoxForSelectingDataset.SelectedIndex = 0;

            dropDownListOfWorkerSelectionMethod.SelectedIndex = 0;
            //Run Default Experiment Settings
            RunDefaultExperimentSettings();
            SetComboBoxListOfRunTypesValue();
            currentListOfExperimentModels = new List<ExperimentModel>();

            //change the visibility of the buttons according to the current experiment type
            switch (currentExperimentType)
            {
                case ExperimentType.BatchRunning:
                   
                    btnRunExperiment.Visible = false; 
                    buttonRunBatchRunning.Visible = true;

                    //disable task selection method and worker selection method
                    labelTaskSelectionMethod.Visible = false;
                    comboBoxListOfTaskSelectionMethods.Visible = false;
                    labelWorkerSelectionMethod.Visible = false;
                    dropDownListOfWorkerSelectionMethod.Visible = false;
                    //change the outerbox to the corresponding experiment Type
                    groupBoxExperimentOuterBox.Text = "Batch Running Settings";
                    deleteButtonIndex = 1;
                    groupBoxInitialNumberOfLabelling.Visible = false;

                    //Enlarge the RunType and the AddModel Button
                    comboBoxListOfRunTypes.Width = 727;
                    break;

                case ExperimentType.ActiveLearning:

                    btnRunExperiment.Visible = true;
                    buttonRunBatchRunning.Visible = false;
                    deleteButtonIndex = 3;
                    //Enable task selection method and worker selection method
                    labelTaskSelectionMethod.Visible = true;
                    comboBoxListOfTaskSelectionMethods.Visible = true;
                    labelWorkerSelectionMethod.Visible = true;
                    dropDownListOfWorkerSelectionMethod.Visible = true;
                    groupBoxInitialNumberOfLabelling.Visible = true;
             
                    groupBoxExperimentOuterBox.Text = "Active Learning Settings";

                    //Reset the normal size of the RunType and the AddModel Button
                    comboBoxListOfRunTypes.Width = 256;
                    break;

                default:
                    break;
            }

            initCurrentModels();
        } //end Constructor
Exemplo n.º 2
0
        } //end of button handler

        /// <summary>
        /// General Event Handler of playing and pause the experiment
        /// </summary>
        /// <param name="currentExpType"></param>
        private void HandlePlayAndPauseExperiment(ExperimentType currentExpType, Button playAndPauseButton)
        {

            //Change the PlayAndPauseButton according to current ExperimentType,
            //pop up the setting form if the experiment is complete
            if (isExperimentComplete)
            {
                //initial TheExperiment and pop up the 
                experimentSettingForm = new FormExperimentSetting(currentExpType);
                experimentSettingForm.setPreviousExperimentSetting(currentExperimentSetting);
                //enable the FormActiveLearningSetting window always on the top
                experimentSettingForm.Owner = this;
                experimentSettingForm.Show();

                //change to the pause icon
                playAndPauseButton.BackgroundImage = global::AcriveCrowdGUI.Properties.Resources.Pause_Hot_icon;

                return;
            }

            isExperimentRunning = !isExperimentRunning;

            //Pause the experiment
            if (isExperimentRunning)
            {
                //change to the pause icon
                playAndPauseButton.BackgroundImage = global::AcriveCrowdGUI.Properties.Resources.Pause_Hot_icon;
         
            }
            else
            {
                //change to the play icon
                playAndPauseButton.BackgroundImage = global::AcriveCrowdGUI.Properties.Resources.Play_1_Normal_icon;

            }
        
        }
Exemplo n.º 3
0
        /// <summary>
        /// Close the Experiment Setting Pane if it is opened
        /// </summary>
        private void CloseExperimentSettingPane() 
        {
            //Check if the ExperimentSettingPane is opened
            if (experimentSettingForm != null)
            {
                experimentSettingForm.Close();
                experimentSettingForm = null;
            }

        }
Exemplo n.º 4
0
        /// <summary>
        /// Open the experiment setting pane with the required experiment Type (ie ActiveLearning, BatchRunning)
        /// </summary>
        /// <param name="currentExperimentType"></param>
        private void OpenExperimentSettingPane(ExperimentType currentExperimentType)
        {
            //If the experiment is not started or is stopped
            if (!isExperimentRunning && isExperimentComplete)
            {
                //Close current experiment settingPane
                CloseExperimentSettingPane();
                experimentSettingForm = new FormExperimentSetting(currentExperimentType);

                //enable the FormActiveLearningSetting window always on the top
                experimentSettingForm.Owner = this;
                experimentSettingForm.Show();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Restart the experiment
        /// </summary>
        /// <param name="currentExperimentType"></param>
        /// <param name="playAndPauseButton"></param>
        /// <param name="currentProgressBar"></param>
        private void HandleRestartExperiment(ExperimentType currentExperimentType, Button playAndPauseButton, KryptonProgressBar currentProgressBar )
        {
            DialogResult messageBoxResult = MessageBox.Show("Are you sure to restart the simulation?", "Restart Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            // Confirm before stopping the experiment
            if (messageBoxResult == DialogResult.Yes)
            {
                isExperimentComplete = true;
                isExperimentRunning = false;

                // Cancel the asynchronous operation. 
                //Stop backgroundWorkers
                if (currentExperimentType == ExperimentType.ActiveLearning)
                {
                    this.backgroundWorkerForSimulation.CancelAsync();
                    this.backgroundWorkerForAccuracyGraph.CancelAsync();
                    ActiveLearning.isExperimentCompleted = true;
                }
                else if (currentExperimentType == ExperimentType.BatchRunning)
                {
                    this.backgroundWorkerBatchRunning.CancelAsync();
                }

                //Show Stopped message on the progress bar
                currentProgressBar.DisplayText = "Simulation Stopped";

                //initialTheExperiment and pop up the 
                experimentSettingForm = new FormExperimentSetting(currentExperimentType);
                experimentSettingForm.setPreviousExperimentSetting(currentExperimentSetting);
                //enable the FormActiveLearningSetting window always on the top
                experimentSettingForm.Owner = this;
                experimentSettingForm.Show();
                resetDataGridView();
                return;
            }
        
        }
        public FormExperimentSetting(ExperimentType currentExperimentType)
        {
            InitializeComponent();
            this.currentExperimentType = currentExperimentType;

            dropDownListOfWorkerSelectionMethod.Items.AddRange(Enum.GetNames(typeof(WorkerSelectionMethod)));

            //set current FormActiveLearningSetting instance pointer
            currentFormInstance = this;
            //Obtain all available datasets
            comboBoxForSelectingDataset.Items.AddRange(GlobalVariables.getAllDatasetNames());
            comboBoxForSelectingDataset.SelectedIndex = 0;

            dropDownListOfWorkerSelectionMethod.SelectedIndex = 0;
            //Run Default Experiment Settings
            RunDefaultExperimentSettings();
            SetComboBoxListOfRunTypesValue();
            currentListOfExperimentModels = new List <ExperimentModel>();

            //change the visibility of the buttons according to the current experiment type
            switch (currentExperimentType)
            {
            case ExperimentType.BatchRunning:

                btnRunExperiment.Visible      = false;
                buttonRunBatchRunning.Visible = true;

                //disable task selection method and worker selection method
                labelTaskSelectionMethod.Visible            = false;
                comboBoxListOfTaskSelectionMethods.Visible  = false;
                labelWorkerSelectionMethod.Visible          = false;
                dropDownListOfWorkerSelectionMethod.Visible = false;
                //change the outerbox to the corresponding experiment Type
                groupBoxExperimentOuterBox.Text = "Batch Running Settings";
                deleteButtonIndex = 1;
                groupBoxInitialNumberOfLabelling.Visible = false;

                //Enlarge the RunType and the AddModel Button
                comboBoxListOfRunTypes.Width = 727;
                break;

            case ExperimentType.ActiveLearning:

                btnRunExperiment.Visible      = true;
                buttonRunBatchRunning.Visible = false;
                deleteButtonIndex             = 3;
                //Enable task selection method and worker selection method
                labelTaskSelectionMethod.Visible            = true;
                comboBoxListOfTaskSelectionMethods.Visible  = true;
                labelWorkerSelectionMethod.Visible          = true;
                dropDownListOfWorkerSelectionMethod.Visible = true;
                groupBoxInitialNumberOfLabelling.Visible    = true;

                groupBoxExperimentOuterBox.Text = "Active Learning Settings";

                //Reset the normal size of the RunType and the AddModel Button
                comboBoxListOfRunTypes.Width = 256;
                break;

            default:
                break;
            }

            initCurrentModels();
        } //end Constructor