QSimplex Class
Header: | #include <QSimplex> |
Public Functions
QSimplex() | |
~QSimplex() | |
void | dumpMatrix() |
bool | setConstraints(const QList<QSimplexConstraint *> &newConstraints) |
void | setObjective(QSimplexConstraint *newObjective) |
qreal | solveMax() |
qreal | solveMin() |
Detailed Description
\internal
The QSimplex class is a Linear Programming problem solver based on the two-phase simplex method.
It takes a set of QSimplexConstraints as its restrictive constraints and an additional QSimplexConstraint as its objective function. Then methods to maximize and minimize the problem solution are provided.
The two-phase simplex method is based on the following steps: First phase: 1.a) Modify the original, complex, and possibly not feasible problem, into a new, easy to solve problem. 1.b) Set as the objective of the new problem, a feasible solution for the original complex problem. 1.c) Run simplex to optimize the modified problem and check whether a solution for the original problem exists.
Second phase: 2.a) Go back to the original problem with the feasibl (but not optimal) solution found in the first phase. 2.b) Set the original objective. 3.c) Run simplex to optimize the original problem towards its optimal solution.
Member Function Documentation
QSimplex::QSimplex()
\internal
[noexcept]
QSimplex::~QSimplex()
\internal
void QSimplex::dumpMatrix()
\internal
bool QSimplex::setConstraints(const QList<QSimplexConstraint *> &newConstraints)
\internal
Sets the new constraints in the simplex solver and returns whether the problem is feasible.
This method sets the new constraints, normalizes them, creates the simplex matrix and runs the first simplex phase.
void QSimplex::setObjective(QSimplexConstraint *newObjective)
\internal
qreal QSimplex::solveMax()
\internal
Maximize the original objective.
qreal QSimplex::solveMin()
\internal
Minimize the original objective.