@@ -382,7 +382,7 @@ TEST_CASE("writeLocalModel", "[highs_filereader]") {
382382 h.setOptionValue (" output_flag" , dev_run);
383383 HighsModel model;
384384 HighsLp& lp = model.lp_ ;
385- ;
385+
386386 lp.num_col_ = 2 ;
387387 lp.num_row_ = 3 ;
388388 lp.col_cost_ = {8 , 10 };
@@ -403,7 +403,7 @@ TEST_CASE("writeLocalModel", "[highs_filereader]") {
403403 // Model has no dimensions for a_matrix_, but these are set in
404404 // writeLocalModel.
405405 if (dev_run) printf (" \n Model with no column or row names\n " );
406- REQUIRE (h.writeLocalModel (model, write_model_file) == HighsStatus::kWarning );
406+ REQUIRE (h.writeLocalModel (model, write_model_file) == HighsStatus::kOk );
407407 lp.col_names_ = {" C0" , " C1" };
408408 lp.row_names_ = {" R0" , " R1" , " R2" };
409409
@@ -477,3 +477,44 @@ TEST_CASE("mps-silly-names", "[highs_filereader]") {
477477 HighsStatus return_status = h.readModel (model_file);
478478 REQUIRE (return_status == HighsStatus::kOk );
479479}
480+
481+ TEST_CASE (" handle-blank-space-names" , " [highs_filereader]" ) {
482+ HighsLp lp;
483+ lp.num_col_ = 2 ;
484+ lp.num_row_ = 2 ;
485+ lp.col_cost_ = {8 , 10 };
486+ lp.col_lower_ = {0 , 0 };
487+ lp.col_upper_ = {inf, inf};
488+ lp.row_lower_ = {7 , 12 };
489+ lp.row_upper_ = {inf, inf};
490+ lp.a_matrix_ .start_ = {0 , 2 , 4 };
491+ lp.a_matrix_ .index_ = {0 , 1 , 0 , 1 };
492+ lp.a_matrix_ .value_ = {1 , 2 , 2 , 4 };
493+ Highs h;
494+ REQUIRE (h.passModel (lp) == HighsStatus::kOk );
495+ h.run ();
496+ REQUIRE (h.writeSolution (" " , 1 ) == HighsStatus::kOk );
497+ REQUIRE (h.writeModel (" " ) == HighsStatus::kOk );
498+
499+ lp.col_names_ = {" Column0" , " " };
500+ lp.row_names_ = {" Row0" , " Row1" };
501+ REQUIRE (h.passModel (lp) == HighsStatus::kOk );
502+ h.run ();
503+ REQUIRE (h.writeSolution (" " ) == HighsStatus::kOk );
504+ REQUIRE (h.writeModel (" " ) == HighsStatus::kOk );
505+
506+ std::vector<HighsInt> index = {0 , 1 };
507+ std::vector<double > value = {2 , 3 };
508+ REQUIRE (h.addRow (5 , inf, 2 , index.data (), value.data ()) == HighsStatus::kOk );
509+ h.run ();
510+ REQUIRE (h.writeSolution (" " , 1 ) == HighsStatus::kOk );
511+ REQUIRE (h.writeModel (" " ) == HighsStatus::kOk );
512+
513+ lp.row_names_ [1 ] = " Row 1" ;
514+ REQUIRE (h.passModel (lp) == HighsStatus::kOk );
515+ h.run ();
516+ REQUIRE (h.writeSolution (" " , 1 ) == HighsStatus::kError );
517+ REQUIRE (h.writeModel (" " ) == HighsStatus::kError );
518+
519+ h.resetGlobalScheduler (true );
520+ }
0 commit comments