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

Method debugNonbasicFreeColumnSet

highs/simplex/HEkkDebug.cpp:1433–1502  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1431}
1432
1433HighsDebugStatus HEkk::debugNonbasicFreeColumnSet(
1434 const HighsInt num_free_col, const HSet nonbasic_free_col_set) const {
1435 const HighsOptions& options = *(this->options_);
1436 if (options.highs_debug_level < kHighsDebugLevelCheap)
1437 return HighsDebugStatus::kNotChecked;
1438 const HighsLp& lp = this->lp_;
1439 const HighsSimplexInfo& info = this->info_;
1440 const SimplexBasis& basis = this->basis_;
1441 HighsInt num_tot = lp.num_col_ + lp.num_row_;
1442
1443 // Check the number of free columns
1444 HighsInt check_num_free_col = 0;
1445 for (HighsInt iVar = 0; iVar < num_tot; iVar++) {
1446 if (info.workLower_[iVar] <= -kHighsInf &&
1447 info.workUpper_[iVar] >= kHighsInf)
1448 check_num_free_col++;
1449 }
1450 if (check_num_free_col != num_free_col) {
1451 highsLogDev(options.log_options, HighsLogType::kInfo,
1452 "NonbasicFreeColumnData: Number of free columns should be "
1453 "%" HIGHSINT_FORMAT ", not %" HIGHSINT_FORMAT "\n",
1454 check_num_free_col, num_free_col);
1455 return HighsDebugStatus::kLogicalError;
1456 }
1457 if (!num_free_col) return HighsDebugStatus::kOk;
1458 // Debug HSet nonbasic_free_col
1459 bool nonbasic_free_col_ok = nonbasic_free_col_set.debug();
1460 if (!nonbasic_free_col_ok) {
1461 highsLogDev(options.log_options, HighsLogType::kInfo,
1462 "NonbasicFreeColumnData: HSet error\n");
1463 return HighsDebugStatus::kLogicalError;
1464 }
1465
1466 // Check that we have the right number of nonbasic free columns
1467 const HighsInt& num_nonbasic_free_col = nonbasic_free_col_set.count();
1468 HighsInt check_num_nonbasic_free_col = 0;
1469 for (HighsInt iVar = 0; iVar < num_tot; iVar++) {
1470 bool nonbasic_free = basis.nonbasicFlag_[iVar] == kNonbasicFlagTrue &&
1471 info.workLower_[iVar] <= -kHighsInf &&
1472 info.workUpper_[iVar] >= kHighsInf;
1473 if (nonbasic_free) check_num_nonbasic_free_col++;
1474 }
1475 if (check_num_nonbasic_free_col != num_nonbasic_free_col) {
1476 highsLogDev(options.log_options, HighsLogType::kInfo,
1477 "NonbasicFreeColumnData: Set should have %" HIGHSINT_FORMAT
1478 " entries, not %" HIGHSINT_FORMAT "\n",
1479 check_num_nonbasic_free_col, num_nonbasic_free_col);
1480 return HighsDebugStatus::kLogicalError;
1481 }
1482 // Check that all in the set are nonbasic free columns
1483 const vector<HighsInt>& nonbasic_free_col_set_entry =
1484 nonbasic_free_col_set.entry();
1485 for (HighsInt ix = 0; ix < num_nonbasic_free_col; ix++) {
1486 HighsInt iVar = nonbasic_free_col_set_entry[ix];
1487 bool nonbasic_free = basis.nonbasicFlag_[iVar] == kNonbasicFlagTrue &&
1488 info.workLower_[iVar] <= -kHighsInf &&
1489 info.workUpper_[iVar] >= kHighsInf;
1490 if (!nonbasic_free) {

Callers 1

debugPrimalSimplexMethod · 0.80

Calls 3

highsLogDevFunction · 0.85
countMethod · 0.80
debugMethod · 0.45

Tested by

no test coverage detected