| 513 | } |
| 514 | |
| 515 | void HEkkPrimal::solvePhase2() { |
| 516 | HighsOptions& options = *ekk_instance_.options_; |
| 517 | HighsSimplexStatus& status = ekk_instance_.status_; |
| 518 | HighsModelStatus& model_status = ekk_instance_.model_status_; |
| 519 | // When starting a new phase the (updated) primal objective function |
| 520 | // value isn't known. Indicate this so that when the value |
| 521 | // computed from scratch in build() isn't checked against the |
| 522 | // updated value |
| 523 | status.has_primal_objective_value = false; |
| 524 | status.has_dual_objective_value = false; |
| 525 | // Possibly bail out immediately if iteration limit is current value |
| 526 | if (ekk_instance_.bailout()) return; |
| 527 | highsLogDev(options.log_options, HighsLogType::kDetailed, |
| 528 | "primal-phase2-start\n"); |
| 529 | phase2UpdatePrimal(true); |
| 530 | |
| 531 | // If there's no backtracking basis Save the initial basis in case of |
| 532 | // backtracking |
| 533 | if (!ekk_instance_.info_.valid_backtracking_basis_) |
| 534 | ekk_instance_.putBacktrackingBasis(); |
| 535 | |
| 536 | // Main solving structure |
| 537 | for (;;) { |
| 538 | // |
| 539 | // Rebuild |
| 540 | // |
| 541 | // solve_phase = kSolvePhaseError is set if the basis matrix is singular |
| 542 | rebuild(); |
| 543 | if (solve_phase == kSolvePhaseError) return; |
| 544 | if (solve_phase == kSolvePhaseUnknown) return; |
| 545 | if (ekk_instance_.bailout()) return; |
| 546 | assert(solve_phase == kSolvePhase1 || solve_phase == kSolvePhase2); |
| 547 | // |
| 548 | // solve_phase = kSolvePhase1 is set if primal infeasibilities |
| 549 | // are found in rebuild(), in which case return for phase 1 |
| 550 | if (solve_phase == kSolvePhase1) break; |
| 551 | |
| 552 | for (;;) { |
| 553 | iterate(); |
| 554 | if (ekk_instance_.bailout()) return; |
| 555 | if (solve_phase == kSolvePhaseError) return; |
| 556 | assert(solve_phase == kSolvePhase2); |
| 557 | if (rebuild_reason) break; |
| 558 | } |
| 559 | // If the data are fresh from rebuild() and no flips have |
| 560 | // occurred, possibly break out of the outer loop to see what's |
| 561 | // occurred |
| 562 | bool finished = status.has_fresh_rebuild && num_flip_since_rebuild == 0 && |
| 563 | !ekk_instance_.rebuildRefactor(rebuild_reason); |
| 564 | if (finished && ekk_instance_.tabooBadBasisChange()) { |
| 565 | // A bad basis change has had to be made taboo without any other |
| 566 | // basis changes or flips having been performed from a fresh |
| 567 | // rebuild. In other words, the only basis change that could be |
| 568 | // made is not permitted, so no definitive statement about the |
| 569 | // LP can be made. |
| 570 | solve_phase = kSolvePhaseTabooBasis; |
| 571 | return; |
| 572 | } |
nothing calls this directly
no test coverage detected