Skip to content

Commit 5837d03

Browse files
committed
Renamed user_cost_scale to user_objective_scale
1 parent 5d2b67e commit 5837d03

File tree

8 files changed

+27
-24
lines changed

8 files changed

+27
-24
lines changed

check/TestUserScale.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ TEST_CASE("user-scale-after-run", "[highs_user_scale]") {
4646

4747
HighsInt user_objective_scale = 4;
4848
double user_objective_scale_value = std::pow(2, user_objective_scale);
49-
REQUIRE(highs.setOptionValue("user_cost_scale", user_objective_scale) ==
50-
HighsStatus::kOk);
49+
REQUIRE(highs.setOptionValue("user_objective_scale",
50+
user_objective_scale) == HighsStatus::kOk);
5151

5252
highs.run();
5353

@@ -57,7 +57,8 @@ TEST_CASE("user-scale-after-run", "[highs_user_scale]") {
5757

5858
model = mip_model;
5959
REQUIRE(highs.setOptionValue("user_bound_scale", 0) == HighsStatus::kOk);
60-
REQUIRE(highs.setOptionValue("user_cost_scale", 0) == HighsStatus::kOk);
60+
REQUIRE(highs.setOptionValue("user_objective_scale", 0) ==
61+
HighsStatus::kOk);
6162
}
6263

6364
highs.resetGlobalScheduler(true);
@@ -96,14 +97,15 @@ TEST_CASE("user-small-cost-scale", "[highs_user_scale]") {
9697
REQUIRE(solution.col_value[0] == 40);
9798
REQUIRE(solution.col_value[1] == 20);
9899

99-
REQUIRE(highs.setOptionValue("user_cost_scale", -30) == HighsStatus::kOk);
100+
REQUIRE(highs.setOptionValue("user_objective_scale", -30) ==
101+
HighsStatus::kOk);
100102
highs.clearSolver();
101103
highs.run();
102104
if (dev_run) highs.writeSolution("", 1);
103105
REQUIRE(solution.col_value[0] == 0);
104106
REQUIRE(solution.col_value[1] == 0);
105107

106-
REQUIRE(highs.setOptionValue("user_cost_scale", 0) == HighsStatus::kOk);
108+
REQUIRE(highs.setOptionValue("user_objective_scale", 0) == HighsStatus::kOk);
107109

108110
highs.run();
109111
REQUIRE(solution.col_value[0] == 40);
@@ -114,7 +116,8 @@ TEST_CASE("user-small-cost-scale", "[highs_user_scale]") {
114116
std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps";
115117
highs.readModel(filename);
116118

117-
REQUIRE(highs.setOptionValue("user_cost_scale", -30) == HighsStatus::kOk);
119+
REQUIRE(highs.setOptionValue("user_objective_scale", -30) ==
120+
HighsStatus::kOk);
118121

119122
highs.run();
120123

@@ -198,7 +201,7 @@ HighsHessian hessian(const double value) {
198201
}
199202

200203
void testUserScale(Highs& h) {
201-
h.setOptionValue("user_cost_scale", 0);
204+
h.setOptionValue("user_objective_scale", 0);
202205
h.setOptionValue("user_bound_scale", 0);
203206
if (dev_run)
204207
printf("\n---------------\nWithout user scaling\n---------------\n");
@@ -224,7 +227,7 @@ void testUserScale(Highs& h) {
224227
suggested_bound_scale = 1;
225228
}
226229

227-
h.setOptionValue("user_cost_scale", suggested_objective_scale);
230+
h.setOptionValue("user_objective_scale", suggested_objective_scale);
228231
h.setOptionValue("user_bound_scale", suggested_bound_scale);
229232
h.clearSolver();
230233
h.run();

highs/highs_bindings.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ PYBIND11_MODULE(_core, m, py::mod_gil_not_used()) {
12211221
.def_readwrite("objective_target", &HighsOptions::objective_target)
12221222
.def_readwrite("threads", &HighsOptions::threads)
12231223
.def_readwrite("user_bound_scale", &HighsOptions::user_bound_scale)
1224-
.def_readwrite("user_cost_scale", &HighsOptions::user_cost_scale)
1224+
.def_readwrite("user_objective_scale", &HighsOptions::user_objective_scale)
12251225
.def_readwrite("highs_debug_level", &HighsOptions::highs_debug_level)
12261226
.def_readwrite("highs_analysis_level",
12271227
&HighsOptions::highs_analysis_level)

highs/interfaces/highs_c_api.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2457,13 +2457,13 @@ HighsInt Highs_getIis(void* highs, HighsInt* iis_num_col, HighsInt* iis_num_row,
24572457
HighsInt* col_bound, HighsInt* row_bound,
24582458
HighsInt* col_status, HighsInt* row_status);
24592459
/**
2460-
* Identify suggested values of the options user_cost_scale and
2460+
* Identify suggested values of the options user_objective_scale and
24612461
* user_bound_scale to address extremely large or small objective
24622462
* coefficients and bound values
24632463
*
24642464
* @param highs A pointer to the Highs instance.
24652465
* @param HighsInt* suggested_objective_scale The suggested value of
2466-
* user_cost_scale
2466+
* user_objective_scale
24672467
* @param HighsInt* suggested_bound_scale The suggested value of
24682468
* user_bound_scale
24692469
*

highs/lp_data/Highs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -954,7 +954,7 @@ HighsStatus Highs::run() {
954954
// Indicate that the scaling has been applied
955955
user_scale_data.applied = true;
956956
// Zero the user scale values to prevent further scaling
957-
this->options_.user_cost_scale = 0;
957+
this->options_.user_objective_scale = 0;
958958
this->options_.user_bound_scale = 0;
959959
}
960960

@@ -1001,7 +1001,7 @@ HighsStatus Highs::run() {
10011001
unscale_status = this->userScaleSolution(user_scale_data, update_kkt);
10021002
// Restore the user scale values, remembering that they've been
10031003
// negated to undo user scaling
1004-
this->options_.user_cost_scale = -user_scale_data.user_objective_scale;
1004+
this->options_.user_objective_scale = -user_scale_data.user_objective_scale;
10051005
this->options_.user_bound_scale = -user_scale_data.user_bound_scale;
10061006
// Indicate that the scaling has not been applied
10071007
user_scale_data.applied = false;

highs/lp_data/HighsLpUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3660,9 +3660,9 @@ void getSubVectorsTranspose(const HighsIndexCollection& index_collection,
36603660

36613661
void initialiseUserScaleData(const HighsOptions& options,
36623662
HighsUserScaleData& user_scale_data) {
3663-
user_scale_data.initialise(options.user_cost_scale, options.user_bound_scale,
3664-
options.infinite_cost, options.infinite_bound,
3665-
options.small_matrix_value,
3663+
user_scale_data.initialise(options.user_objective_scale,
3664+
options.user_bound_scale, options.infinite_cost,
3665+
options.infinite_bound, options.small_matrix_value,
36663666
options.large_matrix_value);
36673667
}
36683668

highs/lp_data/HighsOptions.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,7 @@ struct HighsOptionsStruct {
316316
double objective_bound;
317317
double objective_target;
318318
HighsInt threads;
319-
// V2.0: Should be user_objective_scale to accommodate Hessian
320-
HighsInt user_cost_scale;
319+
HighsInt user_objective_scale;
321320
HighsInt user_bound_scale;
322321
HighsInt highs_debug_level;
323322
HighsInt highs_analysis_level;
@@ -490,7 +489,7 @@ struct HighsOptionsStruct {
490489
objective_bound(0.0),
491490
objective_target(0.0),
492491
threads(0),
493-
user_cost_scale(0),
492+
user_objective_scale(0),
494493
user_bound_scale(0),
495494
highs_debug_level(0),
496495
highs_analysis_level(0),
@@ -800,8 +799,9 @@ class HighsOptions : public HighsOptionsStruct {
800799
records.push_back(record_int);
801800

802801
record_int = new OptionRecordInt(
803-
"user_cost_scale", "Exponent of power-of-two cost scaling for model",
804-
advanced, &user_cost_scale, -kHighsIInf, 0, kHighsIInf);
802+
"user_objective_scale",
803+
"Exponent of power-of-two objective scaling for model", advanced,
804+
&user_objective_scale, -kHighsIInf, 0, kHighsIInf);
805805
records.push_back(record_int);
806806

807807
record_int = new OptionRecordInt("highs_debug_level",

highs/lp_data/HighsSolve.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ void assessExcessiveObjectiveBoundScaling(const HighsLogOptions log_options,
363363
std::stringstream message;
364364
if (user_cost_or_bound_scale) {
365365
if (user_scale_data.user_objective_scale)
366-
message << highsFormatToString(" user_cost_scale option value of %d",
366+
message << highsFormatToString(" user_objective_scale option value of %d",
367367
user_scale_data.user_objective_scale);
368368
if (user_scale_data.user_bound_scale) {
369369
if (user_scale_data.user_objective_scale) message << " and";
@@ -622,7 +622,7 @@ void assessExcessiveObjectiveBoundScaling(const HighsLogOptions log_options,
622622
message << ", or";
623623
}
624624
message << highsFormatToString(
625-
" setting the user_cost_scale option to %d",
625+
" setting the user_objective_scale option to %d",
626626
int(user_scale_data.suggested_user_objective_scale));
627627
}
628628
if (order_of_magnitude_message || dl_user_objective_scale)

tests/test_highspy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2272,7 +2272,7 @@ def test_get_user_objective_bound_scale(self):
22722272
[status, dual_objective_value] = h.getDualObjectiveValue()
22732273
self.assertAlmostEqual(unscaled_objective_value, dual_objective_value)
22742274
[status, suggested_objective_scale, suggested_bound_scale] = h.getObjectiveBoundScaling();
2275-
h.setOptionValue("user_cost_scale", suggested_objective_scale)
2275+
h.setOptionValue("user_objective_scale", suggested_objective_scale)
22762276
h.setOptionValue("user_bound_scale", suggested_bound_scale)
22772277
h.run()
22782278
scaled_objective_value = h.getObjectiveValue()

0 commit comments

Comments
 (0)