| 3159 | } |
| 3160 | |
| 3161 | HighsStatus Highs::userScaleSolution(HighsUserScaleData& data, |
| 3162 | bool update_kkt) { |
| 3163 | HighsStatus return_status = HighsStatus::kOk; |
| 3164 | if (!data.user_objective_scale && !data.user_bound_scale) |
| 3165 | return HighsStatus::kOk; |
| 3166 | double objective_scale_value = std::pow(2, data.user_objective_scale); |
| 3167 | double bound_scale_value = std::pow(2, data.user_bound_scale); |
| 3168 | const HighsLp& lp = this->model_.lp_; |
| 3169 | const bool has_integrality = lp.integrality_.size(); |
| 3170 | if (info_.primal_solution_status != kSolutionStatusNone) { |
| 3171 | if (data.user_bound_scale) { |
| 3172 | for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++) { |
| 3173 | if (has_integrality && |
| 3174 | lp.integrality_[iCol] != HighsVarType::kContinuous) |
| 3175 | continue; |
| 3176 | this->solution_.col_value[iCol] *= bound_scale_value; |
| 3177 | } |
| 3178 | for (HighsInt iRow = 0; iRow < lp.num_row_; iRow++) |
| 3179 | this->solution_.row_value[iRow] *= bound_scale_value; |
| 3180 | } |
| 3181 | } |
| 3182 | if (info_.dual_solution_status != kSolutionStatusNone) { |
| 3183 | if (data.user_objective_scale) { |
| 3184 | for (HighsInt iCol = 0; iCol < lp.num_col_; iCol++) |
| 3185 | this->solution_.col_dual[iCol] *= objective_scale_value; |
| 3186 | for (HighsInt iRow = 0; iRow < lp.num_row_; iRow++) |
| 3187 | this->solution_.row_dual[iRow] *= objective_scale_value; |
| 3188 | } |
| 3189 | } |
| 3190 | if (!update_kkt) return return_status; |
| 3191 | // In scaling the objective function value, have to consider the offset |
| 3192 | double objective_function_value = |
| 3193 | info_.objective_function_value - model_.lp_.offset_; |
| 3194 | objective_function_value *= (bound_scale_value * objective_scale_value); |
| 3195 | objective_function_value += model_.lp_.offset_; |
| 3196 | info_.objective_function_value = objective_function_value; |
| 3197 | getKktFailures(options_, model_, solution_, basis_, info_); |
| 3198 | return reportKktFailures(model_.lp_, options_, info_, |
| 3199 | "After removing user scaling") |
| 3200 | ? HighsStatus::kWarning |
| 3201 | : return_status; |
| 3202 | } |
| 3203 | |
| 3204 | void HighsIllConditioning::clear() { this->record.clear(); } |
| 3205 |
no test coverage detected