diff --git a/libsolutil/LP.cpp b/libsolutil/LP.cpp index 02da1fb96..41f1f5d34 100644 --- a/libsolutil/LP.cpp +++ b/libsolutil/LP.cpp @@ -74,8 +74,7 @@ struct Tableau /// Adds slack variables to remove non-equality costraints from a set of constraints /// and returns the data part of the tableau / constraints. -/// The second return variable is true if a non-equality constraint was -/// found and thus new variables have been added. +/// The second return variable is true if a the original input had any equality constraints. pair, bool> toEquationalForm(vector _constraints) { size_t varsNeeded = static_cast(ranges::count_if(_constraints, [](Constraint const& _c) { return !_c.equality; })); @@ -101,7 +100,7 @@ pair, bool> toEquationalForm(vector _constr for (Constraint& c: _constraints) data.emplace_back(move(c.data)); - return make_pair(move(data), varsNeeded > 0); + return make_pair(move(data), varsNeeded < _constraints.size()); } /// Finds the simplex pivot column: The column with the largest positive objective factor.