@@ -2261,16 +2261,17 @@ HighsStatus Highs::setSolution(const HighsSolution& solution) {
22612261HighsStatus Highs::setSolution (const HighsInt num_entries,
22622262 const HighsInt* index, const double * value) {
22632263 HighsStatus return_status = HighsStatus::kOk ;
2264+ if (model_.lp_ .num_col_ == 0 ) return return_status;
22642265 // Warn about duplicates in index
22652266 HighsInt num_duplicates = 0 ;
22662267 std::vector<bool > is_set;
22672268 is_set.assign (model_.lp_ .num_col_ , false );
22682269 for (HighsInt iX = 0 ; iX < num_entries; iX++) {
22692270 HighsInt iCol = index[iX];
2270- if (iCol < 0 || iCol > model_.lp_ .num_col_ ) {
2271+ if (iCol < 0 || iCol >= model_.lp_ .num_col_ ) {
22712272 highsLogUser (options_.log_options , HighsLogType::kError ,
22722273 " setSolution: User solution index %d has value %d out of "
2273- " range [0, %d)" ,
2274+ " range [0, %d)\n " ,
22742275 int (iX), int (iCol), int (model_.lp_ .num_col_ ));
22752276 return HighsStatus::kError ;
22762277 } else if (value[iX] < model_.lp_ .col_lower_ [iCol] -
@@ -2280,7 +2281,7 @@ HighsStatus Highs::setSolution(const HighsInt num_entries,
22802281 value[iX]) {
22812282 highsLogUser (options_.log_options , HighsLogType::kError ,
22822283 " setSolution: User solution value %d of %g is infeasible "
2283- " for bounds [%g, %g]" ,
2284+ " for bounds [%g, %g]\n " ,
22842285 int (iX), value[iX], model_.lp_ .col_lower_ [iCol],
22852286 model_.lp_ .col_upper_ [iCol]);
22862287 return HighsStatus::kError ;
0 commit comments