diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-09-09 11:23:31 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-09-17 12:38:41 (GMT) |
commit | d267c0946b65e0c93cb97ebb3dea1035ff390280 (patch) | |
tree | d76735d4bdf283b6c7861da46dd47cdb919bbdb1 /src/gui/graphicsview/qsimplex_p.cpp | |
parent | 37b9577f00bfba78915dfd659499efbf04acce4e (diff) | |
download | Qt-d267c0946b65e0c93cb97ebb3dea1035ff390280.zip Qt-d267c0946b65e0c93cb97ebb3dea1035ff390280.tar.gz Qt-d267c0946b65e0c93cb97ebb3dea1035ff390280.tar.bz2 |
Implement hasConflicts().
Diffstat (limited to 'src/gui/graphicsview/qsimplex_p.cpp')
-rw-r--r-- | src/gui/graphicsview/qsimplex_p.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index 3bd6b5a..e3a991e 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -84,12 +84,12 @@ void QSimplex::clearDataStructures() objective = 0; } -void QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints) +bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints) { clearDataStructures(); if (newConstraints.isEmpty()) - return; + return true; // we are ok with no constraints constraints = newConstraints; // Set Variables direct mapping @@ -153,7 +153,7 @@ void QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints) matrix = (qreal *)malloc(sizeof(qreal) * columns * rows); if (!matrix) { qWarning() << "QSimplex: Unable to allocate memory!"; - return; + return false; } for (int i = columns * rows - 1; i >= 0; --i) matrix[i] = 0.0; @@ -198,11 +198,12 @@ void QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints) if (valueAt(0, columns - 1) != 0.0) { qWarning() << "QSimplex: No feasible solution!"; clearDataStructures(); - return; + return false; } // Remove artificial variables clearColumns(firstArtificial, columns - 2); + return true; } void QSimplex::solveMaxHelper() |