Beispiel #1
0
 private void mnuShowNormalizedCriterionValues_Click(object sender, EventArgs e)
 {
     this._showNormalizedCriterionValues = this.mnuShowNormalizedCriterionValues.Checked;
     IntegralCriterionResultDataGridFiller.FillDataGrid(
         this._model,
         this._result,
         this.dgvData,
         this._showNormalizedCriterionValues);
 }
Beispiel #2
0
        public IntegralResultsForm(
            Form prevForm,
            Model model,
            Dictionary <TId, UtilityFunction> utilityFunctions,
            IntegralCriterionMethods method)
        {
            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._utilityFunctions = utilityFunctions;

            this._showNormalizedCriterionValues = false;
            this._showUtilityFunctionValues     = false;

            IIntegralCriterionMethodSolver solver = new AdditiveCriterionSolver();

            switch (method)
            {
            case IntegralCriterionMethods.AdditiveCriterion:
            case IntegralCriterionMethods.AdditiveCriterionWithUtilityFunction:
                solver = new AdditiveCriterionSolver();
                break;

            case IntegralCriterionMethods.MultiplicativeCriterion:
            case IntegralCriterionMethods.MultiplicativeCriterionWithUtilityFunction:
                solver = new MultiplicativeCriterionSolver();
                break;

            case IntegralCriterionMethods.MinimaxMethod:
                solver = new MinimaxSolver();
                // Уберем возможность показывать значения функции полезности
                this.mnuShowUtilityFunctionValues.Enabled = false;
                break;
            }

            switch (method)
            {
            case IntegralCriterionMethods.AdditiveCriterion:
            case IntegralCriterionMethods.MultiplicativeCriterion:
            case IntegralCriterionMethods.MinimaxMethod:
                this.mnuShowUtilityFunctionValues.Enabled     = false;
                this.mnuShowNormalizedCriterionValues.Enabled = true;
                this._result = solver.FindDecision(this._model);
                IntegralCriterionResultDataGridFiller.FillDataGrid(
                    this._model,
                    this._result,
                    this.dgvData,
                    this._showNormalizedCriterionValues);
                break;

            case IntegralCriterionMethods.AdditiveCriterionWithUtilityFunction:
            case IntegralCriterionMethods.MultiplicativeCriterionWithUtilityFunction:
                this.mnuShowUtilityFunctionValues.Enabled     = true;
                this.mnuShowNormalizedCriterionValues.Enabled = false;
                this._result =
                    solver.FindDecisionWithUtilityFunction(this._model, this._utilityFunctions);
                IntegralCriterionResultDataGridFiller.FillDataGridWithUtilityFunction(
                    this._model,
                    this._utilityFunctions,
                    this._result,
                    this.dgvData,
                    this._showUtilityFunctionValues);
                break;
            }

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