@@ -191,7 +191,6 @@ two vertices adj iif:
191191*/
192192
193193static inline int is_2_adj (int marked_node ,int test_node ){
194- int adj = 0 , comneibor = 0 ;
195194 for_each_neighbor (test_node ,neibor ){
196195 if (neibor == marked_node ){
197196 if (!(branched (test_node ) && branched (marked_node )))
@@ -534,7 +533,6 @@ static int partition_free_vertices(){
534533}
535534
536535static inline void clear_iset (int isetno ,int insert_node ){
537- int marked_count = 0 ;
538536 int involved = involved (insert_node );
539537 USED (TMP_STK )= 0 ;
540538 for_each_vec_item (iSET [isetno ],int ,it ){
@@ -570,7 +568,6 @@ static inline void clear_iset(int isetno,int insert_node){
570568static int improve_partition (int maxlb ,int target ){
571569 for (int i = SUB_PROBLEM_SIZE - 1 ;i >=CUR_UND_IDX ;i -- ){
572570 int node = CFG [i ];
573- int inserted = 0 ;
574571
575572 set_marked_status (node );
576573 for_each_neighbor (node ,neibor ){
@@ -634,7 +631,6 @@ static int repartition_vertices(int maxlb){
634631 set_marked_status (neibor );
635632 }
636633
637- int inserted = 0 ;
638634 for (int j = isno (node )+ 1 ;j < MAXIS ;j ++ ){
639635 if (USED (iSET [j ])== 0 ){
640636 break ;
@@ -861,7 +857,7 @@ static int dominated_number(int bnode){
861857}
862858
863859int max_dominated_number (){
864- int max_count = 0 , max_idx = -1 ;
860+ int max_count = 0 ;
865861 for (int i = CUR_BRA_IDX ,bnode = BNODE (i );bnode != NONE ;bnode = BNODE (++ i )){
866862 int count = dominated_number (bnode );
867863 if (count > max_count )
@@ -1382,16 +1378,6 @@ void solve_subproblems(){
13821378 }while (ptr < end );
13831379}
13841380
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-
13951381// Define global variables
13961382extern unsigned long long total_branches = 0 ;
13971383extern unsigned long long pruned_branches = 0 ;
@@ -1513,6 +1499,43 @@ void check_consistance(){
15131499
15141500
15151501void 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 ();
15161539 // Reset all global variables
15171540 BLOCK_COUNT = 0 ;
15181541 NB_NODE = 0 ;
@@ -1541,59 +1564,6 @@ void cleanup(){
15411564 CUT_OFF = 0 ;
15421565 BEST_SOL_TIME = 0 ;
15431566 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- }
15971567}
15981568
15991569
0 commit comments