Rename greedy to infinity

This commit is contained in:
2017-04-30 18:03:18 -04:00
parent 0ee68e01bc
commit 7142eb2d68
9 changed files with 38 additions and 43 deletions

View File

@@ -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]"

View File

@@ -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);

View File

@@ -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]);

View File

@@ -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;

View File

@@ -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

View File

@@ -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();