summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qsimplex_p.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Cosmetic fixes to the previous patches.Jan-Arve Sæther2009-10-071-2/+2
| | | | | | There is only one change in the actual code here, and it simply removes an unnecessary initialization of hasSize in the ctors of the composite anchors.
* QSimplex: Remove overly conservative assertionEduardo M. Fleury2009-10-061-18/+6
| | | | | | | | | | | | | This assertion started failing after the addition of expanding state. After some investigation we felt that the assertion itself was too strong and would fail in some valid cases. The new assertion is formally right as it tests whether the simplex solver was able to satisfy the simplex constraints, _exactly_ what it is expected to do. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>
* Doc fix.Alexis Menard2009-10-051-0/+30
| | | | Reviewed-by:TrustMe
* Dont generate public docs for QSimplex.Jan-Arve Sæther2009-09-291-0/+4
|
* Use qDebug() instead of printf() when dumping the simplex matrix.Jan-Arve Sæther2009-09-251-12/+10
| | | | | | printf() does not work very well on windows, since it will not send the output to OutputDebugString(). This allows us to catch the output even if the program is configured without "CONFIG += console".
* QGraphicsAnchorLayout: Fix bug where simplex would return wrong resultsEduardo M. Fleury2009-09-251-0/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Jan-Arve found a bug where QSimplex would return bad results in some tight situations. The problem was triggered randomly but the chances of appearance were higher in problems with only one feasible solution, ie. problems what were in the boundary of feasibility. The QSimplex solver implements a two-phase simplex solver, the first phase is responsible for finding a _feasible_ solution for the problem (not the best one). The second phase starts with the basic feasible solution (just found) and changes until one that is _optimal_ is found. To implement that solution we need to add artificial variables to the original problem, before phase 1, and remove them, before starting phase 2. Unfortunately though, there was some randomness in the criteria used by the solver that would sometimes cause the removal of a good variable instead of an artificial one, between the phases. With one good variable missing, the solver would also miss an important restriction, without such, it would push the objective function too far, thus returning a "wrong" result. This commit adds a tie-breaker condition to the pivot row logic to ensure the artificial variables are removed before the "good" ones. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Artur Duque de Souza <artur.souza@openbossa.org>
* QSimplex: Add class and methods documentationEduardo M. Fleury2009-09-251-5/+108
| | | | | | | | | | This private class is used by QGraphicsAnchorLayout as the linear programming solver engine. This method adds documentation to implementation, method and classes. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>
* Implement hasConflicts().Jan-Arve Sæther2009-09-171-4/+5
|
* Update license headers again.Jason McDonald2009-09-091-4/+4
| | | | Reviewed-by: Trust Me
* Update tech preview license header for files that are new in 4.6.Jason McDonald2009-08-311-13/+13
| | | | Reviewed-by: Trust Me
* fix warnings on Windows CEJoerg Bornemann2009-08-261-1/+1
| | | | | | | Lots of warnings in the qreal == float case. Some Q_UNUSED added. Reviewed-by: thartman
* Add missing license headers and header guards.Jason McDonald2009-08-211-0/+41
| | | | Reviewed-by: Trust Me
* make the new anchor layout code compile with namespaceshjk2009-08-211-1/+4
|
* Fix typo: feaseable => feasibleJan-Arve Sæther2009-07-221-1/+1
|
* QSimplex: Skip x = x + y*0.0Anselmo Lacerda S. de Melo2009-07-221-1/+7
| | | | | | | | A small optimization. Added a verification in combineRows to skip calculating x = x + y*0.0 as it obviously won't change the value of x. Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
* QSimplex: new method solver, avoinding code replicationAnselmo Lacerda S. de Melo2009-07-221-18/+16
| | | | | | | | | | | The methods solveMin() and solveMax() had similar implementation, except by a "-1" multiplier. This commit includes a new private method called solver that is called by both solveMin() and solveMax(). A new enum 'solverFactor' was added admiting 2 values - Maximum (+1) and Minimum (-1). Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
* QGraphicsAnchorLayout: Fix memory management issue in QSimplex solverEduardo M. Fleury2009-07-221-1/+1
| | | | | | | | | | | | | | | Both QGraphicsAnchorLayoutPrivate::solveMinMax() and solvePreferred() were deleting the linear programming contraints while QSimplex still had them. For solveMinMax(), move the creation of constraints out of that method. For solvePreferred(), create the simplex solver in the heap so it can be deleted before the constraints are. Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Reviewed-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org>
* QSimplex: Adding the Simplex solver for linear systemsJesus Sanchez-Palencia2009-07-221-0/+364
This implementation is based on the iterative algorithm presented in http://en.wikibooks.org/wiki/Operations_Research/The_Simplex_Method. It is capable of giving us the solution to any n variable LP model. Although we focused on QGraphicsAnchorLayout, the solver is general enough for being reused in any other Qt classes if needed. Signed-off-by: Anselmo Lacerda S. de Melo <anselmo.melo@openbossa.org> Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org> Signed-off-by: Eduardo M. Fleury <eduardo.fleury@openbossa.org> Signed-off-by: Jesus Sanchez-Palencia <jesus.palencia@openbossa.org>