private UiDescription SolvingElementChoosingStep(UiDescription userData) { SetNextStep(MakeNextSimplexTableStep); var solvingElement = _simplex.GetSolvingElement(CurrentSimplexTable); var varsString = string.Empty; var variableCount = CurrentSimplexTable.Variables.Count; for (var i = 0; i < variableCount; i++) varsString += CurrentSimplexTable.Variables.ElementAt(i) + (i == variableCount - 1 ? "" : "|"); var cellVariable = new StepVariants(new[] { CurrentSimplexTable.GetVariable(solvingElement.CellIndex) }); var rowVariable = new StepVariants(new[] { CurrentSimplexTable.GetBasisVariableLabel(solvingElement.RowIndex) }); return new UiDescription { {"SimplexTableView", "table", "", CurrentSimplexTable}, {"Label", "lab1", "Виберіть змінну, яка вводиться в базис:"}, {"StepsContainer", "cellVar", varsString, cellVariable, true, true}, {"Label", "lab2", "Виберіть змінну, яка виводиться з базису:"}, {"StepsContainer", "rowVar", varsString, rowVariable, true, true} }; }
private UiDescription IsEndStep(UiDescription userData) { SetNextStep(_solveActionsSteps[IsEndRightVariant]); var nextStepRightVariant = new StepVariants(new[] { _solveActionsLabels[IsEndRightVariant] }); return new UiDescription { {"SimplexTableView", "table", "", CurrentSimplexTable}, {"Label", "lab1", "Подальші дії?"}, {"StepsContainer", "variants", IsEndAllVariants, nextStepRightVariant, true, true} }; }
private UiDescription MakeNextSimplexTableStep(UiDescription userData) { SetNextStep(IsEndStep); var prevTable = CurrentSimplexTable; var solvingElement = _simplex.GetSolvingElement(CurrentSimplexTable); var cellVariable = new StepVariants(new[] { CurrentSimplexTable.GetVariable(solvingElement.CellIndex) }); var rowVariable = new StepVariants(new[] { CurrentSimplexTable.GetBasisVariableLabel(solvingElement.RowIndex) }); CurrentSimplexTable = _simplex.NextSimplexTable(CurrentSimplexTable, solvingElement); var tableSettings = new SimplexTableViewSettings { RowCount = CurrentSimplexTable.RowsCount, Variables = new List<string>(CurrentSimplexTable.Variables) }; return new UiDescription { {"TargetFunctionBox", "targetFunction", CurrentProblem.TargetFunction}, {"SimplexTableView", "prevTable", prevTable}, { "Label", "lab2", "Нова симплекс-таблиця(" + cellVariable.Variants.ElementAt(0) + " вводиться в базис, " + rowVariable.Variants.ElementAt(0) + " - виводиться)."}, {"SimplexTableView", "table", "", CurrentSimplexTable, true, true, tableSettings} }; }
private UiDescription IsEndStep(UiDescription userData) { StepVariants nextStepRightVariant; if (_dualSimplex.IsEnd(CurrentSimplexTable)) { nextStepRightVariant = new StepVariants(new[] { ResultEnteringLabel }); SetNextStep(NormalizedProblemResultEnteringStep); } else { nextStepRightVariant = new StepVariants(new[] { SolvingElementChoosingLabel }); SetNextStep(SolvingElementChoosingStep); } return new UiDescription { {"SimplexTableView", "table", "", CurrentSimplexTable}, {"Label", "lab1", "Подальші дії?"}, { "StepsContainer", "variants", ResultEnteringLabel + "|" + SolvingElementChoosingLabel, nextStepRightVariant, true, true } }; }