Skip to content

Commit b7b1777

Browse files
authored
Merge pull request #3758 from rajgoel/zero_index
Allow last_variable_index_ to be zero
2 parents 3e8ac86 + c65083d commit b7b1777

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

ortools/linear_solver/cplex_interface.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,8 @@ void CplexInterface::ExtractNewConstraints() {
863863

864864
CPXDIM newCons = total - offset;
865865
CPXDIM const cols = CPXXgetnumcols(mEnv, mLp);
866-
DCHECK_EQ(last_variable_index_, cols);
866+
CHECK(last_variable_index_ == 0 ||
867+
last_variable_index_ == cols);
867868
CPXDIM const chunk = 10; // max number of rows to add in one shot
868869

869870
// Update indices of new constraints _before_ actually extracting
@@ -950,7 +951,8 @@ void CplexInterface::ExtractObjective() {
950951
// any non-zero duplicates.
951952

952953
CPXDIM const cols = CPXXgetnumcols(mEnv, mLp);
953-
DCHECK_EQ(last_variable_index_, cols);
954+
CHECK(last_variable_index_ == 0 ||
955+
last_variable_index_ == cols);
954956

955957
unique_ptr<CPXDIM[]> ind(new CPXDIM[cols]);
956958
unique_ptr<double[]> val(new double[cols]);

0 commit comments

Comments
 (0)