@@ -30,20 +30,20 @@ using std::fabs;
3030HighsMipSolver::HighsMipSolver (HighsCallback& callback,
3131 const HighsOptions& options, const HighsLp& lp,
3232 const HighsSolution& solution, bool submip,
33- HighsInt submip_level )
33+ HighsInt global_submip_level )
3434 : callback_(&callback),
3535 options_mip_(&options),
3636 model_(&lp),
3737 orig_model_(&lp),
3838 solution_objective_(kHighsInf ),
3939 submip(submip),
40- submip_level(submip_level ),
40+ global_submip_level(global_submip_level ),
4141 rootbasis(nullptr ),
4242 pscostinit(nullptr ),
4343 clqtableinit(nullptr ),
4444 implicinit(nullptr ) {
45- assert (!submip || submip_level > 0 );
46- this ->max_submip_level = 0 ;
45+ assert (!submip || global_submip_level > 0 );
46+ this ->max_local_submip_level = 0 ;
4747 if (solution.value_valid ) {
4848#ifndef NDEBUG
4949 // MIP solver doesn't check row residuals, but they should be OK
@@ -894,9 +894,9 @@ void HighsMipSolver::cleanupSolve(const bool mip_logging) {
894894 (long long unsigned )mipdata_->sepa_lp_iterations ,
895895 (long long unsigned )mipdata_->heuristic_lp_iterations );
896896
897- const std::vector<HighsMipProblemData >& mip_problem_data =
898- this ->mipdata_ ->mip_problem_data_ ;
899- HighsInt num_mip = static_cast <HighsInt>(mip_problem_data .size ());
897+ const std::vector<HighsMipProblemRecord >& record =
898+ this ->mipdata_ ->mip_problem_data_ . record ;
899+ HighsInt num_mip = static_cast <HighsInt>(record .size ());
900900 HighsInt num_knapsack_mip = 0 ;
901901 size_t sum_knapsack_num_col = 0 ;
902902 HighsInt num_ines_mip = 0 ;
@@ -907,59 +907,60 @@ void HighsMipSolver::cleanupSolve(const bool mip_logging) {
907907 HighsInt min_submip_num_col = kHighsIInf ;
908908 HighsInt min_submip_num_row = kHighsIInf ;
909909 const bool full_submip_logging = true ;
910+ // Must at least have a record for the MIP itself
911+ assert (num_mip > 0 );
910912 for (HighsInt iMip = 0 ; iMip < num_mip; iMip++) {
911- switch (mip_problem_data [iMip].type ) {
913+ switch (record [iMip].type ) {
912914 case HighsMipProblemType::kKnapsack :
913915 num_knapsack_mip++;
914- sum_knapsack_num_col += mip_problem_data [iMip].num_binary ;
916+ sum_knapsack_num_col += record [iMip].num_binary ;
915917 break ;
916918 case HighsMipProblemType::kInes :
917919 num_ines_mip++;
918- sum_ines_num_col += mip_problem_data [iMip].num_binary ;
919- sum_ines_num_row += mip_problem_data [iMip].num_row ;
920+ sum_ines_num_col += record [iMip].num_binary ;
921+ sum_ines_num_row += record [iMip].num_row ;
920922 break ;
921923 case HighsMipProblemType::kOther :
922924 default :
923925 break ;
924926 }
925- HighsInt global_submip_level = mip_problem_data [iMip].submip_level ;
926- max_global_submip_level = std::max (global_submip_level, max_global_submip_level);
927- HighsInt submip_num_col = mip_problem_data[iMip]. num_continuous +
928- mip_problem_data[iMip]. num_binary +
929- mip_problem_data [iMip].num_general_integer +
930- mip_problem_data [iMip].num_implied_integer ;
931- HighsInt submip_num_row = mip_problem_data [iMip].num_row ;
927+ HighsInt global_submip_level = record [iMip].global_submip_level ;
928+ max_global_submip_level =
929+ std::max (global_submip_level, max_global_submip_level);
930+ HighsInt submip_num_col =
931+ record[iMip]. num_continuous + record [iMip].num_binary +
932+ record[iMip]. num_general_integer + record [iMip].num_implied_integer ;
933+ HighsInt submip_num_row = record [iMip].num_row ;
932934 HighsInt submip_sum_dim = submip_num_col + submip_num_row;
933- if (min_submip_sum_dim > submip_sum_dim) {
935+ if (min_submip_sum_dim > submip_sum_dim && submip_sum_dim > 0 ) {
934936 min_submip_sum_dim = submip_sum_dim;
935937 min_submip_num_col = submip_num_col;
936938 min_submip_num_row = submip_num_row;
937939 }
938- if (full_submip_logging)
939- highsLogUser (options_mip_->log_options , HighsLogType::kInfo ,
940- " MIP %3d (level = %2d; %6d conts; %6d bin; "
941- " %6d gen; %6d impl; cols / rows: %6d / %6d; type %s)\n " ,
942- int (iMip), int (global_submip_level),
943- int (mip_problem_data[iMip].num_continuous ),
944- int (mip_problem_data[iMip].num_binary ),
945- int (mip_problem_data[iMip].num_general_integer ),
946- int (mip_problem_data[iMip].num_implied_integer ),
947- int (submip_num_col), int (submip_num_row),
948- mip_problem_data[iMip].type == HighsMipProblemType::kKnapsack
949- ? " Knapsack"
950- : mip_problem_data[iMip].type == HighsMipProblemType::kInes
951- ? " Ines"
952- : " Other" );
940+ if (full_submip_logging && record[iMip].type != HighsMipProblemType::kOther )
941+ highsLogUser (
942+ options_mip_->log_options , HighsLogType::kInfo ,
943+ " MIP %3d (level = %2d; %6d conts; %6d bin; "
944+ " %6d gen; %6d impl; cols / rows: %6d / %6d; type %s)\n " ,
945+ int (iMip), int (global_submip_level), int (record[iMip].num_continuous ),
946+ int (record[iMip].num_binary ), int (record[iMip].num_general_integer ),
947+ int (record[iMip].num_implied_integer ), int (submip_num_col),
948+ int (submip_num_row),
949+ record[iMip].type == HighsMipProblemType::kKnapsack ? " Knapsack"
950+ : record[iMip].type == HighsMipProblemType::kInes ? " Ines"
951+ : " Other" );
953952 }
954953 highsLogUser (options_mip_->log_options , HighsLogType::kInfo ,
955954 " MIPs %d (%d knapsack; %d Ines)\n " , int (num_mip),
956955 int (num_knapsack_mip), int (num_ines_mip));
957956
958957 std::stringstream ss;
959958 ss.str (std::string ());
960- assert (submip_level + max_submip_level == max_global_submip_level);
961- ss << highsFormatToString (" Max sub-MIP level %d" , int (submip_level + max_submip_level));
962- if (max_submip_level > 0 )
959+ assert (global_submip_level + max_local_submip_level ==
960+ max_global_submip_level);
961+ ss << highsFormatToString (" Max sub-MIP level %d" ,
962+ int (global_submip_level + max_local_submip_level));
963+ if (max_local_submip_level > 0 )
963964 ss << highsFormatToString (" (min cols/rows: %d/%d)\n " ,
964965 int (min_submip_num_col), int (min_submip_num_row));
965966 highsLogUser (options_mip_->log_options , HighsLogType::kInfo , " %s\n " ,
@@ -974,9 +975,21 @@ void HighsMipSolver::cleanupSolve(const bool mip_logging) {
974975 num_knapsack_mip, sum_knapsack_num_col, num_ines_mip,
975976 sum_ines_num_col, sum_ines_num_row);
976977
977- if (max_submip_level > 0 ) {
978+ const bool write_ines_model = false ;
979+ if (write_ines_model) {
980+ if (!submip && mipdata_->mip_problem_data_ .ines_mip .num_col_ > 0 ) {
981+ const std::string file_name_prefix = model_->model_name_ + " _ines" ;
982+ highsLogUser (options_mip_->log_options , HighsLogType::kInfo ,
983+ " Generating MPS file %s.mps for Ines MIP with %d columns "
984+ " and %d rows\n " ,
985+ file_name_prefix.c_str (),
986+ int (mipdata_->mip_problem_data_ .ines_mip .num_col_ ),
987+ int (mipdata_->mip_problem_data_ .ines_mip .num_row_ ));
988+ HighsStatus call_status =
989+ writeLpToMps (*options_mip_, mipdata_->mip_problem_data_ .ines_mip ,
990+ file_name_prefix);
991+ }
978992 }
979-
980993 if (!timeless_log) analysis_.reportMipTimer ();
981994
982995 assert (modelstatus_ != HighsModelStatus::kNotset );
0 commit comments