You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
multirow/infinity/library/tests/infinity-test.cpp

611 lines
66 KiB

/* 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 <http://www.gnu.org/licenses/>.
*/
#include <gtest/gtest.h>
#define TEST_SOURCE
extern "C" {
#include <multirow/cg.h>
#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();
}
TEST(InfinityTest, generate_cut_test_13)
{
int rval = 0;
// Extracted from instance bell3a.pre.mps (MIPLIB 3)
double pi0[] = { 1.0000000000, -0.0250000000, 0.0000372024, -0.0000372024, 0.0000372024, -0.0000372024, 1.0000000000, -1.0000000000, -1.0000000000, -0.0500000000, -0.0000372024, -0.0000372024, };
double pi1[] = { 1.0000000000, 0.0416666667, -0.0416666667, -0.0416666667, };
double pi2[] = { -0.5000000000, 1.0000000000, 1.0000000000, 0.0007440476, -0.0007440476, 0.0007440476, -0.0007440476, 20.0000000000, -20.0000000000, -20.0000000000, 20.0000000000, -1.0000000000, 1.0000000000, -0.0007440476, -0.0007440476, };
int indices0[] = { 7, 22, 67, 68, 82, 83, 106, 107, 108, 121, 134, 166, };
int indices1[] = { 52, 68, 151, 167, };
int indices2[] = { 22, 24, 37, 67, 68, 82, 83, 104, 107, 108, 110, 121, 123, 134, 166, };
struct Row row0 = {.nz = 12, .head = 106, .pi_zero = 0.0055803571, .pi = pi0, .indices = indices0 };
struct Row row1 = {.nz = 4, .head = 52, .pi_zero = 1.2500000000, .pi = pi1, .indices = indices1 };
struct Row row2 = {.nz = 15, .head = 37, .pi_zero = 0.1116071429, .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, 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, 0, 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, 1, 1, 1, 1, 1, 1, 1, 1, };
struct Tableau tableau = {.ncols = 183, .nrows = 3, .rows = rows, .column_types = column_types };
double x[183] = {-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.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.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 4.0000000000, 21.0000000000, 0.0000000000, 0.0000000000, 4.0000000000, 4.0000000000, 6.0000000000, 1.0000000000, 25.0000000000, 8.0000000000, 1112.0000000000, 1012.0000000000, 962.0000000000, 762.0000000000, 752.0000000000, 222.0000000000, 72.0000000000, 10.0000000000, 514.0000000000, 214.0000000000, 4.0000000000, 16.0000000000, 12.0000000000, 6.0000000000, 0.0000000000, 8.0000000000, 1748.0000000000, 1748.0000000000, 1748.0000000000, 1748.0000000000, 1748.0000000000, 1388.0000000000, 788.0000000000, 500.0000000000, 96.0000000000, 96.0000000000, 264.0000000000, 168.0000000000, 24.0000000000, 600.0000000000, 192.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 96.0000000000, 0.0000000000, 0.0000000000, 96.0000000000, 144.0000000000, 24.0000000000, 600.0000000000, 192.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.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.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 4.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.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.0000000000, 0.9286200000, 0.0119200000, 1.0535700000, 0.2201700000, 0.2285000000, 1.8746200000, 0.8137700000, 1.9647600000, 1.9760600000, 1.9930100000, 0.9502000000, 1.9774000000, 4055.1500000000, };
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_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();
}