| 245 | } |
| 246 | |
| 247 | void 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 | |
| 274 | void HighsLp::unapplyScale() { |
| 275 | // Ensure that any scaling is not applied |
no outgoing calls
no test coverage detected