diff --git a/infinity/benchmark/Makefile b/infinity/benchmark/Makefile index 23de3dd..4976c96 100644 --- a/infinity/benchmark/Makefile +++ b/infinity/benchmark/Makefile @@ -114,32 +114,32 @@ instances/%.done: $(multirow) 2row-cont/%.yaml 2row-lift/%.yaml 3row-cont/%.yaml 2row-cont/%.yaml: $(multirow) instances/%.mps.gz bases/%.bas @echo " 2row-cont $*..." - @$(multirow) --mir --greedy --problem instances/$*.mps.gz --basis bases/$*.bas --log 2row-cont/$*.log --stats $@ --solution solutions/$*.x || touch 2row-cont/$*.err.$$? + @$(multirow) --mir --infinity --problem instances/$*.mps.gz --basis bases/$*.bas --log 2row-cont/$*.log --stats $@ --solution solutions/$*.x || touch 2row-cont/$*.err.$$? @echo " 2row-cont $* [done]" 2row-lift/%.yaml: $(multirow) instances/%.mps.gz bases/%.bas @echo " 2row-lift $*..." - @$(multirow) --mir --greedy --problem instances/$*.mps.gz --basis bases/$*.bas --log 2row-lift/$*.log --stats $@ --solution solutions/$*.x --lift || touch 2row-lift/$*.err.$$? + @$(multirow) --mir --infinity --problem instances/$*.mps.gz --basis bases/$*.bas --log 2row-lift/$*.log --stats $@ --solution solutions/$*.x --lift || touch 2row-lift/$*.err.$$? @echo " 2row-lift $* [done]" 3row-cont/%.yaml: $(multirow) instances/%.mps.gz bases/%.bas @echo " 3row-cont $*..." - @$(multirow) --mir --greedy --problem instances/$*.mps.gz --basis bases/$*.bas --log 3row-cont/$*.log --stats $@ --solution solutions/$*.x --rows 3 || touch 3row-cont/$*.err.$$? + @$(multirow) --mir --infinity --problem instances/$*.mps.gz --basis bases/$*.bas --log 3row-cont/$*.log --stats $@ --solution solutions/$*.x --rows 3 || touch 3row-cont/$*.err.$$? @echo " 3row-cont $* [done]" 3row-lift/%.yaml: $(multirow) instances/%.mps.gz bases/%.bas @echo " 3row-lift $*..." - @$(multirow) --mir --greedy --problem instances/$*.mps.gz --basis bases/$*.bas --log 3row-lift/$*.log --stats $@ --solution solutions/$*.x --rows 3 --lift || touch 3row-lift/$*.err.$$? + @$(multirow) --mir --infinity --problem instances/$*.mps.gz --basis bases/$*.bas --log 3row-lift/$*.log --stats $@ --solution solutions/$*.x --rows 3 --lift || touch 3row-lift/$*.err.$$? @echo " 3row-lift $* [done]" 5row-cont/%.yaml: $(multirow) instances/%.mps.gz bases/%.bas @echo " 5row-cont $*..." - @$(multirow) --mir --greedy --problem instances/$*.mps.gz --basis bases/$*.bas --log 5row-cont/$*.log --stats $@ --solution solutions/$*.x --rows 5 || touch 5row-cont/$*.err.$$? + @$(multirow) --mir --infinity --problem instances/$*.mps.gz --basis bases/$*.bas --log 5row-cont/$*.log --stats $@ --solution solutions/$*.x --rows 5 || touch 5row-cont/$*.err.$$? @echo " 5row-cont $* [done]" 5row-lift/%.yaml: $(multirow) instances/%.mps.gz bases/%.bas @echo " 5row-lift $*..." - @$(multirow) --mir --greedy --problem instances/$*.mps.gz --basis bases/$*.bas --log 5row-lift/$*.log --stats $@ --solution solutions/$*.x --rows 5 --lift || touch 5row-lift/$*.err.$$? + @$(multirow) --mir --infinity --problem instances/$*.mps.gz --basis bases/$*.bas --log 5row-lift/$*.log --stats $@ --solution solutions/$*.x --rows 5 --lift || touch 5row-lift/$*.err.$$? @echo " 5row-lift $* [done]" diff --git a/infinity/benchmark/src/main.c b/infinity/benchmark/src/main.c index b69c88a..26aa3ac 100644 --- a/infinity/benchmark/src/main.c +++ b/infinity/benchmark/src/main.c @@ -36,7 +36,7 @@ int SHOULD_DUMP_CUTS = 0; int DUMP_CUT_N = 0; int GENERATE_MIR = 0; -int GENERATE_GREEDY = 0; +int GENERATE_INFINITY = 0; int KEEP_INTEGRALITY = 0; int N_ROUNDS = 1; @@ -63,7 +63,7 @@ static const struct option options_tab[] = {"problem", required_argument, 0, 'p'}, {"solution", required_argument, 0, 'x'}, {"mir", no_argument, 0, 'm'}, - {"greedy", no_argument, 0, 'g'}, + {"infinity", no_argument, 0, 'g'}, {"rounds", required_argument, 0, 'r'}, {"keep-integrality", no_argument, 0, 'k'}, {"write-solution", required_argument, 0, OPTION_WRITE_SOLUTION}, @@ -86,8 +86,8 @@ static void print_usage(char **argv) printf("%4s %-20s %s\n", "-b", "--basis=FILE", "BAS file containing an optimal basis for the linear relaxation of " "the problem"); - printf("%4s %-20s %s\n", "-g", "--greedy", - "generate greedy intersection cuts"); + printf("%4s %-20s %s\n", "-g", "--infinity", + "generate infinity cuts"); printf("%4s %-20s %s\n", "-k", "--keep-integrality", "do not relax integrality of variables"); printf("%4s %-20s %s\n", "-l", "--log=FILE", @@ -135,7 +135,7 @@ static int parse_args(int argc, break; case 'g': - GENERATE_GREEDY = 1; + GENERATE_INFINITY = 1; break; case 'k': @@ -207,7 +207,7 @@ static int parse_args(int argc, rval = 1; } - if (KEEP_INTEGRALITY && (GENERATE_GREEDY + GENERATE_MIR > 0)) + if (KEEP_INTEGRALITY && (GENERATE_INFINITY + GENERATE_MIR > 0)) { fprintf(stderr, "Cutting planes cannot be added when integrality is " "kept\n"); @@ -242,8 +242,7 @@ void print_header(int argc, time_printf("Compile-time parameters:\n"); time_printf(" EPSILON: %e\n", EPSILON); - time_printf(" GREEDY_BIG_E: %e\n", GREEDY_BIG_E); - time_printf(" GREEDY_MAX_GAP: %e\n", GREEDY_MAX_GAP); + time_printf(" INFINITY_BIG_E: %e\n", INFINITY_BIG_E); char cmdline[5000] = {0}; for (int i = 0; i < argc; i++) @@ -356,7 +355,7 @@ int main(int argc, abort_if(rval, "LP_write_basis failed"); } - if(GENERATE_MIR || GENERATE_GREEDY) + if(GENERATE_MIR || GENERATE_INFINITY) { cg = (struct CG *) malloc(sizeof(struct CG)); abort_if(!cg, "could not allocate cg"); @@ -409,11 +408,11 @@ int main(int argc, STATS_finish_round(); } - if (GENERATE_GREEDY) + if (GENERATE_INFINITY) { for(int k = MIN_N_ROWS; k <= MAX_N_ROWS; k++) { - log_info("Adding greedy intersection cuts (%d rows)...\n", k); + log_info("Adding infinity cuts (%d rows)...\n", k); rval = CG_add_multirow_cuts(cg, k, (MultiRowGeneratorCallback) INFINITY_generate_cut); diff --git a/infinity/library/src/infinity-2d.c b/infinity/library/src/infinity-2d.c index c3e8c55..3a43a01 100644 --- a/infinity/library/src/infinity-2d.c +++ b/infinity/library/src/infinity-2d.c @@ -545,7 +545,7 @@ int INFINITY_2D_generate_lfree(const struct MultiRowModel *model, lfree->rays.nrays = nrays; memcpy(rays, model->rays.values, 2 * nrays * sizeof(double)); memcpy(f, model->f, 2 * sizeof(double)); - for (int i = 0; i < nrays; i++) beta[i] = GREEDY_BIG_E; + for (int i = 0; i < nrays; i++) beta[i] = INFINITY_BIG_E; scale = (double*) malloc(nrays * sizeof(double)); abort_if(!scale, "could not allocate scale"); @@ -561,7 +561,7 @@ int INFINITY_2D_generate_lfree(const struct MultiRowModel *model, abort_if(count++ > 2 * nrays, "infinite loop"); - rval = get_bounding_box(2, nrays, rays, beta, GREEDY_BIG_E, lb, ub); + rval = get_bounding_box(2, nrays, rays, beta, INFINITY_BIG_E, lb, ub); abort_if(rval, "get_bounding_box failed"); log_verbose(" box=[%.2lf %.2lf] [%.2lf %.2lf]\n", lb[0], ub[0], lb[1], ub[1]); diff --git a/infinity/library/src/infinity-nd.c b/infinity/library/src/infinity-nd.c index 6203f38..1f4c90d 100644 --- a/infinity/library/src/infinity-nd.c +++ b/infinity/library/src/infinity-nd.c @@ -942,7 +942,7 @@ static int bound(int nrows, double prev_epsilon; int count = 0; - *epsilon = GREEDY_BIG_E; + *epsilon = INFINITY_BIG_E; rx = (int *) malloc(nrays * sizeof(int)); fbar = (double *) malloc(nrows * sizeof(double)); @@ -990,7 +990,7 @@ static int bound(int nrows, for(int i = 0; i < nrays; i++) tx[i] = 0; - if(DOUBLE_geq(*epsilon, GREEDY_BIG_E)) + if(DOUBLE_geq(*epsilon, INFINITY_BIG_E)) { *epsilon = INFINITY; goto CLEANUP; @@ -1245,7 +1245,7 @@ int INFINITY_ND_generate_lfree(const struct MultiRowModel *model, abort_if(!x, "could not allocate x"); for(int i = 0; i < nrays; i++) - beta[i] = GREEDY_BIG_E; + beta[i] = INFINITY_BIG_E; int it = 0; diff --git a/infinity/library/src/infinity.c b/infinity/library/src/infinity.c index ede040e..29e0aae 100644 --- a/infinity/library/src/infinity.c +++ b/infinity/library/src/infinity.c @@ -200,7 +200,7 @@ static int filter_model(const struct MultiRowModel *original_model, if(keep) LFREE_push_ray(filtered_rays, r); } - log_debug(" norm_cutoff=%8.2lf nrays=%8d\n", norm_cutoff, + log_verbose(" norm_cutoff=%8.2lf nrays=%8d\n", norm_cutoff, filtered_model->rays.nrays); if(filtered_rays->nrays < MAX_N_RAYS) break; @@ -452,4 +452,4 @@ CLEANUP: return rval; } -#endif // TEST_SOURCE +#endif // TEST_SOURCE \ No newline at end of file diff --git a/infinity/library/tests/infinity-2d-test.cpp b/infinity/library/tests/infinity-2d-test.cpp index 6d7a100..632ab18 100644 --- a/infinity/library/tests/infinity-2d-test.cpp +++ b/infinity/library/tests/infinity-2d-test.cpp @@ -80,7 +80,7 @@ TEST(Infinity2DTest, test_generate_cut_2) EXPECT_NEAR(0.5, lfree.beta[0], BOUNDS_EPSILON); EXPECT_NEAR(0.5, lfree.beta[1], BOUNDS_EPSILON); EXPECT_NEAR(0.5, lfree.beta[2], BOUNDS_EPSILON); - EXPECT_EQ(GREEDY_BIG_E, lfree.beta[3]); + EXPECT_EQ(INFINITY_BIG_E, lfree.beta[3]); EXPECT_NEAR(0.5, lfree.beta[4], BOUNDS_EPSILON); CLEANUP: @@ -102,7 +102,7 @@ TEST(Infinity2DTest, test_generate_cut_3) EXPECT_NEAR(5.0, lfree.beta[0], BOUNDS_EPSILON); EXPECT_NEAR(17.0, lfree.beta[2], BOUNDS_EPSILON); - EXPECT_EQ(GREEDY_BIG_E, lfree.beta[1]); + EXPECT_EQ(INFINITY_BIG_E, lfree.beta[1]); CLEANUP: if (rval) FAIL(); @@ -288,8 +288,8 @@ TEST(Infinity2DTest, find_containing_cone_test_3) // EXPECT_NEAR(20.0, bounds[1], BOUNDS_EPSILON); // EXPECT_NEAR(18.0, bounds[2], BOUNDS_EPSILON); // EXPECT_NEAR(18.0, bounds[5], BOUNDS_EPSILON); -// EXPECT_EQ(GREEDY_BIG_E, bounds[3]); -// EXPECT_EQ(GREEDY_BIG_E, bounds[4]); +// EXPECT_EQ(INFINITY_BIG_E, bounds[3]); +// EXPECT_EQ(INFINITY_BIG_E, bounds[4]); // // CLEANUP: // if (rval) FAIL(); @@ -314,8 +314,8 @@ TEST(Infinity2DTest, find_containing_cone_test_3) // EXPECT_NEAR(20.0, bounds[1], BOUNDS_EPSILON); // EXPECT_NEAR(18.0, bounds[2], BOUNDS_EPSILON); // EXPECT_NEAR(18.0, bounds[5], BOUNDS_EPSILON); -// EXPECT_EQ(GREEDY_BIG_E, bounds[3]); -// EXPECT_EQ(GREEDY_BIG_E, bounds[4]); +// EXPECT_EQ(INFINITY_BIG_E, bounds[3]); +// EXPECT_EQ(INFINITY_BIG_E, bounds[4]); // // CLEANUP: // if (rval) FAIL(); diff --git a/multirow/include/multirow/params.h b/multirow/include/multirow/params.h index 55be1bb..2d7e6f4 100644 --- a/multirow/include/multirow/params.h +++ b/multirow/include/multirow/params.h @@ -20,7 +20,7 @@ /* * Error margin for floating point comparisons. */ -#define EPSILON 1e-5 +#define EPSILON 1e-8 /* * Available log levels, in decreasing level of verboseness, are: @@ -66,11 +66,7 @@ #define MAX_SELECTED_ROWS 300 #define MAX_LATTICE_POINTS 100000 -/* - * Greedy cut parameters - */ -#define GREEDY_BIG_E 1e3 -#define GREEDY_MAX_GAP 1e-4 +#define INFINITY_BIG_E 1e3 #define MAX_CUT_DYNAMISM 1e8 #define INTEGRALITY_THRESHOLD 0.49 diff --git a/multirow/src/cg.c b/multirow/src/cg.c index 7266be5..a9dc228 100644 --- a/multirow/src/cg.c +++ b/multirow/src/cg.c @@ -801,7 +801,7 @@ int CG_add_multirow_cuts(struct CG *cg, row_affinity, &total_count, cutoff); abort_if(rval, "estimate_two_row_cuts_count failed"); - log_debug(" %8d combinations [%.2lf]\n", total_count, cutoff); + log_verbose(" %8d combinations [%.2lf]\n", total_count, cutoff); if (total_count < MAX_SELECTED_COMBINATIONS) { @@ -884,7 +884,7 @@ int CG_add_multirow_cuts(struct CG *cg, if_debug_level if (ONLY_CUT > 0 && count != ONLY_CUT) goto NEXT_COMBINATION; - if_debug_level + if_verbose_level { time_printf("Generating cut %d from [ ", count); for (int i = 0; i < nrows; i++) @@ -906,7 +906,7 @@ int CG_add_multirow_cuts(struct CG *cg, .column_types = cg->column_types }; - if_debug_level + if_verbose_level { char filename[100]; sprintf(filename, "tableau-%03ld.c", count); @@ -933,7 +933,7 @@ int CG_add_multirow_cuts(struct CG *cg, } else abort_iff(rval, "generate failed (cut %d)", count); - if_debug_level + if_verbose_level { char filename[100]; sprintf(filename, "cut-%03ld.c", count); @@ -943,7 +943,7 @@ int CG_add_multirow_cuts(struct CG *cg, } double elapsed_time = get_user_time() - initial_time; - log_debug(" generate: %.2lf ms\n", elapsed_time * 1000); + log_verbose(" generate: %.2lf ms\n", elapsed_time * 1000); double dynamism; rval = cut_dynamism(&cut, &dynamism); @@ -951,7 +951,7 @@ int CG_add_multirow_cuts(struct CG *cg, if (dynamism > MAX_CUT_DYNAMISM) { - log_debug("Discarding cut (dynamism=%.2lf)\n", dynamism); + log_verbose("Discarding cut (dynamism=%.2lf)\n", dynamism); LP_free_row(&cut); goto NEXT_COMBINATION; } diff --git a/multirow/tests/geometry-test.cpp b/multirow/tests/geometry-test.cpp index 2e88ea6..f00109b 100644 --- a/multirow/tests/geometry-test.cpp +++ b/multirow/tests/geometry-test.cpp @@ -485,7 +485,7 @@ TEST(GeometryTest, chull_2d_test) // // EXPECT_DOUBLE_EQ(0.5, bounds[0]); // EXPECT_DOUBLE_EQ(0.5, bounds[1]); -// EXPECT_EQ(GREEDY_BIG_E, bounds[2]); +// EXPECT_EQ(INFINITY_BIG_E, bounds[2]); // EXPECT_DOUBLE_EQ(0.5, bounds[3]); // EXPECT_DOUBLE_EQ(0.5, bounds[4]); //