MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / singletonRow

Method singletonRow

highs/presolve/HPresolve.cpp:3205–3346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3203}
3204
3205HPresolve::Result HPresolve::singletonRow(HighsPostsolveStack& postsolve_stack,
3206 HighsInt row) {
3207 const bool logging_on = analysis_.logging_on_;
3208 if (logging_on) analysis_.startPresolveRuleLog(kPresolveRuleSingletonRow);
3209 assert(!rowDeleted[row]);
3210 assert(rowsize[row] == 1);
3211
3212 // the tree of nonzeros of this row should just contain the single nonzero
3213 HighsInt nzPos = rowroot[row];
3214 assert(nzPos != -1);
3215 // nonzero should have the row in the row array
3216 assert(Arow[nzPos] == row);
3217 // tree with one element should not have children
3218 assert(ARleft[nzPos] == -1);
3219 assert(ARright[nzPos] == -1);
3220
3221 HighsInt col = Acol[nzPos];
3222 double val = Avalue[nzPos];
3223
3224 // printf("singleton row\n");
3225 // debugPrintRow(row);
3226 // delete row singleton nonzero directly, we have all information that we need
3227 // in local variables
3228 markRowDeleted(row);
3229 unlink(nzPos);
3230
3231 // check for simple
3232 if (val > 0) {
3233 if (model->col_upper_[col] * val <=
3234 model->row_upper_[row] + primal_feastol &&
3235 model->col_lower_[col] * val >=
3236 model->row_lower_[row] - primal_feastol) {
3237 postsolve_stack.redundantRow(row);
3238 analysis_.logging_on_ = logging_on;
3239 if (logging_on) analysis_.stopPresolveRuleLog(kPresolveRuleSingletonRow);
3240 return checkLimits(postsolve_stack);
3241 }
3242 } else {
3243 if (model->col_lower_[col] * val <=
3244 model->row_upper_[row] + primal_feastol &&
3245 model->col_upper_[col] * val >=
3246 model->row_lower_[row] - primal_feastol) {
3247 postsolve_stack.redundantRow(row);
3248 analysis_.logging_on_ = logging_on;
3249 if (logging_on) analysis_.stopPresolveRuleLog(kPresolveRuleSingletonRow);
3250 return checkLimits(postsolve_stack);
3251 }
3252 }
3253
3254 // zeros should not be linked in the matrix
3255 assert(std::fabs(val) > options->small_matrix_value);
3256
3257 double newColUpper = kHighsInf;
3258 double newColLower = -kHighsInf;
3259 if (val > 0) {
3260 if (model->row_upper_[row] != kHighsInf)
3261 newColUpper = model->row_upper_[row] / val;
3262 if (model->row_lower_[row] != -kHighsInf)

Callers

nothing calls this directly

Calls 4

startPresolveRuleLogMethod · 0.80
redundantRowMethod · 0.80
stopPresolveRuleLogMethod · 0.80
removedFixedColMethod · 0.80

Tested by

no test coverage detected