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

Method scaleColInterface

highs/lp_data/HighsInterface.cpp:1095–1138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1093}
1094
1095HighsStatus Highs::scaleColInterface(const HighsInt col,
1096 const double scale_value) {
1097 HighsStatus return_status = HighsStatus::kOk;
1098 HighsLp& lp = model_.lp_;
1099 HighsBasis& basis = basis_;
1100 HighsSimplexStatus& simplex_status = ekk_instance_.status_;
1101
1102 // Ensure that the LP is column-wise
1103 lp.ensureColwise();
1104 if (col < 0) return HighsStatus::kError;
1105 if (col >= lp.num_col_) return HighsStatus::kError;
1106 if (!scale_value) return HighsStatus::kError;
1107
1108 return_status = interpretCallStatus(options_.log_options,
1109 applyScalingToLpCol(lp, col, scale_value),
1110 return_status, "applyScalingToLpCol");
1111 if (return_status == HighsStatus::kError) return return_status;
1112
1113 if (scale_value < 0 && basis.valid) {
1114 // Negative, so flip any nonbasic status
1115 if (basis.col_status[col] == HighsBasisStatus::kLower) {
1116 basis.col_status[col] = HighsBasisStatus::kUpper;
1117 } else if (basis.col_status[col] == HighsBasisStatus::kUpper) {
1118 basis.col_status[col] = HighsBasisStatus::kLower;
1119 }
1120 }
1121 if (simplex_status.initialised_for_solve) {
1122 SimplexBasis& simplex_basis = ekk_instance_.basis_;
1123 if (scale_value < 0 && simplex_status.has_basis) {
1124 // Negative, so flip any nonbasic status
1125 if (simplex_basis.nonbasicMove_[col] == kNonbasicMoveUp) {
1126 simplex_basis.nonbasicMove_[col] = kNonbasicMoveDn;
1127 } else if (simplex_basis.nonbasicMove_[col] == kNonbasicMoveDn) {
1128 simplex_basis.nonbasicMove_[col] = kNonbasicMoveUp;
1129 }
1130 }
1131 }
1132 // Deduce the consequences of a scaled column
1133 invalidateModelStatusSolutionAndInfo();
1134
1135 // Determine any implications for simplex data
1136 ekk_instance_.updateStatus(LpAction::kScaledCol);
1137 return HighsStatus::kOk;
1138}
1139
1140HighsStatus Highs::scaleRowInterface(const HighsInt row,
1141 const double scale_value) {

Callers

nothing calls this directly

Calls 4

interpretCallStatusFunction · 0.85
applyScalingToLpColFunction · 0.85
updateStatusMethod · 0.80
ensureColwiseMethod · 0.45

Tested by

no test coverage detected