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 MakeFirstSimplexTableStep(UiDescription userData) { CurrentSimplexTable = _simplex.MakeFirstSimplexTable(CurrentProblem); CurrentSimplexTable = _simplex.CalculateRatings(CurrentSimplexTable); SetNextStep(IsEndStep); var tableSettings = new SimplexTableViewSettings { RowCount = CurrentSimplexTable.RowsCount, Variables = new List<string>(CurrentSimplexTable.Variables) }; return new UiDescription { {"LppView", "normalizedLpp", CurrentProblem}, {"Label", "lab1", "Заповніть першу симплекс-таблицю та підрахуйте оцінки."}, {"SimplexTableView", "table", "", CurrentSimplexTable, true, true, tableSettings} }; }
private UiDescription NextWeakenedProblemSolvingStep(UiDescription userData) { SetNextStep(IsEndStep); var prevTable = _currentSimplexTable; var result = _gomoryFirst.SolveWeekenedProblemWithCutoff(_weakenedNormalizedProblem, _currentSimplexTable, out _currentSimplexTable); var tableSettings = new SimplexTableViewSettings { RowCount = _currentSimplexTable.RowsCount, Variables = new List<string>(_currentSimplexTable.Variables) }; return new UiDescription { {"Label", "lab1", "Ф-ція цілі послабленої задачі:"}, {"TargetFunctionBox", "tf", _weakenedNormalizedProblem.TargetFunction}, {"Label", "lab2", "Перша симплекс-таблиця:"}, {"SimplexTableView", "firstTable", "", prevTable, false, false, tableSettings}, {"Label", "lab3", "Розв’яжіть послаблену задачу двоїстим симплекс-методом" + " та введіть останню симплекс-таблицю і результат:"}, {"SimplexTableView", "lastTable", "", _currentSimplexTable, true, true, tableSettings}, {"LppResultView", "result", "", result, true, true, _currentSimplexTable.Variables} }; }
private UiDescription CutoffAddingStep(UiDescription userData) { SetNextStep(NextWeakenedProblemSolvingStep); var sLabel = _gomoryFirst.GetFreeBasisVariableLabel(_currentSimplexTable); var cutoff = _gomoryFirst.MakeCutoff(_currentSimplexTable, ((StepVariants)userData["creativeVar"].Value).Variants.ElementAt(0), InitialProblem); var prevSimplexTable = _currentSimplexTable; _currentSimplexTable = _gomoryFirst.AddCutoff(_currentSimplexTable, sLabel, cutoff); var tableSettings = new SimplexTableViewSettings { RowCount = _currentSimplexTable.RowsCount, Variables = new List<string>(_currentSimplexTable.Variables) }; return new UiDescription { {"SimplexTableView", "prevTable", prevSimplexTable}, {"Label", "lab1", "Відсічення:"}, {"LimitationsArea", "limSystem", userData["limSystem"].Value}, {"Label", "lab2", "Нова симплекс-таблиця:"}, {"SimplexTableView", "table", "", _currentSimplexTable, true, true, tableSettings} }; }
private UiDescription FirstWeakenedProblemSolvingStep(UiDescription userData) { SetNextStep(IsEndStep); var result = _gomoryFirst.SolveInitialWeekenedProblem(InitialProblem, out _weakenedNormalizedProblem, out _currentSimplexTable); var tableSettings = new SimplexTableViewSettings { RowCount = _currentSimplexTable.RowsCount, Variables = new List<string>(_currentSimplexTable.Variables) }; return new UiDescription { {"Label", "lab1", "Приведена до виду, зручного до використання симплекс-методу:"}, {"LppView", "WNP", _weakenedNormalizedProblem}, {"Label", "lab2", "Розв’яжіть послаблену задачу та введіть останню симплекс-таблицю і результат:"}, {"SimplexTableView", "table", "", _currentSimplexTable, true, true, tableSettings}, {"LppResultView", "result", "", result, true, true, _weakenedNormalizedProblem.TargetFunctionArguments} }; }