예제 #1
0
        public AdditiveProcessForm(
            Form prevForm,
            Model model,
            AdditiveParams gaParams)
        {
            InitializeComponent();

            // Подстройка интерфейса
            this.Left = prevForm.Left;
            this.Top  = prevForm.Top;
            if (this.FormBorderStyle != FormBorderStyle.FixedSingle)
            {
                this.WindowState = prevForm.WindowState;
            }
            if (this.WindowState == FormWindowState.Normal)
            {
                this.Width  = prevForm.Width;
                this.Height = prevForm.Height;
            }

            this._prevForm = prevForm;
            this._model    = model;
            this._gaParams = gaParams;

            // Поищем решение
            this._result = AdditiveSolver.FindDecision(this._model, this._gaParams, this.dgvData);

            // Запустим сборщик мусора, чтобы убить
            // предыдущие ветки
            System.GC.Collect();
        }
예제 #2
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            string externalAppPath = this.txtExternalAppPath.Text.Trim();

            if (string.IsNullOrEmpty(externalAppPath))
            {
                MessageBoxHelper.ShowExclamation("Необходимо выбрать внешнюю расчетную программу, которая будет осуществлять расчет значений критериев");
                return;
            }

            AdditiveParams geneticAlgorithmParams =
                new AdditiveParams(this._model.Experiments.CountActiveExperiments(),
                                   (int)this.nudSelectionLimit.Value,
                                   (double)this.nudMutationProbability.Value,
                                   (int)this.nudMaxGenerationsNumber.Value,
                                   externalAppPath);

            if (this.chbShowProcess.Checked)
            {
                this._nextForm = new AdditiveProcessForm(this, this._model, geneticAlgorithmParams);
            }
            else
            {
                this._nextForm = new AdditiveResultsForm(this, this._model, geneticAlgorithmParams);
            }

            this._nextForm.Show();
            this.Hide();
        }
예제 #3
0
        public AdditiveResultsForm(
            Form prevForm,
            Model model,
            AdditiveParams gaParams)
        {
            InitializeComponent();

            // Подстройка интерфейса
            this.Left = prevForm.Left;
            this.Top  = prevForm.Top;
            if (this.FormBorderStyle != FormBorderStyle.FixedSingle)
            {
                this.WindowState = prevForm.WindowState;
            }
            if (this.WindowState == FormWindowState.Normal)
            {
                this.Width  = prevForm.Width;
                this.Height = prevForm.Height;
            }

            this._prevForm = prevForm;
            this._model    = model;
            this._gaParams = gaParams;

            // Придется искать решение, потому что пользователь
            // не захотел смотреть на процесс его поиска
            this._result = AdditiveSolver.FindDecision(this._model, this._gaParams, null);
            // Выведем на экран
            AdditiveDataGridFiller.FillDataGrid(
                this._model,
                this._result,
                this.dgvData);

            // Запустим сборщик мусора, чтобы убить
            // предыдущие ветки
            System.GC.Collect();
        }
예제 #4
0
        public AdditiveResultsForm(
            Form prevForm,
            Model model,
            AdditiveMethodResult result)
        {
            InitializeComponent();

            // Подстройка интерфейса
            this.Left = prevForm.Left;
            this.Top  = prevForm.Top;
            if (this.FormBorderStyle != FormBorderStyle.FixedSingle)
            {
                this.WindowState = prevForm.WindowState;
            }
            if (this.WindowState == FormWindowState.Normal)
            {
                this.Width  = prevForm.Width;
                this.Height = prevForm.Height;
            }

            this._prevForm = prevForm;
            this._model    = model;
            this._gaParams = null;

            // Решение уже найдено
            this._result = result;
            // Выведем на экран
            AdditiveDataGridFiller.FillDataGrid(
                this._model,
                this._result,
                this.dgvData);

            // Запустим сборщик мусора, чтобы убить
            // предыдущие ветки
            System.GC.Collect();
        }