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

Function testUserScale

check/TestUserScale.cpp:248–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

246}
247
248void testUserScale(Highs& h) {
249 h.setOptionValue("user_objective_scale", 0);
250 h.setOptionValue("user_bound_scale", 0);
251 if (dev_run)
252 printf("\n---------------\nWithout user scaling\n---------------\n");
253 h.writeModel("");
254 h.run();
255 h.writeSolution("", 1);
256 double unscaled_objective_value = h.getInfo().objective_function_value;
257 if (dev_run)
258 printf("\n---------------\nWith user scaling\n---------------\n");
259 HighsInt suggested_objective_scale;
260 HighsInt suggested_bound_scale;
261 h.getObjectiveBoundScaling(suggested_objective_scale, suggested_bound_scale);
262 if (dev_run)
263 printf(
264 "Highs::getObjectiveBoundScaling suggested cost / bound scale values "
265 "of "
266 "%d / %d\n",
267 int(suggested_objective_scale), int(suggested_bound_scale));
268 const bool has_suggested_scaling =
269 suggested_objective_scale || suggested_bound_scale;
270 if (!has_suggested_scaling) {
271 suggested_objective_scale = 2;
272 suggested_bound_scale = 1;
273 }
274
275 h.setOptionValue("user_objective_scale", suggested_objective_scale);
276 h.setOptionValue("user_bound_scale", suggested_bound_scale);
277 h.clearSolver();
278 h.run();
279 h.writeSolution("", 1);
280 REQUIRE(doubleEqual0(unscaled_objective_value,
281 h.getInfo().objective_function_value));
282}
283
284void testLp(Highs& h, const double cost, const double col_lower,
285 const double bound) {

Callers 3

testLpFunction · 0.85
testMipFunction · 0.85
testQpFunction · 0.85

Calls 8

doubleEqual0Function · 0.85
setOptionValueMethod · 0.45
writeModelMethod · 0.45
runMethod · 0.45
writeSolutionMethod · 0.45
getInfoMethod · 0.45
clearSolverMethod · 0.45

Tested by

no test coverage detected