| 421 | } |
| 422 | |
| 423 | void HEkkPrimal::solvePhase1() { |
| 424 | HighsSimplexInfo& info = ekk_instance_.info_; |
| 425 | HighsSimplexStatus& status = ekk_instance_.status_; |
| 426 | // When starting a new phase the (updated) primal objective function |
| 427 | // value isn't known. Indicate this so that when the value |
| 428 | // computed from scratch in build() isn't checked against the |
| 429 | // updated value |
| 430 | status.has_primal_objective_value = false; |
| 431 | status.has_dual_objective_value = false; |
| 432 | // Possibly bail out immediately if iteration limit is current value |
| 433 | if (ekk_instance_.bailout()) return; |
| 434 | highsLogDev(ekk_instance_.options_->log_options, HighsLogType::kDetailed, |
| 435 | "primal-phase1-start\n"); |
| 436 | // If there's no backtracking basis, save the initial basis in case of |
| 437 | // backtracking |
| 438 | if (!info.valid_backtracking_basis_) ekk_instance_.putBacktrackingBasis(); |
| 439 | |
| 440 | // Main solving structure |
| 441 | for (;;) { |
| 442 | // |
| 443 | // Rebuild |
| 444 | // |
| 445 | // solve_phase = kSolvePhaseError is set if the basis matrix is singular |
| 446 | rebuild(); |
| 447 | if (solve_phase == kSolvePhaseError) return; |
| 448 | if (solve_phase == kSolvePhaseUnknown) return; |
| 449 | if (ekk_instance_.bailout()) return; |
| 450 | assert(solve_phase == kSolvePhase1 || solve_phase == kSolvePhase2); |
| 451 | // |
| 452 | // solve_phase = kSolvePhase2 is set if no primal infeasibilities |
| 453 | // are found in rebuild(), in which case return for phase 2 |
| 454 | if (solve_phase == kSolvePhase2) break; |
| 455 | |
| 456 | for (;;) { |
| 457 | iterate(); |
| 458 | if (ekk_instance_.bailout()) return; |
| 459 | if (solve_phase == kSolvePhaseError) return; |
| 460 | assert(solve_phase == kSolvePhase1); |
| 461 | if (rebuild_reason) break; |
| 462 | } |
| 463 | // If the data are fresh from rebuild() and no flips have |
| 464 | // occurred, possibly break out of the outer loop to see what's |
| 465 | // occurred |
| 466 | bool finished = status.has_fresh_rebuild && num_flip_since_rebuild == 0 && |
| 467 | !ekk_instance_.rebuildRefactor(rebuild_reason); |
| 468 | if (finished && ekk_instance_.tabooBadBasisChange()) { |
| 469 | // A bad basis change has had to be made taboo without any other |
| 470 | // basis changes or flips having been performed from a fresh |
| 471 | // rebuild. In other words, the only basis change that could be |
| 472 | // made is not permitted, so no definitive statement about the |
| 473 | // LP can be made. |
| 474 | solve_phase = kSolvePhaseTabooBasis; |
| 475 | return; |
| 476 | } |
| 477 | if (finished) break; |
| 478 | } |
| 479 | // If bailing out, should have returned already |
| 480 | assert(!ekk_instance_.solve_bailout_); |
nothing calls this directly
no test coverage detected