| 134 | } |
| 135 | |
| 136 | void writeModelBoundSolution( |
| 137 | FILE* file, const HighsLogOptions& log_options, const bool columns, |
| 138 | const HighsInt dim, const std::vector<double>& lower, |
| 139 | const std::vector<double>& upper, const std::vector<std::string>& names, |
| 140 | const bool have_primal, const std::vector<double>& primal, |
| 141 | const bool have_dual, const std::vector<double>& dual, |
| 142 | const bool have_basis, const std::vector<HighsBasisStatus>& status, |
| 143 | const HighsVarType* integrality) { |
| 144 | assert(names.size() == static_cast<size_t>(dim)); |
| 145 | if (have_primal) assert(primal.size() == static_cast<size_t>(dim)); |
| 146 | if (have_dual) assert(dual.size() == static_cast<size_t>(dim)); |
| 147 | if (have_basis) assert(status.size() == static_cast<size_t>(dim)); |
| 148 | const bool have_integrality = integrality != NULL; |
| 149 | std::stringstream ss; |
| 150 | std::string s = columns ? "Columns\n" : "Rows\n"; |
| 151 | highsFprintfString(file, log_options, s); |
| 152 | ss.str(std::string()); |
| 153 | ss << " Index Status Lower Upper Primal Dual"; |
| 154 | if (have_integrality) ss << " Type "; |
| 155 | ss << " Name\n"; |
| 156 | highsFprintfString(file, log_options, ss.str()); |
| 157 | for (HighsInt ix = 0; ix < dim; ix++) { |
| 158 | ss.str(std::string()); |
| 159 | std::string var_status_string = |
| 160 | have_basis ? statusToString(status[ix], lower[ix], upper[ix]) : ""; |
| 161 | ss << highsFormatToString("%9" HIGHSINT_FORMAT " %4s %12g %12g", ix, |
| 162 | var_status_string.c_str(), lower[ix], upper[ix]); |
| 163 | if (have_primal) { |
| 164 | ss << highsFormatToString(" %12g", primal[ix]); |
| 165 | } else { |
| 166 | ss << " "; |
| 167 | } |
| 168 | if (have_dual) { |
| 169 | ss << highsFormatToString(" %12g", dual[ix]); |
| 170 | } else { |
| 171 | ss << " "; |
| 172 | } |
| 173 | if (have_integrality) |
| 174 | ss << highsFormatToString(" %s", typeToString(integrality[ix]).c_str()); |
| 175 | ss << highsFormatToString(" %-s\n", names[ix].c_str()); |
| 176 | highsFprintfString(file, log_options, ss.str()); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | void writeModelObjective(FILE* file, const HighsLogOptions& log_options, |
| 181 | const HighsModel& model, |
no test coverage detected