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

Method debugNonbasicFlagConsistent

highs/simplex/HEkkDebug.cpp:904–937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

902}
903
904HighsDebugStatus HEkk::debugNonbasicFlagConsistent() const {
905 if (this->options_->highs_debug_level < kHighsDebugLevelCheap)
906 return HighsDebugStatus::kNotChecked;
907 HighsDebugStatus return_status = HighsDebugStatus::kOk;
908 const HighsOptions& options = *(this->options_);
909 const HighsLp& lp = this->lp_;
910 const SimplexBasis& basis = this->basis_;
911 HighsInt numTot = lp.num_col_ + lp.num_row_;
912 const bool right_size = (HighsInt)basis.nonbasicFlag_.size() == numTot;
913 if (!right_size) {
914 highsLogDev(options.log_options, HighsLogType::kError,
915 "nonbasicFlag size error\n");
916 assert(right_size);
917 return_status = HighsDebugStatus::kLogicalError;
918 }
919 HighsInt num_basic_variables = 0;
920 for (HighsInt var = 0; var < numTot; var++) {
921 if (basis.nonbasicFlag_[var] == kNonbasicFlagFalse) {
922 num_basic_variables++;
923 } else {
924 assert(basis.nonbasicFlag_[var] == kNonbasicFlagTrue);
925 }
926 }
927 bool right_num_basic_variables = num_basic_variables == lp.num_row_;
928 if (!right_num_basic_variables) {
929 highsLogDev(options.log_options, HighsLogType::kError,
930 "nonbasicFlag has %" HIGHSINT_FORMAT ", not %" HIGHSINT_FORMAT
931 " basic variables\n",
932 num_basic_variables, lp.num_row_);
933 assert(right_num_basic_variables);
934 return_status = HighsDebugStatus::kLogicalError;
935 }
936 return return_status;
937}
938
939HighsDebugStatus HEkk::debugNonbasicMove(const HighsLp* pass_lp) const {
940 // Non-trivially expensive check of NonbasicMove

Callers 1

debugBasisConsistentMethod · 0.95

Calls 2

highsLogDevFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected