/* Copyright (c) 2015-2017 Alinson Xavier * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #include #define TEST_SOURCE extern "C" { #include #include "../src/infinity.c" } int ENABLE_LIFTING = 0; int MIN_N_ROWS = 2; int MAX_N_ROWS = 2; int SHOULD_DUMP_CUTS = 1; int DUMP_CUT_N = 0; TEST(InfinityTest, cmp_ray_angle_test) { double r0[] = { 1.0, 0.0 }; double r1[] = { 2.0, 0.0 }; double r2[] = { 1.0, 1.0 }; double r3[] = { -1.0, 0.0 }; double r4[] = { 1.0, -1.0 }; SortPair sp0 = { 0, &r0 }; SortPair sp1 = { 1, &r1 }; SortPair sp2 = { 2, &r2 }; SortPair sp3 = { 3, &r3 }; SortPair sp4 = { 4, &r4 }; EXPECT_EQ(_qsort_cmp_rays_angle(&sp0, &sp1), 0); EXPECT_EQ(_qsort_cmp_rays_angle(&sp0, &sp2), 1); EXPECT_EQ(_qsort_cmp_rays_angle(&sp0, &sp3), 1); EXPECT_EQ(_qsort_cmp_rays_angle(&sp0, &sp4), -1); EXPECT_EQ(_qsort_cmp_rays_angle(&sp2, &sp0), -1); EXPECT_EQ(_qsort_cmp_rays_angle(&sp2, &sp1), -1); EXPECT_EQ(_qsort_cmp_rays_angle(&sp2, &sp3), 1); EXPECT_EQ(_qsort_cmp_rays_angle(&sp2, &sp4), -1); EXPECT_EQ(_qsort_cmp_rays_angle(&sp3, &sp0), -1); } TEST(InfinityTest, sort_rays_angle_test) { int rval = 0; double r0[] = { 1.0, 1.0 }; double r1[] = { 1.0, 0.0 }; double r2[] = { 1.0, -1.0 }; double r3[] = { -1.0, 0.0 }; double r4[] = { 2.0, 0.0 }; RayList rays; LFREE_init_ray_list(&rays, 2, 5); LFREE_push_ray(&rays, r0); LFREE_push_ray(&rays, r1); LFREE_push_ray(&rays, r2); LFREE_push_ray(&rays, r3); LFREE_push_ray(&rays, r4); rval = sort_rays_by_angle(&rays); abort_if(rval, "sort_rays_by_angle failed"); SortPair sp0, sp1, sp2, sp3, sp4; sp0 = { 0, LFREE_get_ray(&rays, 0) }; sp1 = { 1, LFREE_get_ray(&rays, 1) }; sp2 = { 2, LFREE_get_ray(&rays, 2) }; sp3 = { 3, LFREE_get_ray(&rays, 3) }; sp4 = { 4, LFREE_get_ray(&rays, 4) }; EXPECT_LE(_qsort_cmp_rays_angle(&sp0, &sp1), 0); EXPECT_LE(_qsort_cmp_rays_angle(&sp1, &sp2), 0); EXPECT_LE(_qsort_cmp_rays_angle(&sp2, &sp3), 0); EXPECT_LE(_qsort_cmp_rays_angle(&sp3, &sp4), 0); CLEANUP: LFREE_free_ray_list(&rays); if (rval) FAIL(); } //TEST(InfinityTest, generate_cut_test) //{ // int rval = 0; // // double pi0[] = { -0.0553783449, -0.0553783449, -0.1666666667, -0.0553783449, -0.0553783449, -0.0498405104, -0.0553783449, -0.0553783449, -0.0498405104, -0.0498405104, -0.1500000000, -0.0498405104, -0.0272904483, -0.0272904483, -0.0498405104, -0.0498405104, -0.0498405104, -0.0498405104, -0.0272904483, -0.0443026759, -0.0443026759, -0.1333333333, -0.0443026759, -0.0433723197, -0.0438596491, -0.0443026759, -0.0443026759, -0.0443026759, -0.0443026759, -0.0438596491, -0.0332270069, -0.0332270069, -0.1000000000, -0.0332270069, -0.0160818713, -0.0155945419, -0.0332270069, -0.0332270069, -0.0332270069, -0.0332270069, -0.0155945419, -0.0354421407, -0.0354421407, -0.1066666667, -0.0354421407, -0.0433723197, -0.0438596491, -0.0354421407, -0.0354421407, -0.0354421407, -0.0354421407, -0.0438596491, -0.0553783449, -0.0553783449, -0.1666666667, -0.0575934786, -0.0433723197, -0.0506822612, -0.0553783449, -0.0498405104, -0.0553783449, -0.0575934786, -0.0506822612, -0.0433723197, -0.0438596491, -0.0438596491, -0.0498405104, -0.0498405104, -0.1500000000, -0.0487329435, -0.0498405104, -0.0498405104, -0.0498405104, -0.0487329435, 0.7784866206, 0.9113946482, 0.7231082757, 0.9405458090, 0.8958887117, 0.9257930179, -0.5015948963, 0.7441520468, 0.9259259259, 0.0291068581, 0.0291068581, -0.0489668616, -0.1246429204, -0.0667729931, -0.0667729931, -0.0220857700, -0.0934821903, -0.1246429204, -0.0623214602, 0.0291068581, 0.0288853447, 0.0088605352, 0.0147084884, 0.0112085770, 0.0133794081, 0.0288853447, 0.0066454014, 0.0288853447, 0.0088605352, 0.0147084884, 0.0133794081, 0.0288853447, 0.0066454014, 0.0291068581, 0.0121832359, 0.0291068581, 0.0121832359, 0.0291068581, 0.0291068581, 0.0288853447, 0.0088605352, 0.0147084884, 0.0133794081, 0.0288853447, 0.0066454014, 0.0243664717, 0.0620237462, 0.0332270069, 0.0332270069, 0.0545808967, 0.0465178097, 0.0620237462, 0.0011075669, 0.0011075669, 0.0033333333, 0.0011075669, 0.0004873294, 0.0009746589, 0.0011075669, 0.0011075669, 0.0011075669, 0.0011075669, 0.0009746589, 1.0000000000, }; // double pi1[] = { 0.5000000000, 0.8035714286, 0.2857142857, 0.8035714286, 0.9285714286, 0.8035714286, 1.3571428571, 0.4464285714, 0.6071428571, 0.4464285714, 0.3392857143, 1.0000000000, 0.6071428571, 0.6071428571, 0.4464285714, -0.0178571429, }; // int indices0[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 80, 81, 82, 83, 84, 89, 97, 101, 102, 103, 104, 105, 106, 107, 108, 113, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 130, 131, 132, 137, 142, 145, 147, 153, 161, 166, 167, 168, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 199, }; // int indices1[] = { 18, 29, 40, 51, 62, 65, 84, 165, 166, 167, 168, 169, 170, 171, 172, 190, }; // struct Row row0 = {.nz = 138, .head = 199, .pi_zero = 0.1711855396, .pi = pi0, .indices = indices0 }; // struct Row row1 = {.nz = 16, .head = 169, .pi_zero = 1.3571428571, .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, 1, }; // struct Tableau tableau = {.ncols = 201, .nrows = 2, .rows = rows, .column_types = column_types}; // // double pi2[] = { -0.0861798566, -0.0861798566, -0.2593668965, -0.0861798566, -0.0861798566, -0.0775618709, -0.0861798566, -0.0861798566, -0.0775618709, -0.0775618709, -0.2334302068, -0.0775618709, -0.0424694333, -0.0424694333, -0.0775618709, -0.0775618709, -0.0775618709, -0.0775618709, -1.8155682752, -0.0689438853, -0.0689438853, -0.2074935172, -0.0689438853, -0.0674960637, -0.0682544464, -0.0689438853, -0.0689438853, -0.0689438853, -0.0689438853, -2.9178775851, -0.0517079140, -0.0517079140, -0.1556201379, -0.0517079140, -0.0250266304, -0.0242682476, -0.0517079140, -0.0517079140, -0.0517079140, -0.0517079140, -1.0374675858, -0.0551551082, -0.0551551082, -0.1659948137, -0.0551551082, -0.0674960637, -0.0682544464, -0.0551551082, -0.0551551082, -0.0551551082, -0.0551551082, -2.9178775851, -0.0861798566, -0.0861798566, -0.2593668965, -0.0896270509, -0.0674960637, -0.0788718048, -0.0861798566, -0.0775618709, -0.0861798566, -0.0896270509, -3.3717696539, -0.0674960637, -0.0682544464, -2.9178775851, -0.0775618709, -0.0775618709, -0.2334302068, -0.0758382738, -0.0775618709, -0.0775618709, -0.0775618709, -0.0758382738, -0.0946687273, -0.1108311551, -0.0879343823, -0.1143761143, -0.1089455385, -0.1125820848, -0.7805826692, -0.0904934334, -3.3717696539, -0.0035395717, -0.0035395717, -0.0762022975, -0.1939694846, -0.1039122239, -0.1039122239, -0.0343699057, -0.1454771135, -0.1939694846, -0.0969847423, -0.0035395717, -0.0035126343, -0.0010774952, -0.0017886420, -0.0013630314, -0.0016270177, -0.0035126343, -0.0008081214, -0.0035126343, -0.0010774952, -0.0017886420, -0.0016270177, -0.0035126343, -0.0008081214, -0.0035395717, -0.0014815559, -0.0035395717, -0.0014815559, -0.0035395717, -0.0035395717, -1.5831239659, -2.1080971805, -1.5693351889, -1.1802848442, -2.1322275403, -2.1080971805, -1.5727823832, -0.0029631118, -0.0075424663, -0.0040406070, -0.0040406070, -0.0066373704, -0.0056568497, -0.0075424663, -0.0001346869, -0.0001346869, -0.0004053537, -0.0001346869, -0.0001000000, -0.0001185245, -0.0001346869, -0.0001346869, -0.0001346869, -0.0001346869, -0.0273208243, }; // int indices2[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 77, 78, 80, 81, 82, 83, 84, 89, 97, 101, 102, 103, 104, 105, 106, 107, 108, 113, 118, 119, 120, 121, 122, 123, 124, 126, 127, 128, 130, 131, 132, 137, 142, 145, 147, 153, 161, 165, 166, 167, 168, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, }; // struct Row row2 = {.nz = 138, .head = 0, .pi_zero = -1.0000000000, .pi = pi2, .indices = indices2 }; // // struct Row cut; // LP_init_row(&cut, 138); // // rval = INFINITY_generate_cut(&tableau, &cut); // abort_if(rval, "INFINITY_generate_cut failed"); // // EXPECT_EQ(cut.nz, row2.nz); // EXPECT_EQ(cut.head, row2.head); // EXPECT_EQ(cut.pi_zero, row2.pi_zero); // // for(int i = 0; i < cut.nz; i++) // { // EXPECT_NEAR(cut.pi[i], pi2[i], 1e-6); // EXPECT_EQ(cut.indices[i], indices2[i]); // } // // CLEANUP: // if(rval) FAIL(); //} //TEST(InfinityTest, generate_cut_test_2) //{ // int rval = 0; // // // Extracted from instance bell5.pre.mps (MIPLIB 3.0) // double pi0[] = { 1.0000000000, 0.0161105463, 0.0161105463, 0.0161105463, 0.0161105463, -0.0161105463, -0.0161105463, 0.0322210925, 0.0322210925, 0.0322210925, 0.0322210925, 0.0051991866, 0.0051991866, 0.0051991866, 0.0051991866, 0.0057745633, 0.0057745633, 0.0057745633, -0.0002166328, -0.0000239740, -0.0000239740, -0.0002406068, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -1.2888437009, -1.2888437009, -1.2888437009, -1.2888437009, -0.6444218504, 1.0000000000, -0.0322210925, -0.0322210925, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0000239740, -0.0000239740, -0.0002406068, -0.0002406068, -0.2888437009, }; // double pi1[] = { 0.5000000000, 1.0000000000, 0.0007440476, 0.0007440476, -0.0007440476, -0.0007440476, }; // double pi2[] = { 1.0000000000, 0.0161105463, 0.0161105463, 0.0161105463, 0.0161105463, -0.0161105463, -0.0161105463, 0.0322210925, 0.0322210925, 0.0322210925, 0.0322210925, 0.0051991866, 0.0051991866, 0.0051991866, 0.0051991866, 0.0057745633, 0.0057745633, 0.0057745633, -0.0002166328, -0.0000239740, -0.0000239740, -0.0002406068, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -1.2888437009, -1.2888437009, -1.2888437009, -1.2888437009, -0.6444218504, -0.0322210925, -0.0322210925, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0000239740, -0.0000239740, -0.0002406068, -0.0002406068, -0.2888437009, }; // int indices0[] = { 11, 12, 13, 14, 15, 16, 18, 26, 27, 28, 29, 40, 41, 42, 43, 51, 52, 53, 58, 59, 61, 62, 72, 74, 75, 78, 80, 94, 95, 96, 97, 99, 104, 109, 111, 119, 120, 121, 122, 123, 125, 133, 134, 135, 136, 144, 145, 146, 147, 148, 149, 150, 151, 153, 157, 158, 159, }; // int indices1[] = { 17, 31, 59, 72, 124, 152, }; // int indices2[] = { 0, 12, 13, 14, 15, 16, 18, 26, 27, 28, 29, 40, 41, 42, 43, 51, 52, 53, 58, 59, 61, 62, 72, 74, 75, 78, 80, 94, 95, 96, 97, 99, 109, 111, 119, 120, 121, 122, 123, 125, 133, 134, 135, 136, 144, 145, 146, 147, 148, 149, 150, 151, 153, 157, 158, 159, }; // struct Row row0 = {.nz = 57, .head = 104, .pi_zero = 0.1156189343, .pi = pi0, .indices = indices0 }; // struct Row row1 = {.nz = 6, .head = 31, .pi_zero = 0.0297619048, .pi = pi1, .indices = indices1 }; // struct Row row2 = {.nz = 56, .head = 0, .pi_zero = 0.1156189343, .pi = pi2, .indices = indices2 }; // struct Row* rows[] = {&row0, &row1, &row2, }; // 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; // struct Tableau tableau = {.ncols = 169, .nrows = 3, .rows = rows, .column_types = column_types }; // double x[169] = {1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 11.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 2.0000000000, 38.0000000000, 2.0000000000, 498.0000000000, 125.0000000000, 10.0000000000, 17.0000000000, 41.0000000000, 0.0000000000, 19.0000000000, 0.0000000000, 8318.0000000000, 7494.0000000000, 60.0000000000, 10.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 18.0000000000, 8.0000000000, 16.0000000000, 334.0000000000, 24.0000000000, 792.0000000000, 792.0000000000, 336.0000000000, 336.0000000000, 0.0000000000, 40.0000000000, 166.0000000000, 3000.0000000000, 1632.0000000000, 1392.0000000000, 984.0000000000, 456.0000000000, 456.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 48.0000000000, 900.0000000000, 40.0000000000, 11950.0000000000, 240.0000000000, 408.0000000000, 984.0000000000, 0.0000000000, 456.0000000000, 0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 20.0000000000, 20.0000000000, 20.0000000000, 19.0000000000, 19.0000000000, 0.0000000000, 9.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 20.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 238.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 12.0000000000, 8.0000000000, 2.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0053700000, 0.6917620000, 6.9221320000, 0.0000000000, 0.9966800000, 11.9862220000, 0.7510000000, 0.8495500000, 3.3519300000, 266583.5900000000, }; // // double lhs, s[3]; // struct MultiRowModel model; // struct TableauModelMap map; // // struct Row cut; // LP_init_row(&cut, CG_total_nz(&tableau)); // // rval = INFINITY_generate_cut(&tableau, &cut); // abort_if(rval, "INFINITY_generate_cut failed"); // //// rval = CG_init_model(&model, 3, 200); //// abort_if(rval, "CG_init_model failed"); //// //// rval = CG_init_map(&map, 200, 3); //// abort_if(rval, "CG_init_map failed"); //// //// rval = CG_extract_model(&tableau, &map, &model); //// abort_if(rval, "CG_extract_model failed"); //// //// rval = CG_extract_f_from_tableau(&tableau, model.f); //// abort_if(rval, "CG_extract_f_from_tableau failed"); //// //// memcpy(s, model.f, model.nrows * sizeof(double)); //// for(int i = 0; i < map.nvars; i++) //// { //// double *ray = LFREE_get_ray(&model.rays, map.variable_to_ray[i]); //// for(int j = 0; j < model.nrows; j++) //// s[j] += ray[j] * map.ray_scale[i] * x[map.indices[i]]; //// } //// //// for(int j = 0; j < model.nrows; j++) //// time_printf("s[%3d]=%.12lf\n", j, s[j]); // // lhs = CG_replace_x(&cut, x); // EXPECT_LE(lhs, cut.pi_zero); // //CLEANUP: // if(rval) FAIL(); //} //TEST(InfinityTest, generate_cut_test_3) //{ // int rval = 0; // // // Extracted from instance bell5.pre.mps (MIPLIB 3.0) // double pi0[] = { 0.0161105463, 0.0161105463, 0.0161105463, 0.0161105463, -0.0161105463, 0.0250000000, -0.0161105463, 0.0322210925, 0.0322210925, 0.0322210925, 0.0322210925, 0.0051991866, 0.0051991866, 0.0051991866, 0.0051991866, 0.0057745633, 0.0057745633, 0.0057745633, -0.0002166328, -0.0000611764, -0.0000239740, -0.0002406068, -0.0000611764, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.2888437009, -0.2888437009, -0.2888437009, -0.2888437009, 1.0000000000, -0.6444218504, -0.0322210925, 0.0500000000, -0.0322210925, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, 0.0000372024, -0.0000239740, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0000239740, 0.0000372024, -0.0000239740, -0.0002406068, -0.0002406068, -0.2888437009, }; // double pi1[] = { 1.0000000000, -0.0250000000, 0.0000372024, 0.0000372024, -0.0500000000, -0.0000372024, -0.0000372024, }; // double pi2[] = { 1.0000000000, 0.0161105463, 0.0161105463, 0.0161105463, 0.0161105463, -0.0161105463, -0.0161105463, 0.0322210925, 0.0322210925, 0.0322210925, 0.0322210925, 0.0051991866, 0.0051991866, 0.0051991866, 0.0051991866, 0.0057745633, 0.0057745633, 0.0057745633, -0.0002166328, -0.0000239740, -0.0000239740, -0.0002406068, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.2888437009, -0.2888437009, -0.2888437009, -0.2888437009, -0.6444218504, -0.0322210925, -0.0322210925, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0000239740, -0.0000239740, -0.0002406068, -0.0002406068, -0.2888437009, }; // int indices0[] = { 12, 13, 14, 15, 16, 17, 18, 26, 27, 28, 29, 40, 41, 42, 43, 51, 52, 53, 58, 59, 61, 62, 72, 74, 75, 78, 80, 94, 95, 96, 97, 98, 99, 109, 110, 111, 119, 120, 121, 122, 123, 124, 125, 133, 134, 135, 136, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 157, 158, 159, }; // int indices1[] = { 5, 17, 59, 72, 110, 124, 152, }; // int indices2[] = { 4, 12, 13, 14, 15, 16, 18, 26, 27, 28, 29, 40, 41, 42, 43, 51, 52, 53, 58, 59, 61, 62, 72, 74, 75, 78, 80, 94, 95, 96, 97, 99, 109, 111, 119, 120, 121, 122, 123, 125, 133, 134, 135, 136, 144, 145, 146, 147, 148, 149, 150, 151, 153, 157, 158, 159, }; // struct Row row0 = {.nz = 60, .head = 98, .pi_zero = 0.1141308390, .pi = pi0, .indices = indices0 }; // struct Row row1 = {.nz = 7, .head = 5, .pi_zero = 0.0014880952, .pi = pi1, .indices = indices1 }; // struct Row row2 = {.nz = 56, .head = 4, .pi_zero = 0.1156189343, .pi = pi2, .indices = indices2 }; // struct Row* rows[] = {&row0, &row1, &row2, }; // 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; // struct Tableau tableau = {.ncols = 169, .nrows = 3, .rows = rows, .column_types = column_types }; // double x[169] = {1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 11.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 2.0000000000, 38.0000000000, 2.0000000000, 498.0000000000, 125.0000000000, 10.0000000000, 17.0000000000, 41.0000000000, 0.0000000000, 19.0000000000, 0.0000000000, 8318.0000000000, 7494.0000000000, 60.0000000000, 10.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 18.0000000000, 8.0000000000, 16.0000000000, 334.0000000000, 24.0000000000, 792.0000000000, 792.0000000000, 336.0000000000, 336.0000000000, 0.0000000000, 40.0000000000, 166.0000000000, 3000.0000000000, 1632.0000000000, 1392.0000000000, 984.0000000000, 456.0000000000, 456.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 48.0000000000, 900.0000000000, 40.0000000000, 11950.0000000000, 240.0000000000, 408.0000000000, 984.0000000000, 0.0000000000, 456.0000000000, 0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 20.0000000000, 20.0000000000, 20.0000000000, 19.0000000000, 19.0000000000, 0.0000000000, 9.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 20.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 238.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 12.0000000000, 8.0000000000, 2.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0053700000, 0.6917620000, 6.9221320000, 0.0000000000, 0.9966800000, 11.9862220000, 0.7510000000, 0.8495500000, 3.3519300000, 266583.5900000000, }; // // double lhs, s[3]; // struct MultiRowModel model; // struct TableauModelMap map; // // struct Row cut; // LP_init_row(&cut, CG_total_nz(&tableau)); // // rval = INFINITY_generate_cut(&tableau, &cut); // abort_if(rval, "INFINITY_generate_cut failed"); // // rval = CG_init_model(&model, 3, 200); // abort_if(rval, "CG_init_model failed"); // // rval = CG_init_map(&map, 200, 3); // abort_if(rval, "CG_init_map failed"); // // rval = CG_extract_model(&tableau, &map, &model); // abort_if(rval, "CG_extract_model failed"); // // rval = CG_extract_f_from_tableau(&tableau, model.f); // abort_if(rval, "CG_extract_f_from_tableau failed"); // // memcpy(s, model.f, model.nrows * sizeof(double)); // for(int i = 0; i < map.nvars; i++) // { // double *ray = LFREE_get_ray(&model.rays, map.variable_to_ray[i]); // for(int j = 0; j < model.nrows; j++) // s[j] += ray[j] * map.ray_scale[i] * x[map.indices[i]]; // } // // for(int j = 0; j < model.nrows; j++) // time_printf("s[%3d]=%.12lf\n", j, s[j]); // // lhs = CG_replace_x(&cut, x); // EXPECT_LE(lhs, cut.pi_zero); // //CLEANUP: // if(rval) FAIL(); //} int get_lattice_point(const struct Tableau *tableau, const double *x, double *s) { int rval = 0; struct MultiRowModel model; struct TableauModelMap map; int max_nrays = CG_total_nz(tableau); rval = CG_init_model(&model, tableau->nrows, max_nrays); abort_if(rval, "CG_init_model failed"); rval = CG_init_map(&map, max_nrays, tableau->nrows); abort_if(rval, "CG_init_map failed"); rval = CG_extract_model(tableau, &map, &model); abort_if(rval, "CG_extract_model failed"); rval = CG_extract_f_from_tableau(tableau, model.f); abort_if(rval, "CG_extract_f_from_tableau failed"); memcpy(s, model.f, model.nrows * sizeof(double)); for(int i = 0; i < map.nvars; i++) { double *ray = LFREE_get_ray(&model.rays, map.variable_to_ray[i]); for(int j = 0; j < model.nrows; j++) s[j] += ray[j] * map.ray_scale[i] * x[map.indices[i]]; } CLEANUP: CG_free_model(&model); CG_free_map(&map); return rval; } TEST(InfinityTest, generate_cut_test) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) double pi0[] = { 1.0000000000, -0.0250000000, 0.0000372024, 0.0000372024, -0.0500000000, -0.0000372024, -0.0000372024, }; double pi1[] = { 1.0000000000, 0.0161105463, 0.0161105463, 0.0161105463, 0.0161105463, -0.0161105463, -0.0161105463, 0.0322210925, 0.0322210925, 0.0322210925, 0.0322210925, 0.0051991866, 0.0051991866, 0.0051991866, 0.0051991866, 0.0057745633, 0.0057745633, 0.0057745633, -0.0002166328, -0.0000239740, -0.0000239740, -0.0002406068, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -1.2888437009, -1.2888437009, -1.2888437009, -1.2888437009, -0.6444218504, -0.0322210925, -0.0322210925, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002166328, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0002406068, -0.0000239740, -0.0000239740, -0.0002406068, -0.0002406068, -0.2888437009, }; int indices0[] = { 5, 17, 59, 72, 110, 124, 152, }; int indices1[] = { 0, 12, 13, 14, 15, 16, 18, 26, 27, 28, 29, 40, 41, 42, 43, 51, 52, 53, 58, 59, 61, 62, 72, 74, 75, 78, 80, 94, 95, 96, 97, 99, 109, 111, 119, 120, 121, 122, 123, 125, 133, 134, 135, 136, 144, 145, 146, 147, 148, 149, 150, 151, 153, 157, 158, 159, }; struct Row row0 = {.nz = 7, .head = 5, .pi_zero = 0.0014880952, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 56, .head = 0, .pi_zero = 0.1156189343, .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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; struct Tableau tableau = {.ncols = 169, .nrows = 2, .rows = rows, .column_types = column_types }; double x[169] = {1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 11.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 2.0000000000, 38.0000000000, 2.0000000000, 498.0000000000, 125.0000000000, 10.0000000000, 17.0000000000, 41.0000000000, 0.0000000000, 19.0000000000, 0.0000000000, 8318.0000000000, 7494.0000000000, 60.0000000000, 10.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 18.0000000000, 8.0000000000, 16.0000000000, 334.0000000000, 24.0000000000, 792.0000000000, 792.0000000000, 336.0000000000, 336.0000000000, 0.0000000000, 40.0000000000, 166.0000000000, 3000.0000000000, 1632.0000000000, 1392.0000000000, 984.0000000000, 456.0000000000, 456.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 48.0000000000, 900.0000000000, 40.0000000000, 11950.0000000000, 240.0000000000, 408.0000000000, 984.0000000000, 0.0000000000, 456.0000000000, 0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 20.0000000000, 20.0000000000, 20.0000000000, 19.0000000000, 19.0000000000, 0.0000000000, 9.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 20.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 238.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 12.0000000000, 8.0000000000, 2.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0053700000, 0.6917620000, 6.9221320000, 0.0000000000, 0.9966800000, 11.9862220000, 0.7510000000, 0.8495500000, 3.3519300000, 266583.5900000000, }; double lhs; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); lhs = CG_replace_x(&cut, x); EXPECT_LE(lhs, cut.pi_zero); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_2) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) double pi0[] = { 1.0000000000, 0.0416666667, -0.0416666667, -0.0416666667, -0.0416666667, -0.0416666667, }; double pi1[] = { 1.0000000000, -0.0250000000, 0.0000372024, 0.0000372024, -0.0500000000, -0.0000372024, -0.0000372024, }; int indices0[] = { 44, 58, 59, 60, 137, 151, }; int indices1[] = { 5, 17, 59, 72, 110, 124, 152, }; struct Row row0 = {.nz = 6, .head = 44, .pi_zero = 37.5000000000, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 7, .head = 5, .pi_zero = 0.0014880952, .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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; struct Tableau tableau = {.ncols = 169, .nrows = 2, .rows = rows, .column_types = column_types }; double x[169] = {1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 11.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 2.0000000000, 38.0000000000, 2.0000000000, 498.0000000000, 125.0000000000, 10.0000000000, 17.0000000000, 41.0000000000, 0.0000000000, 19.0000000000, 0.0000000000, 8318.0000000000, 7494.0000000000, 60.0000000000, 10.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 18.0000000000, 8.0000000000, 16.0000000000, 334.0000000000, 24.0000000000, 792.0000000000, 792.0000000000, 336.0000000000, 336.0000000000, 0.0000000000, 40.0000000000, 166.0000000000, 3000.0000000000, 1632.0000000000, 1392.0000000000, 984.0000000000, 456.0000000000, 456.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 48.0000000000, 900.0000000000, 40.0000000000, 11950.0000000000, 240.0000000000, 408.0000000000, 984.0000000000, 0.0000000000, 456.0000000000, 0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 20.0000000000, 20.0000000000, 20.0000000000, 19.0000000000, 19.0000000000, 0.0000000000, 9.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 20.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 238.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 12.0000000000, 8.0000000000, 2.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0053700000, 0.6917620000, 6.9221320000, 0.0000000000, 0.9966800000, 11.9862220000, 0.7510000000, 0.8495500000, 3.3519300000, 266583.5900000000, }; double lhs; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); lhs = CG_replace_x(&cut, x); EXPECT_LE(lhs, cut.pi_zero); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_3) { int rval = 0; double pi0[] = { 1.0000000000, 0.0416666667, -0.0416666667, -0.0416666667, -0.0416666667, }; double pi1[] = { 1.0000000000, -0.0250000000, 0.0000372024, 0.0000372024, -0.0500000000, -0.0000372024, }; int indices0[] = { 46, 60, 61, 139, 153, }; int indices1[] = { 7, 19, 61, 74, 112, 126, }; struct Row row0 = {.nz = 5, .head = 46, .pi_zero = 497.9166666667, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 6, .head = 7, .pi_zero = 0.1116071429, .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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, }; struct Tableau tableau = {.ncols = 169, .nrows = 2, .rows = rows, .column_types = column_types }; double x[169] = {1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 11.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 2.0000000000, 38.0000000000, 2.0000000000, 498.0000000000, 125.0000000000, 10.0000000000, 17.0000000000, 41.0000000000, 0.0000000000, 19.0000000000, 0.0000000000, 8318.0000000000, 7494.0000000000, 60.0000000000, 10.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 18.0000000000, 8.0000000000, 16.0000000000, 334.0000000000, 24.0000000000, 792.0000000000, 792.0000000000, 336.0000000000, 336.0000000000, 0.0000000000, 40.0000000000, 166.0000000000, 3000.0000000000, 1632.0000000000, 1392.0000000000, 984.0000000000, 456.0000000000, 456.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 48.0000000000, 900.0000000000, 40.0000000000, 11950.0000000000, 240.0000000000, 408.0000000000, 984.0000000000, 0.0000000000, 456.0000000000, 0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, -0.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 0.0000000000, 1.0000000000, 1.0000000000, 20.0000000000, 20.0000000000, 20.0000000000, 19.0000000000, 19.0000000000, 0.0000000000, 9.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 20.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 238.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 12.0000000000, 8.0000000000, 2.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0053700000, 0.6917620000, 6.9221320000, 0.0000000000, 0.9966800000, 11.9862220000, 0.7510000000, 0.8495500000, 3.3519300000, 266583.5900000000, }; double lhs, s[3]; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); lhs = CG_replace_x(&cut, x); EXPECT_LE(lhs, cut.pi_zero); 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]); CLEANUP: if (rval) FAIL(); }