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

Method restoreInfCost

highs/lp_data/HighsInterface.cpp:3053–3091  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3051}
3052
3053void Highs::restoreInfCost(HighsStatus& return_status) {
3054 HighsLp& lp = this->model_.lp_;
3055 HighsBasis& basis = this->basis_;
3056 HighsLpMods& mods = lp.mods_;
3057 HighsInt num_inf_cost = mods.save_inf_cost_variable_index.size();
3058 if (num_inf_cost <= 0) return;
3059 assert(num_inf_cost);
3060 for (HighsInt ix = 0; ix < num_inf_cost; ix++) {
3061 HighsInt iCol = mods.save_inf_cost_variable_index[ix];
3062 double cost = mods.save_inf_cost_variable_cost[ix];
3063 double lower = mods.save_inf_cost_variable_lower[ix];
3064 double upper = mods.save_inf_cost_variable_upper[ix];
3065 double value = solution_.value_valid ? solution_.col_value[iCol] : 0;
3066 if (basis.valid) {
3067 assert(basis.col_status[iCol] != HighsBasisStatus::kBasic);
3068 if (lp.col_lower_[iCol] == lower) {
3069 basis.col_status[iCol] = HighsBasisStatus::kLower;
3070 } else {
3071 basis.col_status[iCol] = HighsBasisStatus::kUpper;
3072 }
3073 }
3074 assert(lp.col_cost_[iCol] == 0);
3075 if (value) this->info_.objective_function_value += value * cost;
3076 lp.col_cost_[iCol] = cost;
3077 lp.col_lower_[iCol] = lower;
3078 lp.col_upper_[iCol] = upper;
3079 }
3080 // Infinite costs have been reintroduced, so reset to true the flag
3081 // that was set false in Highs::handleInfCost() (See #1446)
3082 lp.has_infinite_cost_ = true;
3083
3084 if (this->model_status_ == HighsModelStatus::kInfeasible) {
3085 // Model is infeasible with the infinite cost variables fixed at
3086 // appropriate values, so model status cannot be determined
3087 this->model_status_ = HighsModelStatus::kUnknown;
3088 setHighsModelStatusAndClearSolutionAndBasis(this->model_status_);
3089 return_status = highsStatusFromHighsModelStatus(model_status_);
3090 }
3091}
3092
3093HighsStatus Highs::userScale(HighsUserScaleData& data) {
3094 if (!options_.user_objective_scale && !options_.user_bound_scale)

Callers 1

Calls 2

sizeMethod · 0.45

Tested by

no test coverage detected