@@ -191,7 +191,6 @@ two vertices adj iif:
191
191
*/
192
192
193
193
static inline int is_2_adj (int marked_node ,int test_node ){
194
- int adj = 0 , comneibor = 0 ;
195
194
for_each_neighbor (test_node ,neibor ){
196
195
if (neibor == marked_node ){
197
196
if (!(branched (test_node ) && branched (marked_node )))
@@ -534,7 +533,6 @@ static int partition_free_vertices(){
534
533
}
535
534
536
535
static inline void clear_iset (int isetno ,int insert_node ){
537
- int marked_count = 0 ;
538
536
int involved = involved (insert_node );
539
537
USED (TMP_STK )= 0 ;
540
538
for_each_vec_item (iSET [isetno ],int ,it ){
@@ -570,7 +568,6 @@ static inline void clear_iset(int isetno,int insert_node){
570
568
static int improve_partition (int maxlb ,int target ){
571
569
for (int i = SUB_PROBLEM_SIZE - 1 ;i >=CUR_UND_IDX ;i -- ){
572
570
int node = CFG [i ];
573
- int inserted = 0 ;
574
571
575
572
set_marked_status (node );
576
573
for_each_neighbor (node ,neibor ){
@@ -634,7 +631,6 @@ static int repartition_vertices(int maxlb){
634
631
set_marked_status (neibor );
635
632
}
636
633
637
- int inserted = 0 ;
638
634
for (int j = isno (node )+ 1 ;j < MAXIS ;j ++ ){
639
635
if (USED (iSET [j ])== 0 ){
640
636
break ;
@@ -861,7 +857,7 @@ static int dominated_number(int bnode){
861
857
}
862
858
863
859
int max_dominated_number (){
864
- int max_count = 0 , max_idx = -1 ;
860
+ int max_count = 0 ;
865
861
for (int i = CUR_BRA_IDX ,bnode = BNODE (i );bnode != NONE ;bnode = BNODE (++ i )){
866
862
int count = dominated_number (bnode );
867
863
if (count > max_count )
@@ -1382,16 +1378,6 @@ void solve_subproblems(){
1382
1378
}while (ptr < end );
1383
1379
}
1384
1380
1385
- static void print_final_solution (char * inst ){
1386
- printf ("--------------------------------\n" );
1387
- printf ("Solution: " );
1388
- for (size_t i = 0 ;i < USED (VEC_SOLUTION );i ++ ){
1389
- printf ("%d " ,ITEM (VEC_SOLUTION ,i ));
1390
- }
1391
- printf ("\n" );
1392
- printf (">>> %s |V| %d |E| %d FIXED %d INIT %d BEST %d TREE %llu TIME(s) %0.2lf\n" ,inst ,NB_NODE ,NB_EDGE ,NB_FIXED ,INIT_UPPER_BOUND ,USED (VEC_SOLUTION ),NB_TREE , get_utime ());
1393
- }
1394
-
1395
1381
// Define global variables
1396
1382
extern unsigned long long total_branches = 0 ;
1397
1383
extern unsigned long long pruned_branches = 0 ;
@@ -1513,6 +1499,43 @@ void check_consistance(){
1513
1499
1514
1500
1515
1501
void cleanup (){
1502
+
1503
+ // Free all allocated memory
1504
+ if (CFG != NULL ) {
1505
+ free (CFG );
1506
+ CFG = NULL ;
1507
+ }
1508
+ if (LOC != NULL ) {
1509
+ free (LOC );
1510
+ LOC = NULL ;
1511
+ }
1512
+ if (STATUS != NULL ) {
1513
+ free (STATUS );
1514
+ STATUS = NULL ;
1515
+ }
1516
+ if (PID != NULL ) {
1517
+ free (PID );
1518
+ PID = NULL ;
1519
+ }
1520
+ free_stack (BRA_STK );
1521
+ free_stack (FIX_STK );
1522
+ free_stack (TMP_STK );
1523
+ free_stack (ADJ_STK );
1524
+ free_stack (VEC_SOLUTION );
1525
+ free_stack (VEC_SUBGRAPHS );
1526
+
1527
+ for (int i = 0 ; i <= MAXIS ; i ++ ) {
1528
+ free_stack (iSET [i ]);
1529
+ }
1530
+
1531
+ if (ADJIDX != NULL ) {
1532
+ free (ADJIDX );
1533
+ ADJIDX = NULL ;
1534
+ }
1535
+
1536
+
1537
+
1538
+ free_block ();
1516
1539
// Reset all global variables
1517
1540
BLOCK_COUNT = 0 ;
1518
1541
NB_NODE = 0 ;
@@ -1541,59 +1564,6 @@ void cleanup(){
1541
1564
CUT_OFF = 0 ;
1542
1565
BEST_SOL_TIME = 0 ;
1543
1566
instance [0 ] = '\0' ;
1544
-
1545
- // Free all allocated memory
1546
- if (CFG != NULL ) {
1547
- free (CFG );
1548
- CFG = NULL ;
1549
- }
1550
- if (LOC != NULL ) {
1551
- free (LOC );
1552
- LOC = NULL ;
1553
- }
1554
- if (STATUS != NULL ) {
1555
- free (STATUS );
1556
- STATUS = NULL ;
1557
- }
1558
- if (PID != NULL ) {
1559
- free (PID );
1560
- PID = NULL ;
1561
- }
1562
- if (BRA_STK != NULL ) {
1563
- free (BRA_STK );
1564
- BRA_STK = NULL ;
1565
- }
1566
- if (FIX_STK != NULL ) {
1567
- free (FIX_STK );
1568
- FIX_STK = NULL ;
1569
- }
1570
- if (TMP_STK != NULL ) {
1571
- free (TMP_STK );
1572
- TMP_STK = NULL ;
1573
- }
1574
- if (ADJ_STK != NULL ) {
1575
- free (ADJ_STK );
1576
- ADJ_STK = NULL ;
1577
- }
1578
- if (ADJIDX != NULL ) {
1579
- free (ADJIDX );
1580
- ADJIDX = NULL ;
1581
- }
1582
- if (VEC_SOLUTION != NULL ) {
1583
- free (VEC_SOLUTION );
1584
- VEC_SOLUTION = NULL ;
1585
- }
1586
- if (VEC_SUBGRAPHS != NULL ) {
1587
- free (VEC_SUBGRAPHS );
1588
- VEC_SUBGRAPHS = NULL ;
1589
- }
1590
-
1591
- for (int i = 0 ; i <= MAXIS ; i ++ ) {
1592
- if (iSET [i ] != NULL ) {
1593
- free (iSET [i ]);
1594
- iSET [i ] = NULL ;
1595
- }
1596
- }
1597
1567
}
1598
1568
1599
1569
0 commit comments