| 284 | } |
| 285 | |
| 286 | static void solveSubproblemQP(Quadratic& idata, const ICrashOptions& options) { |
| 287 | bool minor_iteration_details = false; |
| 288 | |
| 289 | calculateRowValuesQuad(idata.lp, idata.xk); |
| 290 | std::vector<double> residual(idata.lp.num_row_, 0); |
| 291 | updateResidualFast(idata.lp, idata.xk, residual); |
| 292 | double objective = 0; |
| 293 | |
| 294 | // todo: Ax = rv |
| 295 | for (int k = 0; k < options.approximate_minimization_iterations; k++) { |
| 296 | for (int col = 0; col < idata.lp.num_col_; col++) { |
| 297 | // determine whether to minimize for col. |
| 298 | // if empty skip. |
| 299 | if (idata.lp.a_matrix_.start_[col] == idata.lp.a_matrix_.start_[col + 1]) |
| 300 | continue; |
| 301 | |
| 302 | double old_value = idata.xk.col_value[col]; |
| 303 | minimizeComponentQP(col, idata.mu, idata.lp, objective, residual, |
| 304 | idata.xk); |
| 305 | |
| 306 | double new_value = idata.xk.col_value[col]; |
| 307 | double delta_x = new_value - old_value; |
| 308 | if (minor_iteration_details) { |
| 309 | double quadratic_objective = getQuadraticObjective(idata); |
| 310 | printMinorIterationDetails(k, col, idata.xk.col_value[col] - delta_x, |
| 311 | delta_x, objective, residual, |
| 312 | quadratic_objective, options.log_options); |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | bool solveSubproblem(Quadratic& idata, const ICrashOptions& options) { |
| 319 | switch (options.strategy) { |
no test coverage detected