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

Function debugNoInfo

highs/lp_data/HighsInfoDebug.cpp:132–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130}
131
132HighsDebugStatus debugNoInfo(const HighsInfo& info) {
133 HighsInfo no_info;
134 no_info.invalidate();
135 bool error_found = false;
136 const std::vector<InfoRecord*>& info_records = info.records;
137 const std::vector<InfoRecord*>& no_info_records = no_info.records;
138 HighsInt num_info = info_records.size();
139 for (HighsInt index = 0; index < num_info; index++) {
140 HighsInfoType type = info_records[index]->type;
141 if (type == HighsInfoType::kInt64) {
142 int v0 = (int)*(((InfoRecordInt64*)info_records[index])[0].value);
143 int v1 = (int)*(((InfoRecordInt64*)info_records[index])[0].value);
144 if (v0 != v1)
145 printf("debugNoInfo: Index %" HIGHSINT_FORMAT " has %d != %d \n", index,
146 v0, v1);
147 error_found = (*(((InfoRecordInt64*)info_records[index])[0].value) !=
148 *(((InfoRecordInt64*)no_info_records[index])[0].value)) ||
149 error_found;
150 } else if (type == HighsInfoType::kInt) {
151 int v0 = (int)*(((InfoRecordInt*)info_records[index])[0].value);
152 int v1 = (int)*(((InfoRecordInt*)info_records[index])[0].value);
153 if (v0 != v1)
154 printf("debugNoInfo: Index %" HIGHSINT_FORMAT " has %d != %d \n", index,
155 v0, v1);
156 error_found = (*(((InfoRecordInt*)info_records[index])[0].value) !=
157 *(((InfoRecordInt*)no_info_records[index])[0].value)) ||
158 error_found;
159 } else if (type == HighsInfoType::kDouble) {
160 double v0 = (double)*(((InfoRecordDouble*)info_records[index])[0].value);
161 double v1 = (double)*(((InfoRecordDouble*)info_records[index])[0].value);
162 if (v0 != v1)
163 printf("debugNoInfo: Index %" HIGHSINT_FORMAT " has %g != %g \n", index,
164 v0, v1);
165 error_found = (*(((InfoRecordDouble*)info_records[index])[0].value) !=
166 *(((InfoRecordDouble*)no_info_records[index])[0].value)) ||
167 error_found;
168 } else {
169 assert(1 == 0);
170 }
171 }
172 error_found = (info.valid != no_info.valid) || error_found;
173 if (error_found) return HighsDebugStatus::kLogicalError;
174 return HighsDebugStatus::kOk;
175}

Callers 1

debugInfoFunction · 0.85

Calls 2

invalidateMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected