ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
solution.c File Reference
#include "mincov_int.h"
Include dependency graph for solution.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START solution_tsolution_alloc ()
 
void solution_free (solution_t *sol)
 
solution_tsolution_dup (solution_t *sol)
 
void solution_add (solution_t *sol, int *weight, int col)
 
void solution_accept (solution_t *sol, sm_matrix *A, int *weight, int col)
 
void solution_reject (solution_t *sol, sm_matrix *A, int *weight, int col)
 
solution_tsolution_choose_best (solution_t *best1, solution_t *best2)
 

Function Documentation

◆ solution_accept()

void solution_accept ( solution_t * sol,
sm_matrix * A,
int * weight,
int col )

Definition at line 62 of file solution.c.

67{
68 register sm_element *p, *pnext;
69 sm_col *pcol;
70
71 solution_add(sol, weight, col);
72
73 /* delete rows covered by this column */
74 pcol = sm_get_col(A, col);
75 for(p = pcol->first_row; p != 0; p = pnext) {
76 pnext = p->next_row; /* grab it before it disappears */
77 sm_delrow(A, p->row_num);
78 }
79}
Cube * p
Definition exorList.c:222
void solution_add()
typedefABC_NAMESPACE_HEADER_START struct sm_element_struct sm_element
Definition sparse.h:21
struct sm_col_struct sm_col
Definition sparse.h:23
void sm_delrow()
#define sm_get_col(A, colnum)
Definition sparse.h:89
sm_element * first_row
Definition sparse.h:63
Here is the call graph for this function:

◆ solution_add()

void solution_add ( solution_t * sol,
int * weight,
int col )

Definition at line 51 of file solution.c.

55{
56 (void) sm_row_insert(sol->row, col);
57 sol->cost += WEIGHT(weight, col);
58}
sm_element * sm_row_insert()
Here is the call graph for this function:

◆ solution_alloc()

ABC_NAMESPACE_IMPL_START solution_t * solution_alloc ( )

Definition at line 17 of file solution.c.

18{
19 solution_t *sol;
20
21 sol = ALLOC(solution_t, 1);
22 sol->cost = 0;
23 sol->row = sm_row_alloc();
24 return sol;
25}
#define ALLOC(type, num)
Definition avl.h:27
struct solution_struct solution_t
Definition mincov_int.h:35
ABC_NAMESPACE_IMPL_START sm_row * sm_row_alloc()
Definition rows.c:21
Here is the call graph for this function:
Here is the caller graph for this function:

◆ solution_choose_best()

solution_t * solution_choose_best ( solution_t * best1,
solution_t * best2 )

Definition at line 95 of file solution.c.

97{
98 if (best1 != NIL(solution_t)) {
99 if (best2 != NIL(solution_t)) {
100 if (best1->cost <= best2->cost) {
101 solution_free(best2);
102 return best1;
103 } else {
104 solution_free(best1);
105 return best2;
106 }
107 } else {
108 return best1;
109 }
110 } else {
111 if (best2 != NIL(solution_t)) {
112 return best2;
113 } else {
114 return NIL(solution_t);
115 }
116 }
117}
#define NIL(type)
Definition avl.h:25
void solution_free()
Here is the call graph for this function:

◆ solution_dup()

solution_t * solution_dup ( solution_t * sol)

Definition at line 38 of file solution.c.

40{
41 solution_t *new_sol;
42
43 new_sol = ALLOC(solution_t, 1);
44 new_sol->cost = sol->cost;
45 new_sol->row = sm_row_dup(sol->row);
46 return new_sol;
47}
sm_row * sm_row_dup()
Here is the call graph for this function:

◆ solution_free()

void solution_free ( solution_t * sol)

Definition at line 29 of file solution.c.

31{
32 sm_row_free(sol->row);
33 FREE(sol);
34}
#define FREE(obj)
Definition avl.h:31
void sm_row_free()
Here is the call graph for this function:

◆ solution_reject()

void solution_reject ( solution_t * sol,
sm_matrix * A,
int * weight,
int col )

Definition at line 84 of file solution.c.

89{
90 sm_delcol(A, col);
91}
void sm_delcol()
Here is the call graph for this function: