/* 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(); } 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(); } TEST(InfinityTest, generate_cut_test_4) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) double pi0[] = { 0.5000000000, 1.0000000000, 0.0007440476, 0.0007440476, -0.0007440476, -0.0007440476, }; double pi1[] = { 1.0000000000, -0.0250000000, 0.0000372024, 0.0000372024, -0.0500000000, -0.0000372024, -0.0000372024, }; int indices0[] = { 22, 36, 64, 77, 129, 156, }; int indices1[] = { 8, 22, 64, 77, 115, 129, 156, }; struct Row row0 = {.nz = 6, .head = 36, .pi_zero = 0.7440476190, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 7, .head = 8, .pi_zero = 0.0372023810, .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[2]; 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 = 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); EXPECT_LE(lhs, cut.pi_zero); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_5) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) 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, }; double pi0[] = { 1.0000000000, 0.0416666667, -0.0416666667, -0.0416666667, }; double pi1[] = { 1.0000000000, 0.0416666667, -0.0416666667, -0.0416666667, -0.0416666667, }; int indices0[] = { 50, 64, 143, 156, }; int indices1[] = { 49, 63, 64, 142, 155, }; struct Row row0 = {.nz = 4, .head = 50, .pi_zero = 41.6666666667, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 5, .head = 49, .pi_zero = 16.6666666667, .pi = pi1, .indices = indices1 }; struct Row* rows[] = {&row0, &row1, }; 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[2]; 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 = 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); EXPECT_LE(lhs, cut.pi_zero); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_6) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) 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, }; 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, }; 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* 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 }; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_7) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) double pi0[] = { 0.0161105463, 0.0161105463, 0.0161105463, 0.0161105463, -0.0161105463, -0.0161105463, 0.0250000000, 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.0000611764, -0.0002406068, -0.0000239740, -0.0000611764, -0.0000239740, -0.0000239740, -0.0000239740, -0.2888437009, -0.2888437009, -0.2888437009, -0.2888437009, 0.3555781496, 1.0000000000, -0.0322210925, -0.0322210925, 0.0500000000, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, -0.0000239740, 0.0000372024, -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[] = { 1.0000000000, -0.0250000000, 0.0000372024, 0.0000372024, -0.0500000000, -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, -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[] = { 12, 13, 14, 15, 16, 18, 19, 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, 100, 109, 111, 112, 119, 120, 121, 122, 123, 125, 126, 133, 134, 135, 136, 144, 145, 146, 147, 148, 149, 150, 151, 153, 157, 158, 159, }; int indices1[] = { 7, 19, 61, 74, 112, 126, }; 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 = 59, .head = 100, .pi_zero = 0.0040117914, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 6, .head = 7, .pi_zero = 0.1116071429, .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 }; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_8) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) double pi0[] = { 1.0000000000, 0.0416666667, -0.0416666667, -0.0416666667, -0.0416666667, }; double pi1[] = { 0.3222109252, 0.3222109252, 0.3222109252, 0.3222109252, 0.6777890748, -0.3222109252, 0.6444218504, 0.6444218504, 0.6444218504, 0.6444218504, 1.0000000000, 0.1039837323, 0.1039837323, 0.1039837323, 0.1039837323, 0.1154912654, 0.1154912654, 0.1154912654, -0.0043326555, -0.0004794805, -0.0004794805, -0.0048121361, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -5.7768740179, -5.7768740179, -5.7768740179, -5.7768740179, -12.8884370090, 0.3555781496, -0.6444218504, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0043326555, -0.0043326555, -0.0043326555, -0.0043326555, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0004794805, -0.0004794805, -0.0048121361, -0.0048121361, -5.7768740179, }; int indices0[] = { 46, 60, 61, 139, 153, }; int indices1[] = { 12, 13, 14, 15, 16, 18, 26, 27, 28, 29, 30, 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 = 5, .head = 46, .pi_zero = 497.9166666667, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 56, .head = 30, .pi_zero = 2.3123786856, .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 }; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_9) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) 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, -0.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[] = { 1.0000000000, -0.0250000000, 0.0000372024, 0.0000372024, -0.0500000000, -0.0000372024, }; int indices0[] = { 9, 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, 102, 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[] = { 7, 19, 61, 74, 112, 126, }; struct Row row0 = {.nz = 57, .head = 102, .pi_zero = 0.1156189343, .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 }; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_10) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) double pi0[] = { 1.3222109252, 0.3222109252, 0.3222109252, 0.3222109252, -0.3222109252, -0.3222109252, 1.6444218504, 0.6444218504, 0.6444218504, 0.6444218504, 0.1039837323, 0.1039837323, 0.1039837323, 0.1039837323, 0.1154912654, 0.1154912654, 0.1154912654, -0.0043326555, -0.0004794805, -0.0004794805, -0.0048121361, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -25.7768740179, -25.7768740179, -25.7768740179, -25.7768740179, -12.8884370090, 1.0000000000, -0.6444218504, -0.6444218504, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0043326555, -0.0043326555, -0.0043326555, -0.0043326555, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0004794805, -0.0004794805, -0.0048121361, -0.0048121361, -5.7768740179, }; double pi1[] = { 1.0000000000, -0.0250000000, 0.0000372024, 0.0000372024, -0.0500000000, -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, -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[] = { 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, 105, 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[] = { 7, 19, 61, 74, 112, 126, }; 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 = 56, .head = 105, .pi_zero = 2.3123786856, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 6, .head = 7, .pi_zero = 0.1116071429, .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 }; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_11) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) double pi0[] = { 0.3222109252, 1.3222109252, 0.3222109252, 0.3222109252, -0.3222109252, -0.3222109252, 0.6444218504, 1.6444218504, 0.6444218504, 0.6444218504, 0.1039837323, 0.1039837323, 0.1039837323, 0.1039837323, 0.1154912654, 0.1154912654, 0.1154912654, -0.0043326555, -0.0004794805, -0.0004794805, -0.0048121361, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -5.7768740179, -25.7768740179, -25.7768740179, -25.7768740179, -12.8884370090, 1.0000000000, -0.6444218504, -0.6444218504, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0043326555, -0.0043326555, -0.0043326555, -0.0043326555, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0004794805, -0.0004794805, -0.0048121361, -0.0048121361, -5.7768740179, }; double pi1[] = { 1.0000000000, -0.0250000000, 0.0000372024, 0.0000372024, -0.0500000000, -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, -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[] = { 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, 106, 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[] = { 7, 19, 61, 74, 112, 126, }; 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 = 56, .head = 106, .pi_zero = 2.3123786856, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 6, .head = 7, .pi_zero = 0.1116071429, .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 }; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); CLEANUP: if (rval) FAIL(); } TEST(InfinityTest, generate_cut_test_12) { int rval = 0; // Extracted from instance bell5.pre.mps (MIPLIB 3) double pi0[] = { 0.3222109252, 1.3222109252, 0.3222109252, 0.3222109252, -0.3222109252, -0.3222109252, 0.6444218504, 1.6444218504, 0.6444218504, 0.6444218504, 0.1039837323, 0.1039837323, 0.1039837323, 0.1039837323, 0.1154912654, 0.1154912654, 0.1154912654, -0.0043326555, -0.0004794805, -0.0004794805, -0.0048121361, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -5.7768740179, -25.7768740179, -25.7768740179, -25.7768740179, -12.8884370090, 1.0000000000, -0.6444218504, -0.6444218504, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0004794805, -0.0043326555, -0.0043326555, -0.0043326555, -0.0043326555, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0048121361, -0.0004794805, -0.0004794805, -0.0048121361, -0.0048121361, -5.7768740179, }; 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, -0.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, }; 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[] = { 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, 106, 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[] = { 1, 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, }; 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 = 56, .head = 106, .pi_zero = 2.3123786856, .pi = pi0, .indices = indices0 }; struct Row row1 = {.nz = 56, .head = 1, .pi_zero = 0.1156189343, .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 }; struct Row cut; LP_init_row(&cut, CG_total_nz(&tableau)); rval = INFINITY_generate_cut(&tableau, &cut); abort_if(rval, "INFINITY_generate_cut failed"); CLEANUP: if (rval) FAIL(); }