Skip to content

Commit 84d2381

Browse files
committed
Added simplex to names of generic-looking methods only used for simplex scaling
1 parent fb32f5b commit 84d2381

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

highs/lp_data/HighsOptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,8 +1394,8 @@ class HighsOptions : public HighsOptionsStruct {
13941394
record_int = new OptionRecordInt(
13951395
"allowed_cost_scale_factor",
13961396
"Largest power-of-two factor permitted when scaling the costs",
1397-
advanced, &allowed_cost_scale_factor, 0,
1398-
kDefaultAllowedMatrixPow2Scale, kMaxAllowedMatrixPow2Scale);
1397+
advanced, &allowed_cost_scale_factor, 0, kDefaultAllowedMatrixPow2Scale,
1398+
kMaxAllowedMatrixPow2Scale);
13991399
records.push_back(record_int);
14001400

14011401
record_int = new OptionRecordInt(

highs/simplex/HApp.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ inline HighsStatus solveLpSimplex(HighsLpSolverObject& solver_object) {
153153
// Consider scaling the LP - either with any existing scaling, or by
154154
// considering computing scaling factors if there are none - and
155155
// then move to EKK
156-
considerScaling(options, incumbent_lp);
156+
considerSimplexScaling(options, incumbent_lp);
157157
//
158158
const bool was_scaled = incumbent_lp.is_scaled_;
159159
if (!status.has_basis && !basis.valid && basis.useful) {
@@ -263,7 +263,7 @@ inline HighsStatus solveLpSimplex(HighsLpSolverObject& solver_object) {
263263
// Now that the incumbent LP is unscaled, to use the simplex NLA
264264
// requires scaling to be applied
265265
ekk_instance.setNlaPointersForLpAndScale(incumbent_lp);
266-
unscaleSolution(solution, incumbent_lp.scale_);
266+
simplexUnscaleSolution(solution, incumbent_lp.scale_);
267267
// Determine whether the unscaled LP has been solved
268268
getUnscaledInfeasibilities(options, incumbent_lp.scale_, ekk_basis,
269269
ekk_info, highs_info);

highs/simplex/HSimplex.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ HighsStatus formSimplexLpBasisAndFactor(HighsLpSolverObject& solver_object,
115115
lp.ensureColwise();
116116
const bool passed_scaled = lp.is_scaled_;
117117
// Consider scaling the LP
118-
if (!passed_scaled) considerScaling(options, lp);
118+
if (!passed_scaled) considerSimplexScaling(options, lp);
119119
const bool check_basis = basis.alien || (!basis.valid && basis.useful);
120120
if (check_basis) {
121121
// The basis needs to be checked for rank deficiency, and possibly
@@ -404,7 +404,7 @@ void setSolutionStatus(HighsInfo& highs_info) {
404404
}
405405
// SCALING
406406

407-
bool considerScaling(const HighsOptions& options, HighsLp& lp) {
407+
bool considerSimplexScaling(const HighsOptions& options, HighsLp& lp) {
408408
// Indicate whether new scaling has been determined in the return value.
409409
bool new_scaling = false;
410410
// Consider scaling the LP - either by finding new factors or by
@@ -432,7 +432,7 @@ bool considerScaling(const HighsOptions& options, HighsLp& lp) {
432432
kHighsAnalysisLevelModelData & options.highs_analysis_level;
433433
if (analyse_lp_data) analyseLp(options.log_options, lp);
434434
*/
435-
scaleLp(options, lp);
435+
simplexScaleLp(options, lp);
436436
// If the LP is now scaled, then the scaling is new
437437
new_scaling = lp.is_scaled_;
438438
/*
@@ -448,8 +448,8 @@ bool considerScaling(const HighsOptions& options, HighsLp& lp) {
448448
return new_scaling;
449449
}
450450

451-
void scaleLp(const HighsOptions& options, HighsLp& lp,
452-
const bool force_scaling) {
451+
void simplexScaleLp(const HighsOptions& options, HighsLp& lp,
452+
const bool force_scaling) {
453453
lp.clearScaling();
454454
HighsInt numCol = lp.num_col_;
455455
HighsInt numRow = lp.num_row_;
@@ -539,7 +539,7 @@ void scaleLp(const HighsOptions& options, HighsLp& lp,
539539
// Record the scaling strategy used
540540
lp.scale_.strategy = use_scale_strategy;
541541
// Possibly scale the costs
542-
// if (allow_cost_scaling) scaleSimplexCost(options, lp, scale.cost);
542+
// if (allow_cost_scaling) simplexScaleCost(options, lp);
543543

544544
// If matrix is unscaled, then LP is only scaled if there is a cost scaling
545545
// factor
@@ -1053,7 +1053,7 @@ HighsStatus applyScalingToLpRow(HighsLp& lp, const HighsInt row,
10531053
return HighsStatus::kOk;
10541054
}
10551055

1056-
void unscaleSolution(HighsSolution& solution, const HighsScale& scale) {
1056+
void simplexUnscaleSolution(HighsSolution& solution, const HighsScale& scale) {
10571057
assert(scale.has_scaling);
10581058
assert(solution.col_value.size() == static_cast<size_t>(scale.num_col));
10591059
assert(solution.col_dual.size() == static_cast<size_t>(scale.num_col));
@@ -1070,8 +1070,8 @@ void unscaleSolution(HighsSolution& solution, const HighsScale& scale) {
10701070
}
10711071
}
10721072

1073-
void scaleSimplexCost(const HighsOptions& options, HighsLp& lp,
1074-
double& cost_scale) {
1073+
void simplexScaleCost(const HighsOptions& options, HighsLp& lp) {
1074+
double& cost_scale = lp.scale_.cost;
10751075
// Scale the costs by no less than minAlwCostScale
10761076
double max_allowed_cost_scale = pow(2.0, options.allowed_cost_scale_factor);
10771077
double max_nonzero_cost = 0;
@@ -1111,7 +1111,8 @@ void scaleSimplexCost(const HighsOptions& options, HighsLp& lp,
11111111
max_nonzero_cost);
11121112
}
11131113

1114-
void unscaleSimplexCost(HighsLp& lp, double cost_scale) {
1114+
void simplexUnscaleCost(HighsLp& lp) {
1115+
double& cost_scale = lp.scale_.cost;
11151116
for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++)
11161117
lp.col_cost_[iCol] *= cost_scale;
11171118
}

highs/simplex/HSimplex.h

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ void getUnscaledInfeasibilities(const HighsOptions& options,
4242
void setSolutionStatus(HighsInfo& highs_info);
4343
// SCALE:
4444

45-
bool considerScaling(const HighsOptions& options, HighsLp& lp);
46-
void scaleLp(const HighsOptions& options, HighsLp& lp,
47-
const bool force_scaling = false);
45+
bool considerSimplexScaling(const HighsOptions& options, HighsLp& lp);
46+
void simplexScaleLp(const HighsOptions& options, HighsLp& lp,
47+
const bool force_scaling = false);
4848
bool equilibrationScaleMatrix(const HighsOptions& options, HighsLp& lp,
4949
const HighsInt use_scale_strategy);
5050
bool maxValueScaleMatrix(const HighsOptions& options, HighsLp& lp,
@@ -56,11 +56,10 @@ HighsStatus applyScalingToLpCol(HighsLp& lp, const HighsInt col,
5656
HighsStatus applyScalingToLpRow(HighsLp& lp, const HighsInt row,
5757
const double rowScale);
5858

59-
void unscaleSolution(HighsSolution& solution, const HighsScale& scale);
59+
void simplexUnscaleSolution(HighsSolution& solution, const HighsScale& scale);
6060

61-
void scaleSimplexCost(const HighsOptions& options, HighsLp& lp,
62-
double& cost_scale);
63-
void unscaleSimplexCost(HighsLp& lp, double cost_scale);
61+
void simplexScaleCost(const HighsOptions& options, HighsLp& lp);
62+
void simplexUnscaleCost(HighsLp& lp);
6463

6564
bool isBasisRightSize(const HighsLp& lp, const SimplexBasis& basis);
6665

0 commit comments

Comments
 (0)