Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introducing a deterministic decision on whether to compute the analytic centre in MIP #2062

Open
wants to merge 42 commits into
base: latest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
fdc149a
Make analytic centre calculation an option - allowing true calculatio…
jajhall Nov 25, 2024
2eb63d3
Now not attempring AC calculation in sub-MIP if it failed (or was not…
jajhall Nov 25, 2024
b62b112
Introduce kkt_iter_limit
jajhall Nov 25, 2024
0bb8cf0
Now to get data on max CG iterations
jajhall Nov 25, 2024
2e180e7
changed iter to iterSum in IPX
jajhall Nov 25, 2024
ddd52b3
Ready to do some testing to identify limit on KKT iterations
jajhall Nov 25, 2024
f3ff0b4
Now to test AC, gathering more data
jajhall Nov 26, 2024
150f4f3
Fixed std::max error in HighsMipSolverDat.cpp:324
jajhall Nov 26, 2024
7feb354
Cast 100 to HighsInt in HighsMipSolverData.cpp
jajhall Nov 26, 2024
57c5f4c
Now to introduce control of kkt iteration limit for phase 1
jajhall Nov 27, 2024
39f712d
Test 100 MIP with proposed cr1 and cr2 limits
jajhall Nov 27, 2024
b981b61
Extract current fill from IPX basis
jajhall Nov 27, 2024
45545b7
Now extracting fill factors for IPX basis factorization
jajhall Nov 27, 2024
b6f29b8
Reporting IPX fill factor, and added timeout to AC solve
jajhall Nov 28, 2024
a201c95
Merge branch 'latest' into fix-2049
jajhall Nov 28, 2024
d05a2d6
Added lp_data/HighsSolutionStats.h
jajhall Nov 28, 2024
4f393aa
Now including simplex stats in IPX
jajhall Nov 29, 2024
54ce3ae
Formatted
jajhall Nov 29, 2024
17c4c8a
Introduced simplex_stats_ and presolved_lp_simplex_stats_ into Highs.h
jajhall Nov 29, 2024
b2115a5
Added invalidateSimplexStats() to Highs.h
jajhall Nov 29, 2024
b7fa6e1
Merged fix-2049 into this branch
jajhall Nov 29, 2024
597b4e7
Added CSV reporting to SimplexStats
jajhall Nov 29, 2024
02d719c
Added CSV reporting to SimplexStats; formatted
jajhall Nov 29, 2024
59d8c02
Root relaxation solve needs debugging
jajhall Nov 29, 2024
a6aacf8
HighsSolutionStats.h is now HighsSolverStats.h
jajhall Nov 30, 2024
5b332f6
Have extracted matrix_nz from depths of basic_lu!
jajhall Nov 30, 2024
877d52e
Gathered IPX stats from ComputeStartingPoint!
jajhall Dec 1, 2024
70ac00f
Now to return INVERT nz from basiclu
jajhall Dec 1, 2024
d45afb2
Now extracting matrix_nz and invert_nz
jajhall Dec 1, 2024
78b268d
Remvoved matrix_nz and invert_nz from kkt
jajhall Dec 1, 2024
aa522b9
Cleaned out unnecessary code, added when guessing how to get matrix_n…
jajhall Dec 1, 2024
47c99e3
Introduced mip_old_analytic_centre_method option, and restricted mip_…
jajhall Dec 2, 2024
0861f04
Corrected IPX stats when kk1 has 0 iterations
jajhall Dec 2, 2024
3c98069
Corrected IPX stats when kk1 has 0 iterations; formatted
jajhall Dec 2, 2024
593ec7b
Suppressing initial_root_node_solve
jajhall Dec 2, 2024
a3d3fb5
Now producing positive terms in simplex cost function
jajhall Dec 5, 2024
42e2b05
Incorporate simplex/IPX/crossover times in solver stats
jajhall Dec 9, 2024
d77061c
Incorporated simplex time in solver stats
jajhall Dec 9, 2024
5d5393c
Gather new stats
jajhall Dec 9, 2024
9546d03
Introduce separate CR1 and CR2 timing
jajhall Dec 10, 2024
0f68c8e
Added Type1, Type2 and Basis0 timing
jajhall Dec 11, 2024
a33f338
Now timing IPX type1 iterations correctly and ensuring IPX time limit…
jajhall Dec 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 72 additions & 8 deletions check/TestLpSolvers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include "Highs.h"
#include "catch.hpp"

const bool dev_run = false;
const bool dev_run = true;

struct IterationCount {
HighsInt simplex;
Expand Down Expand Up @@ -648,27 +648,58 @@ TEST_CASE("simplex-stats", "[highs_lp_solver]") {

Highs h;
const HighsSimplexStats& simplex_stats = h.getSimplexStats();
const HighsSimplexStats& presolved_lp_simplex_stats =
h.getPresolvedLpSimplexStats();
h.setOptionValue("output_flag", dev_run);
// std::string model = "dcp2";
std::string model = "adlittle";
std::string model_file =
std::string(HIGHS_DIR) + "/check/instances/adlittle.mps";
std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps";
REQUIRE(h.readModel(model_file) == HighsStatus::kOk);

REQUIRE(h.run() == HighsStatus::kOk);
REQUIRE(simplex_stats.valid);
REQUIRE(simplex_stats.iteration_count == 0);
REQUIRE(simplex_stats.num_invert == 1);
REQUIRE(simplex_stats.num_col > 0);
REQUIRE(simplex_stats.num_row > 0);
REQUIRE(simplex_stats.num_nz > 0);
REQUIRE(simplex_stats.iteration_count >= 0);
REQUIRE(simplex_stats.num_invert > 0);
REQUIRE(simplex_stats.last_invert_num_el > 0);
REQUIRE(simplex_stats.last_factored_basis_num_el > 0);
REQUIRE(simplex_stats.col_aq_density == 0);
REQUIRE(simplex_stats.row_ep_density == 0);
REQUIRE(simplex_stats.row_ap_density == 0);
REQUIRE(simplex_stats.row_DSE_density == 0);
if (simplex_stats.iteration_count > 0) {
REQUIRE(simplex_stats.col_aq_density > 0);
REQUIRE(simplex_stats.row_ep_density > 0);
REQUIRE(simplex_stats.row_ap_density > 0);
REQUIRE(simplex_stats.row_DSE_density > 0);
} else {
REQUIRE(simplex_stats.col_aq_density == 0);
REQUIRE(simplex_stats.row_ep_density == 0);
REQUIRE(simplex_stats.row_ap_density == 0);
REQUIRE(simplex_stats.row_DSE_density == 0);
}
if (dev_run) h.reportSimplexStats(stdout);

REQUIRE(presolved_lp_simplex_stats.valid);
REQUIRE(presolved_lp_simplex_stats.num_col > 0);
REQUIRE(presolved_lp_simplex_stats.num_row > 0);
REQUIRE(presolved_lp_simplex_stats.num_nz > 0);
REQUIRE(presolved_lp_simplex_stats.iteration_count > 0);
REQUIRE(presolved_lp_simplex_stats.num_invert > 0);
REQUIRE(presolved_lp_simplex_stats.last_invert_num_el > 0);
REQUIRE(presolved_lp_simplex_stats.last_factored_basis_num_el > 0);
REQUIRE(presolved_lp_simplex_stats.col_aq_density > 0);
REQUIRE(presolved_lp_simplex_stats.row_ep_density > 0);
REQUIRE(presolved_lp_simplex_stats.row_ap_density > 0);
REQUIRE(presolved_lp_simplex_stats.row_DSE_density > 0);
if (dev_run) h.reportPresolvedLpSimplexStats(stdout);

h.clearSolver();
h.setOptionValue("presolve", kHighsOffString);
REQUIRE(h.run() == HighsStatus::kOk);
REQUIRE(simplex_stats.valid);
REQUIRE(simplex_stats.num_col > 0);
REQUIRE(simplex_stats.num_row > 0);
REQUIRE(simplex_stats.num_nz > 0);
REQUIRE(simplex_stats.iteration_count > 0);
REQUIRE(simplex_stats.num_invert > 0);
REQUIRE(simplex_stats.last_invert_num_el > 0);
Expand All @@ -679,3 +710,36 @@ TEST_CASE("simplex-stats", "[highs_lp_solver]") {
REQUIRE(simplex_stats.row_DSE_density > 0);
if (dev_run) h.reportSimplexStats(stdout);
}

TEST_CASE("ipx-stats", "[highs_lp_solver]") {
HighsStatus return_status;

Highs h;
const HighsIpxStats& ipx_stats = h.getIpxStats();
h.setOptionValue("output_flag", dev_run);
// std::string model = "dcp2";
std::string model = "adlittle";
std::string model_file =
std::string(HIGHS_DIR) + "/check/instances/" + model + ".mps";
REQUIRE(h.readModel(model_file) == HighsStatus::kOk);
h.setOptionValue("solver", kIpmString);
REQUIRE(h.run() == HighsStatus::kOk);
REQUIRE(ipx_stats.valid);
REQUIRE(ipx_stats.num_col > 0);
REQUIRE(ipx_stats.num_row > 0);
REQUIRE(ipx_stats.num_nz > 0);
REQUIRE(ipx_stats.iteration_count > 0);
for (HighsInt iteration = 0; iteration < ipx_stats.iteration_count;
iteration++) {
REQUIRE(ipx_stats.cr_count[iteration] > 0);
if (ipx_stats.cr_type[iteration] == 2) {
REQUIRE(ipx_stats.factored_basis_num_el[iteration] > 0);
REQUIRE(ipx_stats.invert_num_el[iteration] > 0);
} else {
REQUIRE(ipx_stats.cr_type[iteration] == 1);
REQUIRE(ipx_stats.factored_basis_num_el[iteration] == 0);
REQUIRE(ipx_stats.invert_num_el[iteration] == 0);
}
}
if (dev_run) h.reportIpxStats(stdout);
}
1 change: 1 addition & 0 deletions cmake/sources-python.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ set(highs_headers_python
src/lp_data/HighsSolution.h
src/lp_data/HighsSolutionDebug.h
src/lp_data/HighsSolve.h
src/lp_data/HighsSolverStats.h
src/lp_data/HighsStatus.h
src/lp_data/HStruct.h
src/mip/HighsCliqueTable.h
Expand Down
1 change: 1 addition & 0 deletions cmake/sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ set(highs_headers
lp_data/HighsSolution.h
lp_data/HighsSolutionDebug.h
lp_data/HighsSolve.h
lp_data/HighsSolverStats.h
lp_data/HighsStatus.h
lp_data/HStruct.h
mip/HighsCliqueTable.h
Expand Down
44 changes: 39 additions & 5 deletions src/Highs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1216,11 +1216,35 @@ class Highs {

// Start of advanced methods for HiGHS MIP solver

const HighsSimplexStats& getSimplexStats() const {
return ekk_instance_.getSimplexStats();
const HighsSimplexStats& getPresolvedLpSimplexStats() const {
return presolved_lp_simplex_stats_;
}
void reportSimplexStats(FILE* file) const {
ekk_instance_.reportSimplexStats(file);

void reportPresolvedLpSimplexStats(
FILE* file, const HighsInt style = HighsSolverStatsReportPretty) const {
presolved_lp_simplex_stats_.report(file, "Presolved LP", style);
}

const HighsSimplexStats& getSimplexStats() const { return simplex_stats_; }

void reportSimplexStats(
FILE* file, const HighsInt style = HighsSolverStatsReportPretty) const {
simplex_stats_.report(file, "Original LP", style);
}

void passSimplexStats(const HighsSimplexStats simplex_stats) {
this->simplex_stats_ = simplex_stats;
}

const HighsIpxStats& getIpxStats() { return ipx_stats_; }

void reportIpxStats(FILE* file,
const HighsInt style = HighsSolverStatsReportPretty) {
ipx_stats_.report(file, "Original LP", style);
}

void passIpxStats(const HighsIpxStats ipx_stats) {
this->ipx_stats_ = ipx_stats;
}

/**
Expand Down Expand Up @@ -1438,6 +1462,9 @@ class Highs {
HighsSparseMatrix standard_form_matrix_;

HEkk ekk_instance_;
HighsSimplexStats simplex_stats_;
HighsSimplexStats presolved_lp_simplex_stats_;
HighsIpxStats ipx_stats_;

HighsPresolveLog presolve_log_;

Expand Down Expand Up @@ -1500,7 +1527,8 @@ class Highs {
//
// Invalidates all solver data in Highs class members by calling
// invalidateModelStatus(), invalidateSolution(), invalidateBasis(),
// invalidateInfo() and invalidateEkk()
// invalidateInfo(), invalidateEkk(), invalidateIis(),
// invalidateSimplexStats() and invalidateIpxStats();
void invalidateUserSolverData();
//
// Invalidates the model status, solution_ and info_
Expand All @@ -1527,6 +1555,12 @@ class Highs {
// Invalidates iis_
void invalidateIis();

// Invalidates simplex_stats_ and presolved_lp_simplex_stats_;
void invalidateSimplexStats();

// Invalidates ipx_stats_
void invalidateIpxStats();

HighsStatus returnFromWriteSolution(FILE* file,
const HighsStatus return_status);
HighsStatus returnFromRun(const HighsStatus return_status,
Expand Down
Loading
Loading