| 1967 | } |
| 1968 | |
| 1969 | bool HEkk::rebuildRefactor(HighsInt rebuild_reason) { |
| 1970 | // If no updates have been performed, then don't refactor! |
| 1971 | if (info_.update_count == 0) return false; |
| 1972 | // Otherwise, refactor by default |
| 1973 | bool refactor = true; |
| 1974 | double solution_error = 0; |
| 1975 | if (options_->no_unnecessary_rebuild_refactor) { |
| 1976 | // Consider whether not to refactor in rebuild |
| 1977 | // |
| 1978 | // Must have an INVERT just to consider this! |
| 1979 | assert(status_.has_invert); |
| 1980 | if (rebuild_reason == kRebuildReasonNo || |
| 1981 | rebuild_reason == kRebuildReasonPossiblyOptimal || |
| 1982 | rebuild_reason == kRebuildReasonPossiblyPhase1Feasible || |
| 1983 | rebuild_reason == kRebuildReasonPossiblyPrimalUnbounded || |
| 1984 | rebuild_reason == kRebuildReasonPossiblyDualUnbounded || |
| 1985 | rebuild_reason == kRebuildReasonPrimalInfeasibleInPrimalSimplex) { |
| 1986 | // By default, don't refactor! |
| 1987 | refactor = false; |
| 1988 | // Possibly revise the decision based on accuracy when solving a |
| 1989 | // test system |
| 1990 | const double error_tolerance = |
| 1991 | options_->rebuild_refactor_solution_error_tolerance; |
| 1992 | if (error_tolerance > 0) { |
| 1993 | solution_error = factorSolveError(); |
| 1994 | refactor = solution_error > error_tolerance; |
| 1995 | } |
| 1996 | } |
| 1997 | } |
| 1998 | const bool report_refactorization = false; |
| 1999 | if (report_refactorization) { |
| 2000 | const std::string logic = refactor ? " " : "no "; |
| 2001 | if (info_.update_count && |
| 2002 | rebuild_reason != kRebuildReasonSyntheticClockSaysInvert) |
| 2003 | printf( |
| 2004 | "%srefactorization after %4d updates and solution error = %11.4g for " |
| 2005 | "rebuild reason = %s\n", |
| 2006 | logic.c_str(), (int)info_.update_count, solution_error, |
| 2007 | rebuildReason(rebuild_reason).c_str()); |
| 2008 | } |
| 2009 | return refactor; |
| 2010 | } |
| 2011 | |
| 2012 | HighsInt HEkk::computeFactor() { |
| 2013 | assert(status_.has_nla); |
no test coverage detected