@@ -2060,8 +2060,8 @@ HighsStatus readSolutionFile(const std::string filename,
20602060 std::string keyword;
20612061 std::string name;
20622062 double value;
2063- HighsInt num_col;
2064- HighsInt num_row;
2063+ HighsInt num_col = - 1 ;
2064+ HighsInt num_row = - 1 ;
20652065 const HighsInt lp_num_col = lp.num_col_ ;
20662066 const HighsInt lp_num_row = lp.num_row_ ;
20672067 // Define identifiers for reading in
@@ -2101,8 +2101,11 @@ HighsStatus readSolutionFile(const std::string filename,
21012101 if (!readSolutionFileIgnoreLineOk (in_file))
21022102 return readSolutionFileErrorReturn (in_file); // Objective
21032103 // Next line should be "Columns" and correct number
2104- if (!readSolutionFileHashKeywordIntLineOk (keyword, num_col, in_file))
2104+ if (!readSolutionFileHashKeywordIntLineOk (keyword, num_col, in_file)) {
2105+ highsLogUser (log_options, HighsLogType::kError ,
2106+ " readSolutionFile: Error reading line \" # %s %d\" " , keyword.c_str (), int (num_col));
21052107 return readSolutionFileErrorReturn (in_file);
2108+ }
21062109 assert (keyword == " Columns" );
21072110 // The default style parameter is kSolutionStyleRaw, and this still
21082111 // allows sparse files to be read. Recognise the latter from num_col
@@ -2143,6 +2146,7 @@ HighsStatus readSolutionFile(const std::string filename,
21432146 if (miplib_sol) {
21442147 HighsInt num_value = 0 ;
21452148 read_solution.col_value .assign (lp_num_col, 0 );
2149+ assert (is_column);
21462150 for (;;) {
21472151 // Only false return is for encountering EOF
21482152 if (!readSolutionFileIdDoubleLineOk (name, value, in_file)) break ;
@@ -2162,13 +2166,16 @@ HighsStatus readSolutionFile(const std::string filename,
21622166 read_solution.col_value [iCol] = value;
21632167 }
21642168 } else {
2169+ assert (is_column);
21652170 for (HighsInt iX = 0 ; iX < num_col; iX++) {
21662171 if (!readSolutionFileIdDoubleLineOk (name, value, in_file))
21672172 return readSolutionFileErrorReturn (in_file);
21682173 return_status =
21692174 getIndexFromName (log_options, from_method, is_column, name,
21702175 lp.col_hash_ .name2index , iCol, lp.col_names_ );
21712176 if (return_status != HighsStatus::kOk ) return return_status;
2177+ printf (" Solution entry %6d (%15s) has value %11.4g for column names[%6d] = %s\n " ,
2178+ int (iX), name.c_str (), value, int (iCol), lp.col_names_ [iCol].c_str ());
21722179 read_solution.col_value [iCol] = value;
21732180 }
21742181 }
@@ -2210,6 +2217,7 @@ HighsStatus readSolutionFile(const std::string filename,
22102217 if (!lp.row_hash_ .name2index .size ()) lp.row_hash_ .form (lp.row_names_ );
22112218 }
22122219 is_column = false ;
2220+ assert (!is_column);
22132221 for (HighsInt iX = 0 ; iX < num_row; iX++) {
22142222 if (!readSolutionFileIdDoubleLineOk (name, value, in_file))
22152223 return readSolutionFileErrorReturn (in_file);
@@ -2260,6 +2268,7 @@ HighsStatus readSolutionFile(const std::string filename,
22602268 assert (keyword == " Columns" );
22612269 double dual;
22622270 is_column = true ;
2271+ assert (is_column);
22632272 for (HighsInt iX = 0 ; iX < num_col; iX++) {
22642273 if (!readSolutionFileIdDoubleLineOk (name, dual, in_file))
22652274 return readSolutionFileErrorReturn (in_file);
@@ -2276,6 +2285,7 @@ HighsStatus readSolutionFile(const std::string filename,
22762285 read_solution, read_basis, in_file);
22772286 assert (keyword == " Rows" );
22782287 is_column = false ;
2288+ assert (!is_column);
22792289 for (HighsInt iX = 0 ; iX < num_row; iX++) {
22802290 if (!readSolutionFileIdDoubleLineOk (name, dual, in_file))
22812291 return readSolutionFileErrorReturn (in_file);
0 commit comments