| 191 | HighsInt Highs_run(void* highs) { return (HighsInt)((Highs*)highs)->run(); } |
| 192 | |
| 193 | HighsInt Highs_postsolve(void* highs, const double* col_value, |
| 194 | const double* col_dual, const double* row_dual) { |
| 195 | const HighsLp& presolved_lp = ((Highs*)highs)->getPresolvedLp(); |
| 196 | HighsInt num_col = presolved_lp.num_col_; |
| 197 | HighsInt num_row = presolved_lp.num_row_; |
| 198 | // Create a HighsSolution from what's been passed |
| 199 | HighsSolution solution; |
| 200 | if (col_value) { |
| 201 | solution.value_valid = true; |
| 202 | solution.col_value.resize(num_col); |
| 203 | // No need for primal row values, but resize the vector for later |
| 204 | // use |
| 205 | solution.row_value.resize(num_row); |
| 206 | } |
| 207 | if (col_dual || row_dual) { |
| 208 | // If column or row duals are passed, assume that they are |
| 209 | // valid. If either is a null pointer, then the corresponding |
| 210 | // vector will have no data, and the size check will fail |
| 211 | solution.dual_valid = true; |
| 212 | if (col_dual) solution.col_dual.resize(num_col); |
| 213 | if (row_dual) solution.row_dual.resize(num_row); |
| 214 | } |
| 215 | for (HighsInt iCol = 0; iCol < num_col; iCol++) { |
| 216 | if (col_value) solution.col_value[iCol] = col_value[iCol]; |
| 217 | if (col_dual) solution.col_dual[iCol] = col_dual[iCol]; |
| 218 | } |
| 219 | if (row_dual) { |
| 220 | for (HighsInt iRow = 0; iRow < num_row; iRow++) |
| 221 | solution.row_dual[iRow] = row_dual[iRow]; |
| 222 | } |
| 223 | return (HighsInt)((Highs*)highs)->postsolve(solution); |
| 224 | } |
| 225 | |
| 226 | HighsInt Highs_readModel(void* highs, const char* filename) { |
| 227 | return (HighsInt)((Highs*)highs)->readModel(std::string(filename)); |