diff --git a/ortools/lp_data/lp_data_utils.cc b/ortools/lp_data/lp_data_utils.cc index 48829adff2..6347247b77 100644 --- a/ortools/lp_data/lp_data_utils.cc +++ b/ortools/lp_data/lp_data_utils.cc @@ -29,37 +29,6 @@ namespace operations_research { namespace glop { -void ComputeSlackVariablesValues(const LinearProgram& linear_program, - DenseRow* values) { - DCHECK(values); - DCHECK_EQ(linear_program.num_variables(), values->size()); - - // If there are no slack variable, we can give up. - if (linear_program.GetFirstSlackVariable() == kInvalidCol) return; - - const auto& transposed_matrix = linear_program.GetTransposeSparseMatrix(); - for (RowIndex row(0); row < linear_program.num_constraints(); row++) { - const ColIndex slack_variable = linear_program.GetSlackVariable(row); - - if (slack_variable == kInvalidCol) continue; - - DCHECK_EQ(0.0, linear_program.constraint_lower_bounds()[row]); - DCHECK_EQ(0.0, linear_program.constraint_upper_bounds()[row]); - - const RowIndex transposed_slack = ColToRowIndex(slack_variable); - Fractional activation = 0.0; - // Row in the initial matrix (column in the transposed). - const SparseColumn& sparse_row = - transposed_matrix.column(RowToColIndex(row)); - for (const auto& entry : sparse_row) { - if (transposed_slack == entry.index()) continue; - activation += - (*values)[RowToColIndex(entry.index())] * entry.coefficient(); - } - (*values)[slack_variable] = -activation; - } -} - // This is separated from the LinearProgram class because of a cyclic dependency // when scaling as an LP. void Scale(LinearProgram* lp, SparseMatrixScaler* scaler) { diff --git a/ortools/lp_data/lp_data_utils.h b/ortools/lp_data/lp_data_utils.h index 59c6d54da4..1c4252c059 100644 --- a/ortools/lp_data/lp_data_utils.h +++ b/ortools/lp_data/lp_data_utils.h @@ -26,17 +26,6 @@ namespace operations_research { namespace glop { -// For all constraints in linear_program, if the constraint has a slack -// variable, change its value in *values so that the constraints itself is -// satisfied. -// Note that this obviously won't always imply that the bounds of the slack -// variable itself will be satisfied. -// The code assumes (and DCHECKs) that all constraints with a slack variable -// have their upper and lower bounds both set to 0. This is ensured by -// LinearProgram::AddSlackVariablesWhereNecessary(). -void ComputeSlackVariablesValues(const LinearProgram& linear_program, - DenseRow* values); - // This is separated from LinearProgram class because of a cyclic dependency // when scaling as an LP. void Scale(LinearProgram* lp, SparseMatrixScaler* scaler,