From 77a5d93527cd060e21dbac78600fc1f2308cc672 Mon Sep 17 00:00:00 2001 From: Alinson Xavier Date: Wed, 9 Aug 2017 21:44:19 -0400 Subject: [PATCH] infinity: Add failing cut from p0282 to test suite --- infinity/library/src/infinity-nd.c | 2 +- infinity/library/tests/infinity-test.cpp | 39 ++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/infinity/library/src/infinity-nd.c b/infinity/library/src/infinity-nd.c index d9d17c5..5bb6b25 100644 --- a/infinity/library/src/infinity-nd.c +++ b/infinity/library/src/infinity-nd.c @@ -1316,7 +1316,7 @@ int INFINITY_ND_generate_lfree(const struct MultiRowModel *model, &epsilon_x, tx); abort_if(rval, "bound failed"); - if(isinf(epsilon_x)) break; + abort_if(isinf(epsilon_x), "epsilon_x is infinite"); log_debug(" epsilon_x = %.8lf\n", epsilon_x); if(DOUBLE_eq(epsilon_x, epsilon)) diff --git a/infinity/library/tests/infinity-test.cpp b/infinity/library/tests/infinity-test.cpp index 4fd402b..0e1cd21 100644 --- a/infinity/library/tests/infinity-test.cpp +++ b/infinity/library/tests/infinity-test.cpp @@ -567,6 +567,45 @@ TEST(InfinityTest, generate_cut_test_13) lhs = CG_replace_x(&cut, x); EXPECT_LE(lhs, cut.pi_zero); +CLEANUP: + if (rval) FAIL(); +} + +TEST(InfinityTest, generate_cut_test_14) +{ + int rval = 0; + + // Extracted from instance p0282.pre.mps (MIPLIB 3) + double pi0[] = { 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, }; + int indices0[] = { 44, 157, 282, }; + struct Row row0 = {.nz = 3, .head = 282, .pi_zero = 1.00000000000000000000, .pi = pi0, .indices = indices0 }; + double pi1[] = { 78.71559633027523261717, 10.01834862385321223144, 42.93577981651376518357, 42.93577981651376518357, -78.00000000000000000000, -14.00000000000000000000, -60.00000000000000000000, -60.00000000000000000000, -78.00000000000000000000, 0.71559633027523261717, -17.06422018348623481643, 10.01834862385321223144, -14.00000000000000000000, -78.00000000000000000000, 5.11926605504587151074, -8.53211009174311740821, 11.37614678899082321095, 9.66972477064220115039, 2.84403669724770580274, 1.42201834862385290137, -6.54128440366972441211, 1.99082568807339388428, -1.42201834862385290137, 3.12844036697247673828, 2.84403669724770580274, 7.15596330275229419726, 3.57798165137614709863, 107.33944954128440940622, 20.03669724770642446288, 10.00000000000000000000, -5.00000000000000000000, -78.00000000000000000000, -32.00000000000000000000, 18.00000000000000000000, -0.71559633027522939752, 1.00000000000000000000, }; + int indices1[] = { 28, 29, 30, 31, 55, 56, 57, 58, 59, 152, 154, 155, 156, 157, 167, 169, 170, 171, 175, 176, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 212, 218, }; + struct Row row1 = {.nz = 36, .head = 218, .pi_zero = 137.95412844036695787509, .pi = pi1, .indices = indices1 }; + struct Row* rows[] = {&row0, &row1, }; + char column_types[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, }; + struct Tableau tableau = {.ncols = 366, .nrows = 2, .rows = rows, .column_types = column_types }; + double x[366] = {0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000892731722, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 2.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 5.00000000000000000000, 28.00000000000000000000, 8.00000000000000000000, 31.00000000000000000000, 11.00000000000000000000, 45.00000000000000000000, 25.00000000000000000000, 21.00000000000000000000, 1.00000000000000000000, 35.00000000000000000000, 15.00000000000000000000, 12.00000000000000000000, 159.00000000000000000000, 6.00000000000000000000, 179.00000000000000000000, 4.00000000000000000000, 210.00000000000000000000, 15.00000000000000000000, 2.00000000000000000000, 58.00000000000000000000, 38.00000000000000000000, 95.00000000000000000000, 75.00000000000000000000, 6.00000000000000000000, 7.00000000000000000000, 9.00000000053599968908, 3.00000000000000000000, 46.00000000000000000000, 26.00000000000000000000, 39.00000000000000000000, 19.00000000000000000000, 17.00000000000000000000, 252.00000000000000000000, 10.00000000000000000000, 210.00000000000000000000, 4.00000000000000000000, 190.00000000000000000000, 0.00000000000000000000, 5.00000000000000000000, 0.00000000000000000000, 27.99999999998999911099, 7.00000000000000000000, 16.00000000000000000000, 0.00000000000000000000, 3.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000, 10.00000000000000000000, }; + + double lhs, s[2]; + struct Row cut; + LP_init_row(&cut, CG_total_nz(&tableau)); + + ENABLE_LIFTING = 1; + rval = INFINITY_generate_cut(&tableau, &cut); + abort_if(rval, "INFINITY_generate_cut failed"); + ENABLE_LIFTING = 0; + + rval = get_lattice_point(&tableau, x, s); + abort_if(rval, "get_lattice_point failed"); + + for(int i = 0; i < tableau.nrows; i++) + log_debug("s[%d] = %20.12lf\n", i, s[i]); + + lhs = CG_replace_x(&cut, x); + log_info("%20.12lf %20.12lf\n", lhs, cut.pi_zero); + EXPECT_LE(lhs, cut.pi_zero); + CLEANUP: if (rval) FAIL(); } \ No newline at end of file