Skip to content

Commit 42b9d8d

Browse files
committed
Now to add large objective/bound tests for user scaling
1 parent 456c187 commit 42b9d8d

File tree

2 files changed

+29
-18
lines changed

2 files changed

+29
-18
lines changed

check/TestUserScale.cpp

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -199,19 +199,23 @@ HighsHessian hessian(const double value) {
199199
void testUserScale(Highs& h) {
200200
h.setOptionValue("user_cost_scale", 0);
201201
h.setOptionValue("user_bound_scale", 0);
202-
if (dev_run) printf("\n---------------\nWithout user scaling\n---------------\n");
202+
if (dev_run)
203+
printf("\n---------------\nWithout user scaling\n---------------\n");
203204
h.writeModel("");
204205
h.run();
205206
h.writeSolution("", 1);
206207
double unscaled_objective_value = h.getInfo().objective_function_value;
207-
if (dev_run) printf("\n---------------\nWith user scaling\n---------------\n");
208+
if (dev_run)
209+
printf("\n---------------\nWith user scaling\n---------------\n");
208210
HighsInt suggested_objective_scale;
209211
HighsInt suggested_bound_scale;
210212
h.getObjectiveBoundScaling(suggested_objective_scale, suggested_bound_scale);
211-
if (dev_run) printf(
212-
"Highs::getObjectiveBoundScaling suggested cost / bound scale values of "
213-
"%d / %d\n",
214-
int(suggested_objective_scale), int(suggested_bound_scale));
213+
if (dev_run)
214+
printf(
215+
"Highs::getObjectiveBoundScaling suggested cost / bound scale values "
216+
"of "
217+
"%d / %d\n",
218+
int(suggested_objective_scale), int(suggested_bound_scale));
215219
const bool has_suggested_scaling =
216220
suggested_objective_scale || suggested_bound_scale;
217221
if (!has_suggested_scaling) {
@@ -296,31 +300,38 @@ TEST_CASE("ill-scaled-model", "[highs_user_scale]") {
296300
const double small_hessian = 1e-4;
297301
const double small_col_lower = 1e-8;
298302
if (lp_test) {
299-
if (dev_run) printf("\n================\nill-scaled-model: LP test\n================\n");
303+
if (dev_run)
304+
printf(
305+
"\n================\nill-scaled-model: LP test\n================\n");
300306
testLp(h, ok_cost, ok_col_lower, ok_bound);
301307
if (small_cost_test) {
302-
if (dev_run) printf(
303-
"\n================\nill-scaled-model: LP test - small costs and "
304-
"column LB\n================\n");
308+
if (dev_run)
309+
printf(
310+
"\n================\nill-scaled-model: LP test - small costs and "
311+
"column LB\n================\n");
305312
testLp(h, small_cost, small_col_lower, ok_bound);
306313
}
307314
}
308315

309316
if (mip_test) {
310-
if (dev_run) printf(
311-
"\n================\nill-scaled-model: MIP test\n================\n");
317+
if (dev_run)
318+
printf(
319+
"\n================\nill-scaled-model: MIP test\n================\n");
312320
testMip(h, ok_cost, ok_col_lower, ok_bound);
313-
321+
314322
if (small_cost_test) {
315-
if (dev_run) printf(
316-
"\n================\nill-scaled-model: MIP test - small costs and "
317-
"column LB\n================\n");
323+
if (dev_run)
324+
printf(
325+
"\n================\nill-scaled-model: MIP test - small costs and "
326+
"column LB\n================\n");
318327
testMip(h, small_cost, small_col_lower, ok_bound);
319328
}
320329
}
321330

322331
if (qp_test) {
323-
if (dev_run) printf("\n================\nill-scaled-model: QP test\n================\n");
332+
if (dev_run)
333+
printf(
334+
"\n================\nill-scaled-model: QP test\n================\n");
324335
testQp(h, ok_cost, ok_hessian, ok_col_lower, ok_bound);
325336
// QP solver can't handle small costs and Hessian
326337
}

highs/lp_data/Highs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ HighsStatus Highs::run() {
963963
// and user_bound_scale
964964
assessExcessiveObjectiveBoundScaling(this->options_.log_options, this->model_,
965965
user_scale_data);
966-
this->writeModel("");
966+
// this->writeModel("");
967967
HighsStatus status;
968968
if (!this->multi_linear_objective_.size()) {
969969
status = this->optimizeModel();

0 commit comments

Comments
 (0)