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

Method debug

highs/util/HSet.cpp:93–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93bool HSet::debug() const {
94 if (!setup_) {
95 if (output_flag_) fprintf(log_file_, "HSet: ERROR setup_ not called\n");
96 if (allow_assert_) assert(setup_);
97 return false;
98 }
99 bool max_entry_ok = max_entry_ >= min_entry;
100 if (!max_entry_ok) {
101 if (output_flag_) {
102 fprintf(log_file_,
103 "HSet: ERROR max_entry_ = %" HIGHSINT_FORMAT
104 " < %" HIGHSINT_FORMAT "\n",
105 max_entry_, min_entry);
106 print();
107 }
108 if (allow_assert_) assert(max_entry_ok);
109 return false;
110 }
111 HighsInt size = entry_.size();
112 bool size_count_ok = size >= count_;
113 if (!size_count_ok) {
114 if (output_flag_) {
115 fprintf(log_file_,
116 "HSet: ERROR entry_.size() = %" HIGHSINT_FORMAT
117 " is less than count_ = %" HIGHSINT_FORMAT "\n",
118 size, count_);
119 print();
120 }
121 if (allow_assert_) assert(size_count_ok);
122 return false;
123 }
124 // Check pointer_ is consistent with count_ and entry_
125 HighsInt count = 0;
126 for (HighsInt ix = 0; ix <= max_entry_; ix++) {
127 HighsInt pointer = pointer_[ix];
128 if (pointer == no_pointer) continue;
129 bool pointer_ok = pointer >= 0 && pointer < count_;
130 if (!pointer_ok) {
131 if (output_flag_) {
132 fprintf(log_file_,
133 "HSet: ERROR pointer_[%" HIGHSINT_FORMAT "] = %" HIGHSINT_FORMAT
134 " is not in [0, %" HIGHSINT_FORMAT "]\n",
135 ix, pointer, count_);
136 print();
137 }
138 if (allow_assert_) assert(pointer_ok);
139 return false;
140 }
141 count++;
142 HighsInt entry = entry_[pointer];
143 bool entry_ok = entry == ix;
144 if (!entry_ok) {
145 if (output_flag_) {
146 fprintf(log_file_,
147 "HSet: ERROR entry_[%" HIGHSINT_FORMAT "] is %" HIGHSINT_FORMAT
148 ", not %" HIGHSINT_FORMAT "\n",
149 pointer, entry, ix);
150 print();

Callers 1

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected