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

Method changeColBoundsInterface

highs/lp_data/HighsInterface.cpp:958–1007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

956}
957
958HighsStatus Highs::changeColBoundsInterface(
959 HighsIndexCollection& index_collection, const double* col_lower,
960 const double* col_upper) {
961 HighsInt num_col_bounds = dataSize(index_collection);
962 // If a non-positive number of costs (may) need changing nothing needs to be
963 // done
964 if (num_col_bounds <= 0) return HighsStatus::kOk;
965 bool null_data = false;
966 null_data = doubleUserDataNotNull(options_.log_options, col_lower,
967 "column lower bounds") ||
968 null_data;
969 null_data = doubleUserDataNotNull(options_.log_options, col_upper,
970 "column upper bounds") ||
971 null_data;
972 if (null_data) return HighsStatus::kError;
973 // Take a copy of the cost that can be normalised
974 std::vector<double> local_colLower{col_lower, col_lower + num_col_bounds};
975 std::vector<double> local_colUpper{col_upper, col_upper + num_col_bounds};
976 // If changing the bounds for a set of columns, ensure that the
977 // set and data are in ascending order
978 if (index_collection.is_set_)
979 sortSetData(index_collection.set_num_entries_, index_collection.set_,
980 col_lower, col_upper, NULL, local_colLower.data(),
981 local_colUpper.data(), NULL);
982 HighsStatus return_status = HighsStatus::kOk;
983 return_status = interpretCallStatus(
984 options_.log_options,
985 assessBounds(options_, "col", 0, index_collection, local_colLower,
986 local_colUpper, options_.infinite_bound),
987 return_status, "assessBounds");
988 if (return_status == HighsStatus::kError) return return_status;
989 HighsLp& lp = model_.lp_;
990
991 changeLpColBounds(lp, index_collection, local_colLower, local_colUpper);
992 // Update HiGHS basis status and (any) simplex move status of
993 // nonbasic variables whose bounds have changed
994 setNonbasicStatusInterface(index_collection, true);
995 // Deduce the consequences of new col bounds
996 if (!this->basis_.useful && feasibleWrtBounds()) {
997 // Retain the solution if there's no basis, and the solution is
998 // feasible
999 invalidateModelStatusAndInfo();
1000 } else {
1001 // Invalidate the solution
1002 invalidateModelStatusSolutionAndInfo();
1003 }
1004 // Determine any implications for simplex data
1005 ekk_instance_.updateStatus(LpAction::kNewBounds);
1006 return HighsStatus::kOk;
1007}
1008
1009HighsStatus Highs::changeRowBoundsInterface(
1010 HighsIndexCollection& index_collection, const double* lower,

Callers

nothing calls this directly

Calls 8

dataSizeFunction · 0.85
doubleUserDataNotNullFunction · 0.85
sortSetDataFunction · 0.85
interpretCallStatusFunction · 0.85
assessBoundsFunction · 0.85
changeLpColBoundsFunction · 0.85
dataMethod · 0.80
updateStatusMethod · 0.80

Tested by

no test coverage detected