| 246 | } |
| 247 | |
| 248 | void 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 | |
| 284 | void testLp(Highs& h, const double cost, const double col_lower, |
| 285 | const double bound) { |
no test coverage detected