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

Method changeCoefficientInterface

highs/lp_data/HighsInterface.cpp:1061–1093  ·  view source on GitHub ↗

Change a single coefficient in the matrix

Source from the content-addressed store, hash-verified

1059
1060// Change a single coefficient in the matrix
1061void Highs::changeCoefficientInterface(const HighsInt ext_row,
1062 const HighsInt ext_col,
1063 const double ext_new_value) {
1064 HighsLp& lp = model_.lp_;
1065 // Ensure that the LP is column-wise
1066 lp.ensureColwise();
1067 assert(0 <= ext_row && ext_row < lp.num_row_);
1068 assert(0 <= ext_col && ext_col < lp.num_col_);
1069 const bool zero_new_value =
1070 std::fabs(ext_new_value) <= options_.small_matrix_value;
1071 changeLpMatrixCoefficient(lp, ext_row, ext_col, ext_new_value,
1072 zero_new_value);
1073 // Deduce the consequences of a changed element
1074 //
1075 // ToDo: Can do something more intelligent if element is in nonbasic
1076 // column
1077 //
1078 const bool basic_column =
1079 this->basis_.col_status[ext_col] == HighsBasisStatus::kBasic;
1080 //
1081 // For now, treat it as if it's a new row
1082 invalidateModelStatusSolutionAndInfo();
1083
1084 if (basic_column) {
1085 // Basis is retained, but is has to be viewed as alien, since the
1086 // basis matrix has changed
1087 this->basis_.was_alien = true;
1088 this->basis_.alien = true;
1089 }
1090
1091 // Determine any implications for simplex data
1092 ekk_instance_.updateStatus(LpAction::kNewRows);
1093}
1094
1095HighsStatus Highs::scaleColInterface(const HighsInt col,
1096 const double scale_value) {

Callers

nothing calls this directly

Calls 3

updateStatusMethod · 0.80
ensureColwiseMethod · 0.45

Tested by

no test coverage detected