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

Method getBasicVariablesInterface

highs/lp_data/HighsInterface.cpp:1438–1476  ·  view source on GitHub ↗

Get the basic variables, performing INVERT if necessary

Source from the content-addressed store, hash-verified

1436
1437// Get the basic variables, performing INVERT if necessary
1438HighsStatus Highs::getBasicVariablesInterface(HighsInt* basic_variables) {
1439 HighsStatus return_status = HighsStatus::kOk;
1440 HighsLp& lp = model_.lp_;
1441 HighsInt num_row = lp.num_row_;
1442 HighsInt num_col = lp.num_col_;
1443 HighsSimplexStatus& ekk_status = ekk_instance_.status_;
1444 // For an LP with no rows the solution is vacuous
1445 if (num_row == 0) return return_status;
1446 if (!basis_.valid) {
1447 highsLogUser(options_.log_options, HighsLogType::kError,
1448 "getBasicVariables called without a HiGHS basis\n");
1449 return HighsStatus::kError;
1450 }
1451 if (!ekk_status.has_invert) {
1452 // The LP has no invert to use, so have to set one up, but only
1453 // for the current basis, so return_value is the rank deficiency.
1454 HighsLpSolverObject solver_object(lp, basis_, solution_, info_,
1455 ekk_instance_, callback_, options_,
1456 timer_);
1457 solver_object.setProfiling(this->profiling_);
1458 const bool only_from_known_basis = true;
1459 return_status = interpretCallStatus(
1460 options_.log_options,
1461 formSimplexLpBasisAndFactor(solver_object, only_from_known_basis),
1462 return_status, "formSimplexLpBasisAndFactor");
1463 if (return_status != HighsStatus::kOk) return return_status;
1464 }
1465 assert(ekk_status.has_invert);
1466
1467 for (HighsInt row = 0; row < num_row; row++) {
1468 HighsInt var = ekk_instance_.basis_.basicIndex_[row];
1469 if (var < num_col) {
1470 basic_variables[row] = var;
1471 } else {
1472 basic_variables[row] = -(1 + var - num_col);
1473 }
1474 }
1475 return return_status;
1476}
1477
1478// Solve (transposed) system involving the basis matrix
1479

Callers

nothing calls this directly

Calls 4

highsLogUserFunction · 0.85
interpretCallStatusFunction · 0.85
setProfilingMethod · 0.45

Tested by

no test coverage detected