Handle instances without reduced costs
This commit is contained in:
@@ -284,7 +284,8 @@ void WedgeCutGenerator::eval_next()
|
|||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
if (0 <= cur_facet && cur_facet < (int) knapsack.list.size() && cur_facet <= MAX_CUT_DEPTH)
|
if (0 <= cur_facet && cur_facet < (int) knapsack.list.size() &&
|
||||||
|
cur_facet <= MAX_CUT_DEPTH)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
r1_offset++;
|
r1_offset++;
|
||||||
@@ -296,7 +297,7 @@ void WedgeCutGenerator::eval_next()
|
|||||||
}
|
}
|
||||||
|
|
||||||
int r1_index = row.c.pi.index(r1_offset);
|
int r1_index = row.c.pi.index(r1_offset);
|
||||||
if(row.reduced_costs[r1_index] < row.cost_cutoff)
|
if (row.reduced_costs && row.reduced_costs[r1_index] < row.cost_cutoff)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
r1[0] = -row.c.pi.value(r1_offset).reduce(REDUCE_FACTOR_R1);
|
r1[0] = -row.c.pi.value(r1_offset).reduce(REDUCE_FACTOR_R1);
|
||||||
|
|||||||
@@ -125,6 +125,7 @@ TEST(WedgeCutGenerator, generate_test_1)
|
|||||||
r.c.pi.push(1, rational(-1));
|
r.c.pi.push(1, rational(-1));
|
||||||
r.c.pi.push(2, rational(1));
|
r.c.pi.push(2, rational(1));
|
||||||
r.c.pi_zero = rational(5,7);
|
r.c.pi_zero = rational(5,7);
|
||||||
|
r.reduced_costs = 0;
|
||||||
|
|
||||||
std::set<Constraint> expected_cuts;
|
std::set<Constraint> expected_cuts;
|
||||||
rational cut_matrix[] = {
|
rational cut_matrix[] = {
|
||||||
@@ -176,6 +177,7 @@ TEST(WedgeCutGenerator, generate_test_2)
|
|||||||
r.c.pi.push(1, rational(-1));
|
r.c.pi.push(1, rational(-1));
|
||||||
r.c.pi.push(2, rational(1));
|
r.c.pi.push(2, rational(1));
|
||||||
r.c.pi_zero = rational(1,2);
|
r.c.pi_zero = rational(1,2);
|
||||||
|
r.reduced_costs = 0;
|
||||||
|
|
||||||
set<Constraint> expected_cuts;
|
set<Constraint> expected_cuts;
|
||||||
rational cut_matrix[] = {
|
rational cut_matrix[] = {
|
||||||
@@ -236,6 +238,7 @@ TEST(WedgeCutGenerator, generate_test_3)
|
|||||||
r.c.pi.push(12, rational(237478,39665));
|
r.c.pi.push(12, rational(237478,39665));
|
||||||
r.c.pi.push(13, rational(237478,39665));
|
r.c.pi.push(13, rational(237478,39665));
|
||||||
r.c.pi_zero = rational(631975,707651);
|
r.c.pi_zero = rational(631975,707651);
|
||||||
|
r.reduced_costs = 0;
|
||||||
|
|
||||||
rational solution[14];
|
rational solution[14];
|
||||||
solution[0] = rational(0);
|
solution[0] = rational(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user