MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / applyScale

Method applyScale

highs/lp_data/HighsLp.cpp:247–272  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247void HighsLp::applyScale() {
248 // Ensure that any scaling is applied
249 const HighsScale& scale = this->scale_;
250 if (this->is_scaled_) {
251 // Already scaled - so check that there is scaling and return
252 assert(scale.has_scaling);
253 return;
254 }
255 // No scaling currently applied
256 this->is_scaled_ = false;
257 if (scale.has_scaling) {
258 // Apply the scaling to the bounds, costs and matrix, and record
259 // that it has been applied
260 for (HighsInt iCol = 0; iCol < this->num_col_; iCol++) {
261 this->col_lower_[iCol] /= scale.col[iCol];
262 this->col_upper_[iCol] /= scale.col[iCol];
263 this->col_cost_[iCol] *= scale.col[iCol];
264 }
265 for (HighsInt iRow = 0; iRow < this->num_row_; iRow++) {
266 this->row_lower_[iRow] *= scale.row[iRow];
267 this->row_upper_[iRow] *= scale.row[iRow];
268 }
269 this->a_matrix_.applyScale(scale);
270 this->is_scaled_ = true;
271 }
272}
273
274void HighsLp::unapplyScale() {
275 // Ensure that any scaling is not applied

Callers 3

debugCheckDataMethod · 0.45
considerScalingFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected