@@ -215,26 +215,26 @@ BranchingScheme::Front BranchingScheme::front(
215
215
{
216
216
switch (insertion.df ) {
217
217
case -1 : case -2 : {
218
- return {. i = last_bin (node, insertion.df ), . o = last_bin_orientation (node, insertion.df ),
219
- . x1_prev = 0 , . x3_curr = insertion.x3 , . x1_curr = insertion.x1 ,
220
- . y2_prev = 0 , . y2_curr = insertion.y2 };
218
+ return {last_bin (node, insertion.df ), last_bin_orientation (node, insertion.df ),
219
+ 0 , insertion.x3 , insertion.x1 ,
220
+ 0 , insertion.y2 };
221
221
} case 0 : {
222
- return {. i = last_bin (node, insertion.df ), . o = last_bin_orientation (node, insertion.df ),
223
- . x1_prev = node.x1_curr , . x3_curr = insertion.x3 , . x1_curr = insertion.x1 ,
224
- . y2_prev = 0 , . y2_curr = insertion.y2 };
222
+ return {last_bin (node, insertion.df ), last_bin_orientation (node, insertion.df ),
223
+ node.x1_curr , insertion.x3 , insertion.x1 ,
224
+ 0 , insertion.y2 };
225
225
} case 1 : {
226
- return {. i = last_bin (node, insertion.df ), . o = last_bin_orientation (node, insertion.df ),
227
- . x1_prev = node.x1_prev , . x3_curr = insertion.x3 , . x1_curr = insertion.x1 ,
228
- . y2_prev = node.y2_curr , . y2_curr = insertion.y2 };
226
+ return {last_bin (node, insertion.df ), last_bin_orientation (node, insertion.df ),
227
+ node.x1_prev , insertion.x3 , insertion.x1 ,
228
+ node.y2_curr , insertion.y2 };
229
229
} case 2 : {
230
- return {. i = last_bin (node, insertion.df ), . o = last_bin_orientation (node, insertion.df ),
231
- . x1_prev = node.x1_prev , . x3_curr = insertion.x3 , . x1_curr = insertion.x1 ,
232
- . y2_prev = node.y2_prev , . y2_curr = insertion.y2 };
230
+ return {last_bin (node, insertion.df ), last_bin_orientation (node, insertion.df ),
231
+ node.x1_prev , insertion.x3 , insertion.x1 ,
232
+ node.y2_prev , insertion.y2 };
233
233
} default : {
234
234
assert (false );
235
- return {. i = -1 , . o = CutOrientation::Vertical,
236
- . x1_prev = -1 , . x3_curr = -1 , . x1_curr = -1 ,
237
- . y2_prev = -1 , . y2_curr = -1 };
235
+ return {-1 , CutOrientation::Vertical,
236
+ -1 , -1 , -1 ,
237
+ -1 , -1 };
238
238
}
239
239
}
240
240
}
@@ -631,9 +631,9 @@ void BranchingScheme::insertion_1_item(
631
631
}
632
632
633
633
Insertion insertion {
634
- . j1 = j, . j2 = -1 , . df = df,
635
- . x1 = x, . y2 = y, . x3 = x,
636
- . x1_max = x1_max (father, df), . y2_max = y2_max (father, df, x), . z1 = 0 , . z2 = 0 };
634
+ j, -1 , df,
635
+ x, y, x,
636
+ x1_max (father, df), y2_max (father, df, x), 0 , 0 };
637
637
LOG (info, insertion << std::endl);
638
638
639
639
// Check defect intersection
@@ -693,9 +693,9 @@ void BranchingScheme::insertion_2_items(
693
693
}
694
694
695
695
Insertion insertion {
696
- . j1 = j1 , . j2 = j2, . df = df,
697
- . x1 = x, . y2 = y, . x3 = x,
698
- . x1_max = x1_max (father, df), . y2_max = y2_max (father, df, x), . z1 = 0 , . z2 = 2 };
696
+ j1 , j2, df,
697
+ x, y, x,
698
+ x1_max (father, df), y2_max (father, df, x), 0 , 2 };
699
699
LOG (info, insertion << std::endl);
700
700
701
701
update (father, insertions, insertion, info);
@@ -724,9 +724,9 @@ void BranchingScheme::insertion_defect(
724
724
}
725
725
726
726
Insertion insertion {
727
- . j1 = -1 , . j2 = -1 , . df = df,
728
- . x1 = x, . y2 = y, . x3 = x,
729
- . x1_max = x1_max (father, df), . y2_max = y2_max (father, df, x), . z1 = 1 , . z2 = 1 };
727
+ -1 , -1 , df,
728
+ x, y, x,
729
+ x1_max (father, df), y2_max (father, df, x), 1 , 1 };
730
730
LOG (info, insertion << std::endl);
731
731
732
732
update (father, insertions, insertion, info);
@@ -1388,11 +1388,8 @@ bool BranchingScheme::BranchingScheme::check(const std::vector<Solution::Node>&
1388
1388
1389
1389
Solution BranchingScheme::to_solution (
1390
1390
const Node& node,
1391
- const Solution& solution_dummy ) const
1391
+ const Solution&) const
1392
1392
{
1393
- (void )solution_dummy;
1394
- // std::cout << node << std::endl;
1395
-
1396
1393
// Get nodes, items and bins
1397
1394
std::vector<SolutionNode> nodes;
1398
1395
std::vector<NodeItem> items;
@@ -1412,17 +1409,17 @@ Solution BranchingScheme::to_solution(
1412
1409
1413
1410
SolutionNodeId id = (n->df >= 0 )? nodes.size () + 2 - n->df : nodes.size () + 2 ;
1414
1411
if (n->j1 != -1 )
1415
- items.push_back ({. j = n->j1 , . node = id});
1412
+ items.push_back ({n->j1 , id});
1416
1413
if (n->j2 != -1 )
1417
- items.push_back ({. j = n->j2 , . node = id});
1414
+ items.push_back ({n->j2 , id});
1418
1415
1419
1416
// Add new solution nodes
1420
1417
SolutionNodeId f = (n->df <= 0 )? -first_stage_orientations.size (): nodes_curr[n->df ];
1421
1418
Depth d = (n->df < 0 )? 0 : n->df ;
1422
1419
SolutionNodeId c = nodes.size () - 1 ;
1423
1420
do {
1424
1421
c++;
1425
- nodes.push_back ({. f = f });
1422
+ nodes.push_back ({f, - 1 });
1426
1423
f = c;
1427
1424
d++;
1428
1425
nodes_curr[d] = nodes.size () - 1 ;
@@ -1441,8 +1438,7 @@ Solution BranchingScheme::to_solution(
1441
1438
Length h = instance_.bin (i).height (o);
1442
1439
SolutionNodeId id = res.size ();
1443
1440
bins.push_back (id);
1444
- res.push_back ({.id = id, .f = -1 , .d = 0 , .i = i,
1445
- .l = 0 , .r = w, .b = 0 , .t = h, .children = {}, .j = -1 });
1441
+ res.push_back ({id, -1 , 0 , i, 0 , w, 0 , h, {}, -1 , false , -1 });
1446
1442
}
1447
1443
for (SolutionNodeId id = 0 ; id < (SolutionNodeId)nodes.size (); ++id) {
1448
1444
SolutionNodeId f = (nodes[id].f >= 0 )? nodes[id].f : bins[(-nodes[id].f )-1 ];
@@ -1479,23 +1475,23 @@ Solution BranchingScheme::to_solution(
1479
1475
res[c_last].r = res[f].r ;
1480
1476
} else {
1481
1477
SolutionNodeId id = res.size ();
1482
- res.push_back ({. id = id, . f = f,
1483
- . d = static_cast <Depth>(res[f].d +1 ), . i = res[f].i ,
1484
- . l = res[c_last].r , . r = res[f].r ,
1485
- . b = res[f].b , . t = res[f].t ,
1486
- . children = {}, . j = -1 });
1478
+ res.push_back ({id, f,
1479
+ static_cast <Depth>(res[f].d +1 ), res[f].i ,
1480
+ res[c_last].r , res[f].r ,
1481
+ res[f].b , res[f].t ,
1482
+ {}, - 1 , false , -1 });
1487
1483
res[f].children .push_back (id);
1488
1484
}
1489
1485
} else if ((res[f].d == 1 || res[f].d == 3 ) && res[f].t != res[c_last].t ) {
1490
1486
if (res[f].t - res[c_last].t < parameters_.min_waste ) {
1491
1487
res[c_last].t = res[f].t ;
1492
1488
} else {
1493
1489
SolutionNodeId id = res.size ();
1494
- res.push_back ({. id = id, . f = f,
1495
- . d = static_cast <Depth>(res[f].d +1 ), . i = res[f].i ,
1496
- . l = res[f].l , . r = res[f].r ,
1497
- . b = res[c_last].t , . t = res[f].t ,
1498
- . children = {}, . j = -1 });
1490
+ res.push_back ({id, f,
1491
+ static_cast <Depth>(res[f].d +1 ), res[f].i ,
1492
+ res[f].l , res[f].r ,
1493
+ res[c_last].t , res[f].t ,
1494
+ {}, - 1 , false , -1 });
1499
1495
res[f].children .push_back (id);
1500
1496
}
1501
1497
}
@@ -1523,33 +1519,33 @@ Solution BranchingScheme::to_solution(
1523
1519
res[id].l , res[id].r , res[id].b , res[id].b + t, i, o);
1524
1520
if (k == -1 ) { // First item of the third-level sub-plate
1525
1521
SolutionNodeId c1 = res.size ();
1526
- res.push_back ({. id = c1, . f = id,
1527
- . d = static_cast <Depth>(res[id].d + 1 ), . i = res[id].i ,
1528
- . l = res[id].l , . r = res[id].r ,
1529
- . b = res[id].b , . t = res[id].b + t,
1530
- . children = {}, . j = j });
1522
+ res.push_back ({c1, id,
1523
+ static_cast <Depth>(res[id].d + 1 ), res[id].i ,
1524
+ res[id].l , res[id].r ,
1525
+ res[id].b , res[id].b + t,
1526
+ {}, j, false , - 1 });
1531
1527
res[id].children .push_back (c1);
1532
1528
SolutionNodeId c2 = res.size ();
1533
- res.push_back ({. id = c2, . f = id,
1534
- . d = static_cast <Depth>(res[id].d +1 ), . i = res[id].i ,
1535
- . l = res[id].l , . r = res[id].r ,
1536
- . b = res[id].b + t, . t = res[id].t ,
1537
- . children = {}, . j = -1 });
1529
+ res.push_back ({c2, id,
1530
+ static_cast <Depth>(res[id].d +1 ), res[id].i ,
1531
+ res[id].l , res[id].r ,
1532
+ res[id].b + t, res[id].t ,
1533
+ {}, - 1 , false , -1 });
1538
1534
res[id].children .push_back (c2);
1539
1535
} else {
1540
1536
SolutionNodeId c1 = res.size ();
1541
- res.push_back ({. id = c1, . f = id,
1542
- . d = static_cast <Depth>(res[id].d +1 ), . i = res[id].i ,
1543
- . l = res[id].l , . r = res[id].r ,
1544
- . b = res[id].b , . t = res[id].t - t,
1545
- . children = {}, . j = -1 });
1537
+ res.push_back ({c1, id,
1538
+ static_cast <Depth>(res[id].d +1 ), res[id].i ,
1539
+ res[id].l , res[id].r ,
1540
+ res[id].b , res[id].t - t,
1541
+ {}, - 1 , false , -1 });
1546
1542
res[id].children .push_back (c1);
1547
1543
SolutionNodeId c2 = res.size ();
1548
- res.push_back ({. id = c2, . f = id,
1549
- . d = static_cast <Depth>(res[id].d +1 ), . i = res[id].i ,
1550
- . l = res[id].l , . r = res[id].r ,
1551
- . b = res[id].t - t, . t = res[id].t ,
1552
- . children = {}, . j = j });
1544
+ res.push_back ({c2, id,
1545
+ static_cast <Depth>(res[id].d +1 ), res[id].i ,
1546
+ res[id].l , res[id].r ,
1547
+ res[id].t - t, res[id].t ,
1548
+ {}, j, false , - 1 });
1553
1549
res[id].children .push_back (c2);
1554
1550
}
1555
1551
}
0 commit comments