@@ -985,51 +985,21 @@ HighsStatus Highs::changeCostsInterface(HighsIndexCollection& index_collection,
985985 return HighsStatus::kOk ;
986986}
987987
988- bool Highs::feasibleWrtBounds (const bool columns,
989- const HighsIndexCollection& index_collection,
990- const std::vector<double >& lower,
991- const std::vector<double >& upper) const {
988+ bool Highs::feasibleWrtBounds (const bool columns) const {
992989 if (this ->info_ .primal_solution_status != kSolutionStatusFeasible )
993990 return false ;
994991 const HighsLp& lp = model_.lp_ ;
995992 const double primal_feasibility_tolerance =
996993 this ->options_ .primal_feasibility_tolerance ;
997- assert (ok (index_collection));
998- HighsInt from_k;
999- HighsInt to_k;
1000- limits (index_collection, from_k, to_k);
1001- if (from_k > to_k) return true ;
1002-
1003- const bool & interval = index_collection.is_interval_ ;
1004- const bool & mask = index_collection.is_mask_ ;
1005- const vector<HighsInt>& ix_set = index_collection.set_ ;
1006- const vector<HighsInt>& ix_mask = index_collection.mask_ ;
1007-
1008994 std::vector<double > value = columns ?
1009995 this ->solution_ .col_value :
1010996 this ->solution_ .row_value ;
1011-
1012- HighsInt lp_ix;
1013- HighsInt usr_ix = -1 ;
1014- HighsInt ix_dim = value.size ();
1015- // Surely this is checked elsewhere
1016- assert (0 <= from_k && to_k < ix_dim);
1017- assert (from_k <= to_k);
1018- for (HighsInt k = from_k; k < to_k + 1 ; k++) {
1019- if (interval || mask) {
1020- lp_ix = k;
1021- } else {
1022- lp_ix = ix_set[k];
1023- }
1024- HighsInt ix = lp_ix;
1025- if (interval) {
1026- usr_ix++;
1027- } else {
1028- usr_ix = k;
1029- }
1030- if (mask && !ix_mask[ix]) continue ;
1031- if (value[ix] < lower[usr_ix] - primal_feasibility_tolerance) return false ;
1032- if (value[ix] > upper[usr_ix] + primal_feasibility_tolerance) return false ;
997+ std::vector<double > lower = columns ? lp.col_lower_ : lp.row_lower_ ;
998+ std::vector<double > upper = columns ? lp.col_upper_ : lp.row_upper_ ;
999+ HighsInt dim = columns ? lp.num_col_ : lp.num_row_ ;
1000+ for (HighsInt iX = 0 ; iX < dim; iX++) {
1001+ if (value[iX] < lower[iX] - primal_feasibility_tolerance) return false ;
1002+ if (value[iX] > upper[iX] + primal_feasibility_tolerance) return false ;
10331003 }
10341004 return true ;
10351005}
@@ -1086,19 +1056,14 @@ HighsStatus Highs::changeColBoundsInterface(
10861056 // nonbasic variables whose bounds have changed
10871057 setNonbasicStatusInterface (index_collection, true );
10881058 // Deduce the consequences of new col bounds
1089- if (!this ->basis_ .useful ) {
1090- const bool columns = true ;
1091- const bool feasible = feasibleWrtBounds (columns, index_collection,
1092- local_colLower, local_colUpper);
1093- // highsLogUser(options_.log_options, HighsLogType::kInfo,
1094- printf (
1095- " feasibleWrtBounds is %s\n " , feasible ? " True" : " False" );
1096- if (feasible) {
1097- feasibleWrtBounds (columns, index_collection,
1098- local_colLower, local_colUpper);
1099- }
1059+ if (!this ->basis_ .useful && feasibleWrtBounds ()) {
1060+ // Retain the solution if there's no basis, and the solution is
1061+ // feasible
1062+ invalidateModelStatusAndInfo ();
1063+ } else {
1064+ // Invalidate the solution
1065+ invalidateModelStatusSolutionAndInfo ();
11001066 }
1101- invalidateModelStatusSolutionAndInfo ();
11021067 // Determine any implications for simplex data
11031068 ekk_instance_.updateStatus (LpAction::kNewBounds );
11041069 return HighsStatus::kOk ;
0 commit comments