MCPcopy Create free account
hub / github.com/ERGO-Code/HiGHS / formSimplexLpBasisAndFactor

Function formSimplexLpBasisAndFactor

highs/lp_data/HighsSolution.cpp:1850–1912  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1848}
1849
1850HighsStatus formSimplexLpBasisAndFactor(HighsLpSolverObject& solver_object,
1851 const bool only_from_known_basis) {
1852 // Ideally, forms a SimplexBasis from the HighsBasis in the
1853 // HighsLpSolverObject
1854 //
1855 // If only_from_known_basis is true and
1856 // initialiseSimplexLpBasisAndFactor finds that there is no simplex
1857 // basis, then its error return is passed down
1858 //
1859 // If only_from_known_basis is false, then the basis is completed
1860 // with logicals if it is rank deficient (from singularity or being
1861 // incomplete)
1862 //
1863 HighsStatus return_status = HighsStatus::kOk;
1864 HighsStatus call_status;
1865 HighsLp& lp = solver_object.lp_;
1866 HighsBasis& basis = solver_object.basis_;
1867 HighsOptions& options = solver_object.options_;
1868 HEkk& ekk_instance = solver_object.ekk_instance_;
1869 HighsSimplexStatus& ekk_status = ekk_instance.status_;
1870 lp.ensureColwise();
1871 const bool passed_scaled = lp.is_scaled_;
1872 // Consider scaling the LP
1873 if (!passed_scaled) considerScaling(options, lp);
1874 const bool check_basis = basis.alien || (!basis.valid && basis.useful);
1875 if (check_basis) {
1876 // The basis needs to be checked for rank deficiency, and possibly
1877 // completed if it is rectangular
1878 //
1879 // If it's not valid but useful, but not alien,
1880 // accommodateAlienBasis will assert, so make the basis alien
1881 basis.alien = true;
1882 assert(!only_from_known_basis);
1883 accommodateAlienBasis(solver_object);
1884 basis.alien = false;
1885 // Unapply any scaling used only for factorization to check and
1886 // complete the basis
1887 if (!passed_scaled) lp.unapplyScale();
1888 // Check that any scaling the LP arrived with has not been removed
1889 assert(lp.is_scaled_ == passed_scaled);
1890 return HighsStatus::kOk;
1891 }
1892 // Move the HighsLpSolverObject's LP to EKK
1893 ekk_instance.moveLp(solver_object);
1894 if (!ekk_status.has_basis) {
1895 // The Ekk instance has no simplex basis, so pass the HiGHS basis
1896 HighsStatus call_status = ekk_instance.setBasis(basis);
1897 return_status = interpretCallStatus(options.log_options, call_status,
1898 return_status, "setBasis");
1899 if (return_status == HighsStatus::kError)
1900 return formSimplexLpBasisAndFactorReturn(return_status, solver_object);
1901 }
1902 // Now form the invert
1903 assert(ekk_status.has_basis);
1904 call_status =
1905 ekk_instance.initialiseSimplexLpBasisAndFactor(only_from_known_basis);
1906 // If the current basis cannot be inverted, return an error
1907 if (call_status != HighsStatus::kOk)

Callers 3

solveLpSimplexFunction · 0.85
setBasisMethod · 0.85

Calls 9

considerScalingFunction · 0.85
accommodateAlienBasisFunction · 0.85
interpretCallStatusFunction · 0.85
moveLpMethod · 0.80
ensureColwiseMethod · 0.45
unapplyScaleMethod · 0.45
setBasisMethod · 0.45

Tested by

no test coverage detected