summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qsimplex_p.cpp
diff options
context:
space:
mode:
authorJan-Arve Sæther <jan-arve.saether@nokia.com>2009-09-09 11:23:31 (GMT)
committerJan-Arve Sæther <jan-arve.saether@nokia.com>2009-09-17 12:38:41 (GMT)
commitd267c0946b65e0c93cb97ebb3dea1035ff390280 (patch)
treed76735d4bdf283b6c7861da46dd47cdb919bbdb1 /src/gui/graphicsview/qsimplex_p.cpp
parent37b9577f00bfba78915dfd659499efbf04acce4e (diff)
downloadQt-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.cpp9
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()