Skip to content

Commit 0a8f562

Browse files
committed
Removed unnecessare num_col and num_row from HighsScale
1 parent df03195 commit 0a8f562

File tree

9 files changed

+3
-50
lines changed

9 files changed

+3
-50
lines changed

check/TestCAPI.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -734,8 +734,8 @@ void fullApiOptions() {
734734
&default_simplex_scale_strategy);
735735
assert(return_status == kHighsStatusOk);
736736
assert(check_simplex_scale_strategy == simplex_scale_strategy);
737-
assert(min_simplex_scale_strategy == 0);
738-
assert(max_simplex_scale_strategy == 4);
737+
assert(min_simplex_scale_strategy == -1);
738+
assert(max_simplex_scale_strategy == 5);
739739
assert(default_simplex_scale_strategy == 2);
740740

741741
// There are some functions to check what type of option value you should

highs/lp_data/HStruct.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ struct HighsBasis {
9595
struct HighsScale {
9696
HighsInt strategy;
9797
bool has_scaling;
98-
HighsInt num_col;
99-
HighsInt num_row;
10098
double cost;
10199
std::vector<double> col;
102100
std::vector<double> row;

highs/lp_data/Highs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ HighsStatus Highs::passModel(HighsModel model) {
343343
// scale factors to be passed
344344
assert(!lp.is_scaled_);
345345
assert(!lp.is_moved_);
346-
lp.resetScale();
346+
lp.clearScale();
347347
// Check that the LP array dimensions are valid
348348
if (!lpDimensionsOk("passModel", lp, options_.log_options))
349349
return HighsStatus::kError;

highs/lp_data/HighsInterface.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,6 @@ HighsStatus Highs::addColsInterface(
487487
scale.col.resize(newNumCol);
488488
for (HighsInt iCol = 0; iCol < ext_num_new_col; iCol++)
489489
scale.col[lp.num_col_ + iCol] = 1.0;
490-
scale.num_col = newNumCol;
491490
// Apply the existing row scaling to the new columns
492491
local_a_matrix.applyRowScale(scale);
493492
// Consider applying column scaling to the new columns.
@@ -617,7 +616,6 @@ HighsStatus Highs::addRowsInterface(HighsInt ext_num_new_row,
617616
scale.row.resize(newNumRow);
618617
for (HighsInt iRow = 0; iRow < ext_num_new_row; iRow++)
619618
scale.row[lp.num_row_ + iRow] = 1.0;
620-
scale.num_row = newNumRow;
621619
// Apply the existing column scaling to the new rows
622620
local_ar_matrix.applyColScale(scale);
623621
// Consider applying row scaling to the new rows.
@@ -737,7 +735,6 @@ void Highs::deleteColsInterface(HighsIndexCollection& index_collection) {
737735
if (lp.scale_.has_scaling) {
738736
deleteScale(lp.scale_.col, index_collection);
739737
lp.scale_.col.resize(lp.num_col_);
740-
lp.scale_.num_col = lp.num_col_;
741738
}
742739
// Deduce the consequences of deleting columns
743740
invalidateModelStatusSolutionAndInfo();
@@ -793,7 +790,6 @@ void Highs::deleteRowsInterface(HighsIndexCollection& index_collection) {
793790
if (lp.scale_.has_scaling) {
794791
deleteScale(lp.scale_.row, index_collection);
795792
lp.scale_.row.resize(lp.num_row_);
796-
lp.scale_.num_row = lp.num_row_;
797793
}
798794
// Deduce the consequences of deleting rows
799795
invalidateModelStatusSolutionAndInfo();

highs/lp_data/HighsLp.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,6 @@ bool HighsLp::equalScaling(const HighsLp& lp) const {
110110
bool equal = true;
111111
equal = this->scale_.strategy == lp.scale_.strategy && equal;
112112
equal = this->scale_.has_scaling == lp.scale_.has_scaling && equal;
113-
equal = this->scale_.num_col == lp.scale_.num_col && equal;
114-
equal = this->scale_.num_row == lp.scale_.num_row && equal;
115113
equal = this->scale_.cost == lp.scale_.cost && equal;
116114
equal = this->scale_.col == lp.scale_.col && equal;
117115
equal = this->scale_.row == lp.scale_.row && equal;
@@ -143,14 +141,6 @@ void HighsLp::setMatrixDimensions() {
143141
this->a_matrix_.num_row_ = this->num_row_;
144142
}
145143

146-
void HighsLp::resetScale() {
147-
// Should allow user-supplied scale to be retained
148-
// const bool dimensions_ok =
149-
// this->scale_.num_col_ == this->num_col_ &&
150-
// this->scale_.num_row_ == this->num_row_;
151-
this->clearScale();
152-
}
153-
154144
void HighsLp::setFormat(const MatrixFormat format) {
155145
this->a_matrix_.setFormat(format);
156146
}
@@ -231,8 +221,6 @@ void HighsLp::clear() {
231221
void HighsLp::clearScale() {
232222
this->scale_.strategy = kSimplexScaleStrategyOff;
233223
this->scale_.has_scaling = false;
234-
this->scale_.num_col = 0;
235-
this->scale_.num_row = 0;
236224
this->scale_.cost = 0;
237225
this->scale_.col.clear();
238226
this->scale_.row.clear();

highs/lp_data/HighsLp.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class HighsLp {
7575
void ensureColwise() { this->a_matrix_.ensureColwise(); };
7676
void ensureRowwise() { this->a_matrix_.ensureRowwise(); };
7777
void clearScaling();
78-
void resetScale();
7978
void clearScale();
8079
void applyScale();
8180
void unapplyScale();

highs/lp_data/HighsLpUtils.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -222,39 +222,19 @@ bool lpDimensionsOk(std::string message, const HighsLp& lp,
222222
bool legal_scale_col_size = false;
223223
if (lp.scale_.has_scaling) {
224224
if (scale_col_size) {
225-
legal_scale_num_col = lp.scale_.num_col == num_col;
226225
legal_scale_col_size = scale_col_size >= num_col;
227226
} else {
228-
legal_scale_num_col = lp.scale_.num_col == 0;
229227
legal_scale_col_size = true; // Since scale_col_size = 0
230228
}
231229
if (scale_row_size) {
232-
legal_scale_num_row = lp.scale_.num_row == num_row;
233230
legal_scale_row_size = scale_row_size >= num_row;
234231
} else {
235-
legal_scale_num_row = lp.scale_.num_row == 0;
236232
legal_scale_row_size = true; // Since scale_row_size = 0
237233
}
238234
} else {
239-
legal_scale_num_col = lp.scale_.num_col == 0;
240-
legal_scale_num_row = lp.scale_.num_row == 0;
241235
legal_scale_row_size = scale_row_size == 0;
242236
legal_scale_col_size = scale_col_size == 0;
243237
}
244-
if (!legal_scale_num_col)
245-
highsLogUser(
246-
log_options, HighsLogType::kError,
247-
"LP dimension validation (%s) fails on scale_.num_col = %d != %d\n",
248-
message.c_str(), (int)lp.scale_.num_col,
249-
(int)(lp.scale_.has_scaling ? num_col : 0));
250-
ok = legal_scale_num_col && ok;
251-
if (!legal_scale_num_row)
252-
highsLogUser(
253-
log_options, HighsLogType::kError,
254-
"LP dimension validation (%s) fails on scale_.num_row = %d != %d\n",
255-
message.c_str(), (int)lp.scale_.num_row,
256-
(int)(lp.scale_.has_scaling ? num_row : 0));
257-
ok = legal_scale_num_row && ok;
258238
if (!legal_scale_col_size)
259239
highsLogUser(
260240
log_options, HighsLogType::kError,

highs/simplex/HEkk.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -718,8 +718,6 @@ HighsStatus HEkk::dualize() {
718718
std::vector<double> temp_scale = lp_.scale_.row;
719719
lp_.scale_.row = lp_.scale_.col;
720720
lp_.scale_.col = temp_scale;
721-
lp_.scale_.num_col = dual_num_col;
722-
lp_.scale_.num_row = dual_num_row;
723721
}
724722
}
725723
// Change optimization sense
@@ -917,8 +915,6 @@ HighsStatus HEkk::undualize() {
917915
lp_.scale_.col = temp_scale;
918916
lp_.scale_.col.resize(original_num_col_);
919917
lp_.scale_.row.resize(original_num_row_);
920-
lp_.scale_.num_col = original_num_col_;
921-
lp_.scale_.num_row = original_num_row_;
922918
}
923919
}
924920
// Change optimization sense

highs/simplex/HSimplex.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,8 +551,6 @@ void simplexScaleLp(const HighsOptions& options, HighsLp& lp,
551551
rowUpper[iRow] *= scale.row[iRow];
552552
}
553553
scale.has_scaling = true;
554-
scale.num_col = numCol;
555-
scale.num_row = numRow;
556554
scale.cost = 1.0;
557555
lp.is_scaled_ = true;
558556
}
@@ -1128,8 +1126,6 @@ void simplexUnscaleSolution(HighsSolution& solution, const HighsScale& scale) {
11281126
HighsInt num_col = solution.col_value.size();
11291127
HighsInt num_row = solution.row_value.size();
11301128
if (has_matrix_scaling) {
1131-
assert(scale.num_col == num_col);
1132-
assert(scale.num_row == num_row);
11331129
assert(solution.col_value.size() == scale.col.size());
11341130
assert(solution.row_value.size() == scale.row.size());
11351131
assert(solution.col_dual.size() == scale.col.size());

0 commit comments

Comments
 (0)