abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
pair.c
Go to the documentation of this file.
1 /*
2  * Revision Control Information
3  *
4  * $Source$
5  * $Author$
6  * $Revision$
7  * $Date$
8  *
9  */
10 #include "espresso.h"
11 
13 
14 
15 void set_pair(PLA)
16 pPLA PLA;
17 {
18  set_pair1(PLA, TRUE);
19 }
20 
21 void set_pair1(PLA, adjust_labels)
22 pPLA PLA;
23 bool adjust_labels;
24 {
25  int i, var, *paired, newvar;
26  int old_num_vars, old_num_binary_vars, old_size, old_mv_start;
27  int *new_part_size, new_num_vars, new_num_binary_vars, new_mv_start;
28  ppair pair = PLA->pair;
29  char scratch[1000], **oldlabel, *var1, *var1bar, *var2, *var2bar;
30 
31  if (adjust_labels)
32  makeup_labels(PLA);
33 
34  /* Check the pair structure for valid entries and see which binary
35  variables are left unpaired
36  */
37  paired = ALLOC(bool, cube.num_binary_vars);
38  for(var = 0; var < cube.num_binary_vars; var++)
39  paired[var] = FALSE;
40  for(i = 0; i < pair->cnt; i++)
41  if ((pair->var1[i] > 0 && pair->var1[i] <= cube.num_binary_vars) &&
42  (pair->var2[i] > 0 && pair->var2[i] <= cube.num_binary_vars)) {
43  paired[pair->var1[i]-1] = TRUE;
44  paired[pair->var2[i]-1] = TRUE;
45  } else
46  fatal("can only pair binary-valued variables");
47 
48  PLA->F = delvar(pairvar(PLA->F, pair), paired);
49  PLA->R = delvar(pairvar(PLA->R, pair), paired);
50  PLA->D = delvar(pairvar(PLA->D, pair), paired);
51 
52  /* Now painfully adjust the cube size */
53  old_size = cube.size;
54  old_num_vars = cube.num_vars;
55  old_num_binary_vars = cube.num_binary_vars;
56  old_mv_start = cube.first_part[cube.num_binary_vars];
57  /* Create the new cube.part_size vector and setup the cube structure */
58  new_num_binary_vars = 0;
59  for(var = 0; var < old_num_binary_vars; var++)
60  new_num_binary_vars += (paired[var] == FALSE);
61  new_num_vars = new_num_binary_vars + pair->cnt;
62  new_num_vars += old_num_vars - old_num_binary_vars;
63  new_part_size = ALLOC(int, new_num_vars);
64  for(var = 0; var < pair->cnt; var++)
65  new_part_size[new_num_binary_vars + var] = 4;
66  for(var = 0; var < old_num_vars - old_num_binary_vars; var++)
67  new_part_size[new_num_binary_vars + pair->cnt + var] =
68  cube.part_size[old_num_binary_vars + var];
69  setdown_cube();
70  FREE(cube.part_size);
71  cube.num_vars = new_num_vars;
72  cube.num_binary_vars = new_num_binary_vars;
73  cube.part_size = new_part_size;
74  cube_setup();
75 
76  /* hack with the labels to get them correct */
77  if (adjust_labels) {
78  oldlabel = PLA->label;
79  PLA->label = ALLOC(char *, cube.size);
80  for(var = 0; var < pair->cnt; var++) {
81  newvar = cube.num_binary_vars*2 + var*4;
82  var1 = oldlabel[ (pair->var1[var]-1) * 2 + 1];
83  var2 = oldlabel[ (pair->var2[var]-1) * 2 + 1];
84  var1bar = oldlabel[ (pair->var1[var]-1) * 2];
85  var2bar = oldlabel[ (pair->var2[var]-1) * 2];
86  (void) sprintf(scratch, "%s+%s", var1bar, var2bar);
87  PLA->label[newvar] = util_strsav(scratch);
88  (void) sprintf(scratch, "%s+%s", var1bar, var2);
89  PLA->label[newvar+1] = util_strsav(scratch);
90  (void) sprintf(scratch, "%s+%s", var1, var2bar);
91  PLA->label[newvar+2] = util_strsav(scratch);
92  (void) sprintf(scratch, "%s+%s", var1, var2);
93  PLA->label[newvar+3] = util_strsav(scratch);
94  }
95  /* Copy the old labels for the unpaired binary vars */
96  i = 0;
97  for(var = 0; var < old_num_binary_vars; var++) {
98  if (paired[var] == FALSE) {
99  PLA->label[2*i] = oldlabel[2*var];
100  PLA->label[2*i+1] = oldlabel[2*var+1];
101  oldlabel[2*var] = oldlabel[2*var+1] = (char *) NULL;
102  i++;
103  }
104  }
105  /* Copy the old labels for the remaining unpaired vars */
106  new_mv_start = cube.num_binary_vars*2 + pair->cnt*4;
107  for(i = old_mv_start; i < old_size; i++) {
108  PLA->label[new_mv_start + i - old_mv_start] = oldlabel[i];
109  oldlabel[i] = (char *) NULL;
110  }
111  /* free remaining entries in oldlabel */
112  for(i = 0; i < old_size; i++)
113  if (oldlabel[i] != (char *) NULL)
114  FREE(oldlabel[i]);
115  FREE(oldlabel);
116  }
117 
118  /* the paired variables should not be sparse (cf. mv_reduce/raise_in)*/
119  for(var = 0; var < pair->cnt; var++)
120  cube.sparse[cube.num_binary_vars + var] = 0;
121  FREE(paired);
122 }
123 
124 pcover pairvar(A, pair)
125 pcover A;
126 ppair pair;
127 {
128  register pcube last, p;
129  register int val, p1, p2, b1, b0;
130  int insert_col, pairnum;
131 
132  insert_col = cube.first_part[cube.num_vars - 1];
133 
134  /* stretch the cover matrix to make room for the paired variables */
135  A = sf_delcol(A, insert_col, -4*pair->cnt);
136 
137  /* compute the paired values */
138  foreach_set(A, last, p) {
139  for(pairnum = 0; pairnum < pair->cnt; pairnum++) {
140  p1 = cube.first_part[pair->var1[pairnum] - 1];
141  p2 = cube.first_part[pair->var2[pairnum] - 1];
142  b1 = is_in_set(p, p2+1);
143  b0 = is_in_set(p, p2);
144  val = insert_col + pairnum * 4;
145  if (/* a0 */ is_in_set(p, p1)) {
146  if (b0)
147  set_insert(p, val + 3);
148  if (b1)
149  set_insert(p, val + 2);
150  }
151  if (/* a1 */ is_in_set(p, p1+1)) {
152  if (b0)
153  set_insert(p, val + 1);
154  if (b1)
155  set_insert(p, val);
156  }
157  }
158  }
159  return A;
160 }
161 
162 
163 /* delvar -- delete variables from A, minimize the number of column shifts */
164 pcover delvar(A, paired)
165 pcover A;
166 bool paired[];
167 {
168  bool run;
169  int first_run = 0; // Suppress "might be used uninitialized"
170  int run_length, var, offset = 0;
171 
172  run = FALSE; run_length = 0;
173  for(var = 0; var < cube.num_binary_vars; var++)
174  if (paired[var])
175  if (run)
176  run_length += cube.part_size[var];
177  else {
178  run = TRUE;
179  first_run = cube.first_part[var];
180  run_length = cube.part_size[var];
181  }
182  else
183  if (run) {
184  A = sf_delcol(A, first_run-offset, run_length);
185  run = FALSE;
186  offset += run_length;
187  }
188  if (run)
189  A = sf_delcol(A, first_run-offset, run_length);
190  return A;
191 }
192 
193 /*
194  find_optimal_pairing -- find which binary variables should be paired
195  to maximally reduce the number of terms
196 
197  This is essentially the technique outlined by T. Sasao in the
198  Trans. on Comp., Oct 1984. We estimate the cost of pairing each
199  pair individually using 1 of 4 strategies: (1) algebraic division
200  of F by the pair (exactly T. Sasao technique); (2) strong division
201  of F by the paired variables (using REDUCE/EXPAND/ IRREDUNDANT from
202  espresso); (3) full minimization using espresso; (4) exact
203  minimization. These are in order of both increasing accuracy and
204  increasing difficulty (!)
205 
206  Once the n squared pairs have been evaluated, T. Sasao proposes a
207  graph covering of nodes by disjoint edges. For now, I solve this
208  problem exhaustively (complexity = (n-1)*(n-3)*...*3*1 for n
209  variables when n is even). Note that solving this problem exactly
210  is the same as evaluating the cost function for all possible
211  pairings.
212 
213  n pairs
214 
215  1, 2 1
216  3, 4 3
217  5, 6 15
218  7, 8 105
219  9,10 945
220  11,12 10,395
221  13,14 135,135
222  15,16 2,027,025
223  17,18 34,459,425
224  19,20 654,729,075
225 */
226 void find_optimal_pairing(PLA, strategy)
227 pPLA PLA;
228 int strategy;
229 {
230  int i, j, **cost_array;
231 
232  cost_array = find_pairing_cost(PLA, strategy);
233 
234  if (summary) {
235  printf(" ");
236  for(i = 0; i < cube.num_binary_vars; i++)
237  printf("%3d ", i+1);
238  printf("\n");
239  for(i = 0; i < cube.num_binary_vars; i++) {
240  printf("%3d ", i+1);
241  for(j = 0; j < cube.num_binary_vars; j++)
242  printf("%3d ", cost_array[i][j]);
243  printf("\n");
244  }
245  }
246 
247  if (cube.num_binary_vars <= 14) {
248  PLA->pair = pair_best_cost(cost_array);
249  } else {
250  (void) greedy_best_cost(cost_array, &(PLA->pair));
251  }
252  printf("# ");
253  print_pair(PLA->pair);
254 
255  for(i = 0; i < cube.num_binary_vars; i++)
256  FREE(cost_array[i]);
257  FREE(cost_array);
258 
259  set_pair(PLA);
260  EXEC_S(PLA->F=espresso(PLA->F,PLA->D,PLA->R),"ESPRESSO ",PLA->F);
261 }
262 
263 int **find_pairing_cost(PLA, strategy)
264 pPLA PLA;
265 int strategy;
266 {
267  int var1, var2, **cost_array;
268  int i, j;
269  int xnum_binary_vars = 0, xnum_vars = 0, *xpart_size = NULL, cost = 0; // Suppress "might be used uninitialized"
270  pcover T;
271  pcover Fsave = NULL, Dsave = NULL, Rsave = NULL; // Suppress "might be used uninitialized"
272  pset mask;
273 /* char *s;*/
274 
275  /* data is returned in the cost array */
276  cost_array = ALLOC(int *, cube.num_binary_vars);
277  for(i = 0; i < cube.num_binary_vars; i++)
278  cost_array[i] = ALLOC(int, cube.num_binary_vars);
279  for(i = 0; i < cube.num_binary_vars; i++)
280  for(j = 0; j < cube.num_binary_vars; j++)
281  cost_array[i][j] = 0;
282 
283  /* Setup the pair structure for pairing variables together */
284  PLA->pair = pair_new(1);
285  PLA->pair->cnt = 1;
286 
287  for(var1 = 0; var1 < cube.num_binary_vars-1; var1++) {
288  for(var2 = var1+1; var2 < cube.num_binary_vars; var2++) {
289  /* if anything but simple strategy, perform setup */
290  if (strategy > 0) {
291  /* save the original covers */
292  Fsave = sf_save(PLA->F);
293  Dsave = sf_save(PLA->D);
294  Rsave = sf_save(PLA->R);
295 
296  /* save the original cube structure */
297  xnum_binary_vars = cube.num_binary_vars;
298  xnum_vars = cube.num_vars;
299  xpart_size = ALLOC(int, cube.num_vars);
300  for(i = 0; i < cube.num_vars; i++)
301  xpart_size[i] = cube.part_size[i];
302 
303  /* pair two variables together */
304  PLA->pair->var1[0] = var1 + 1;
305  PLA->pair->var2[0] = var2 + 1;
306  set_pair1(PLA, /* adjust_labels */ FALSE);
307  }
308 
309 
310  /* decide how to best estimate worth of this pairing */
311  switch(strategy) {
312  case 3:
313  /*s = "exact minimization";*/
314  PLA->F = minimize_exact(PLA->F, PLA->D, PLA->R, 1);
315  cost = Fsave->count - PLA->F->count;
316  break;
317  case 2:
318  /*s = "full minimization";*/
319  PLA->F = espresso(PLA->F, PLA->D, PLA->R);
320  cost = Fsave->count - PLA->F->count;
321  break;
322  case 1:
323  /*s = "strong division";*/
324  PLA->F = reduce(PLA->F, PLA->D);
325  PLA->F = expand(PLA->F, PLA->R, FALSE);
326  PLA->F = irredundant(PLA->F, PLA->D);
327  cost = Fsave->count - PLA->F->count;
328  break;
329  case 0:
330  /*s = "weak division";*/
331  mask = new_cube();
332  set_or(mask, cube.var_mask[var1], cube.var_mask[var2]);
333  T = dist_merge(sf_save(PLA->F), mask);
334  cost = PLA->F->count - T->count;
335  sf_free(T);
336  set_free(mask);
337  }
338 
339  cost_array[var1][var2] = cost;
340 
341  if (strategy > 0) {
342  /* restore the original cube structure -- free the new ones */
343  setdown_cube();
344  FREE(cube.part_size);
345  cube.num_binary_vars = xnum_binary_vars;
346  cube.num_vars = xnum_vars;
347  cube.part_size = xpart_size;
348  cube_setup();
349 
350  /* restore the original cover(s) -- free the new ones */
351  sf_free(PLA->F);
352  sf_free(PLA->D);
353  sf_free(PLA->R);
354  PLA->F = Fsave;
355  PLA->D = Dsave;
356  PLA->R = Rsave;
357  }
358  }
359  }
360 
361  pair_free(PLA->pair);
362  PLA->pair = NULL;
363  return cost_array;
364 }
365 
366 static int best_cost;
367 static int **cost_array;
373 
374 
375 void print_pair(pair)
376 ppair pair;
377 {
378  int i;
379 
380  printf("pair is");
381  for(i = 0; i < pair->cnt; i++)
382  printf (" (%d %d)", pair->var1[i], pair->var2[i]);
383  printf("\n");
384 }
385 
386 
387 int greedy_best_cost(cost_array_local, pair_p)
388 int **cost_array_local;
389 ppair *pair_p;
390 {
391  int i, j;
392  int besti = 0, bestj = 0;
393  int maxcost, total_cost;
394  pset cand;
395  ppair pair;
396 
397  pair = pair_new(cube.num_binary_vars);
398  cand = set_full(cube.num_binary_vars);
399  total_cost = 0;
400 
401  while (set_ord(cand) >= 2) {
402  maxcost = -1;
403  for(i = 0; i < cube.num_binary_vars; i++) {
404  if (is_in_set(cand, i)) {
405  for(j = i+1; j < cube.num_binary_vars; j++) {
406  if (is_in_set(cand, j)) {
407  if (cost_array_local[i][j] > maxcost) {
408  maxcost = cost_array_local[i][j];
409  besti = i;
410  bestj = j;
411  }
412  }
413  }
414  }
415  }
416  pair->var1[pair->cnt] = besti+1;
417  pair->var2[pair->cnt] = bestj+1;
418  pair->cnt++;
419  set_remove(cand, besti);
420  set_remove(cand, bestj);
421  total_cost += maxcost;
422  }
423  set_free(cand);
424  *pair_p = pair;
425  return total_cost;
426 }
427 
428 
429 ppair pair_best_cost(cost_array_local)
430 int **cost_array_local;
431 {
432  ppair pair;
433  pset candidate;
434 
435  best_cost = -1;
436  best_pair = NULL;
437  cost_array = cost_array_local;
438 
439  pair = pair_new(cube.num_binary_vars);
440  candidate = set_full(cube.num_binary_vars);
441  generate_all_pairs(pair, cube.num_binary_vars, candidate, find_best_cost);
442  pair_free(pair);
443  set_free(candidate);
444  return best_pair;
445 }
446 
447 
448 void find_best_cost(pair)
449 register ppair pair;
450 {
451  register int i, cost;
452 
453  cost = 0;
454  for(i = 0; i < pair->cnt; i++)
455  cost += cost_array[pair->var1[i]-1][pair->var2[i]-1];
456  if (cost > best_cost) {
457  best_cost = cost;
458  best_pair = pair_save(pair, pair->cnt);
459  }
460  if ((debug & MINCOV) && trace) {
461  printf("cost is %d ", cost);
462  print_pair(pair);
463  }
464 }
465 
466 /*
467  pair_all: brute-force approach to try all possible pairings
468 
469  pair_strategy is:
470  2) for espresso
471  3) for minimize_exact
472  4) for phase assignment
473 */
474 
475 void pair_all(PLA, pair_strategy)
476 pPLA PLA;
477 int pair_strategy;
478 {
479  ppair pair;
480  pset candidate;
481 
482  global_PLA = PLA;
483  pair_minim_strategy = pair_strategy;
484  best_cost = PLA->F->count + 1;
485  best_pair = NULL;
486  best_phase = NULL;
487  best_F = best_D = best_R = NULL;
488  pair = pair_new(cube.num_binary_vars);
489  candidate = set_fill(set_new(cube.num_binary_vars), cube.num_binary_vars);
490 
491  generate_all_pairs(pair, cube.num_binary_vars, candidate, minimize_pair);
492 
493  pair_free(pair);
494  set_free(candidate);
495 
496  PLA->pair = best_pair;
497  PLA->phase = best_phase;
498 /* not really necessary
499  if (phase != NULL)
500  (void) set_phase(PLA->phase);
501 */
502  set_pair(PLA);
503  printf("# ");
504  print_pair(PLA->pair);
505 
506  sf_free(PLA->F);
507  sf_free(PLA->D);
508  sf_free(PLA->R);
509  PLA->F = best_F;
510  PLA->D = best_D;
511  PLA->R = best_R;
512 }
513 
514 
515 /*
516  * minimize_pair -- called as each pair is generated
517  */
518 void minimize_pair(pair)
519 ppair pair;
520 {
521  pcover Fsave, Dsave, Rsave;
522  int i, xnum_binary_vars, xnum_vars, *xpart_size;
523 
524  /* save the original covers */
525  Fsave = sf_save(global_PLA->F);
526  Dsave = sf_save(global_PLA->D);
527  Rsave = sf_save(global_PLA->R);
528 
529  /* save the original cube structure */
530  xnum_binary_vars = cube.num_binary_vars;
531  xnum_vars = cube.num_vars;
532  xpart_size = ALLOC(int, cube.num_vars);
533  for(i = 0; i < cube.num_vars; i++)
534  xpart_size[i] = cube.part_size[i];
535 
536  /* setup the paired variables */
537  global_PLA->pair = pair;
538  set_pair1(global_PLA, /* adjust_labels */ FALSE);
539 
540  /* call the minimizer */
541  if (summary)
542  print_pair(pair);
543  switch(pair_minim_strategy) {
544  case 2:
545  EXEC_S(phase_assignment(global_PLA,0), "OPO ", global_PLA->F);
546  if (summary)
547  printf("# phase is %s\n", pc1(global_PLA->phase));
548  break;
549  case 1:
550  EXEC_S(global_PLA->F = minimize_exact(global_PLA->F, global_PLA->D,
551  global_PLA->R, 1), "EXACT ", global_PLA->F);
552  break;
553  case 0:
554  EXEC_S(global_PLA->F = espresso(global_PLA->F, global_PLA->D,
555  global_PLA->R), "ESPRESSO ", global_PLA->F);
556  break;
557  default:
558  break;
559  }
560 
561  /* see if we have a new best solution */
562  if (global_PLA->F->count < best_cost) {
563  best_cost = global_PLA->F->count;
564  best_pair = pair_save(pair, pair->cnt);
565  best_phase = global_PLA->phase!=NULL?set_save(global_PLA->phase):NULL;
566  if (best_F != NULL) sf_free(best_F);
567  if (best_D != NULL) sf_free(best_D);
568  if (best_R != NULL) sf_free(best_R);
569  best_F = sf_save(global_PLA->F);
570  best_D = sf_save(global_PLA->D);
571  best_R = sf_save(global_PLA->R);
572  }
573 
574  /* restore the original cube structure -- free the new ones */
575  setdown_cube();
576  FREE(cube.part_size);
577  cube.num_binary_vars = xnum_binary_vars;
578  cube.num_vars = xnum_vars;
579  cube.part_size = xpart_size;
580  cube_setup();
581 
582  /* restore the original cover(s) -- free the new ones */
583  sf_free(global_PLA->F);
584  sf_free(global_PLA->D);
585  sf_free(global_PLA->R);
586  global_PLA->F = Fsave;
587  global_PLA->D = Dsave;
588  global_PLA->R = Rsave;
589  global_PLA->pair = NULL;
590  global_PLA->phase = NULL;
591 }
592 
593 void generate_all_pairs(pair, n, candidate, action)
594 ppair pair;
595 int n;
596 pset candidate;
597 int (*action)();
598 {
599  int i, j;
600  pset recur_candidate;
601  ppair recur_pair;
602 
603  if (set_ord(candidate) < 2) {
604  (*action)(pair);
605  return;
606  }
607 
608  recur_pair = pair_save(pair, n);
609  recur_candidate = set_save(candidate);
610 
611  /* Find first variable still in the candidate set */
612  for(i = 0; i < n; i++)
613  if (is_in_set(candidate, i))
614  break;
615 
616  /* Try all pairs of i with other variables */
617  for(j = i+1; j < n; j++)
618  if (is_in_set(candidate, j)) {
619  /* pair (i j) -- remove from candidate set for future pairings */
620  set_remove(recur_candidate, i);
621  set_remove(recur_candidate, j);
622 
623  /* add to the pair array */
624  recur_pair->var1[recur_pair->cnt] = i+1;
625  recur_pair->var2[recur_pair->cnt] = j+1;
626  recur_pair->cnt++;
627 
628  /* recur looking for the end ... */
629  generate_all_pairs(recur_pair, n, recur_candidate, action);
630 
631  /* now break this pair, and restore candidate set */
632  recur_pair->cnt--;
633  set_insert(recur_candidate, i);
634  set_insert(recur_candidate, j);
635  }
636 
637  /* if odd, generate all pairs which do NOT include i */
638  if ((set_ord(candidate) % 2) == 1) {
639  set_remove(recur_candidate, i);
640  generate_all_pairs(recur_pair, n, recur_candidate, action);
641  }
642 
643  pair_free(recur_pair);
644  set_free(recur_candidate);
645 }
646 
648 register int n;
649 {
650  register ppair pair1;
651 
652  pair1 = ALLOC(pair_t, 1);
653  pair1->cnt = 0;
654  pair1->var1 = ALLOC(int, n);
655  pair1->var2 = ALLOC(int, n);
656  return pair1;
657 }
658 
659 
660 ppair pair_save(pair, n)
661 register ppair pair;
662 register int n;
663 {
664  register int k;
665  register ppair pair1;
666 
667  pair1 = pair_new(n);
668  pair1->cnt = pair->cnt;
669  for(k = 0; k < pair->cnt; k++) {
670  pair1->var1[k] = pair->var1[k];
671  pair1->var2[k] = pair->var2[k];
672  }
673  return pair1;
674 }
675 
676 
677 void pair_free(pair)
678 register ppair pair;
679 {
680  FREE(pair->var1);
681  FREE(pair->var2);
682  FREE(pair);
683 }
685 
void print_pair(ppair pair)
Definition: pair.c:375
pset set_or()
static const int var1
Definition: satSolver.c:77
ppair pair
Definition: espresso.h:320
void fatal(char *s)
Definition: cvrmisc.c:140
#define set_free(r)
Definition: espresso.h:167
#define FALSE
Definition: cudd.h:91
ABC_NAMESPACE_IMPL_START pcover espresso(pcover F, pcover D1, pcover R)
Definition: espresso.c:53
#define new_cube()
Definition: espresso.h:262
char * pc1(pcube c)
Definition: cvrout.c:379
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define pcover
Definition: espresso.h:264
ppair pair_best_cost(int **cost_array_local)
Definition: pair.c:429
#define set_save(r)
Definition: espresso.h:166
static int pair_minim_strategy
Definition: pair.c:372
void set_pair1(pPLA PLA, bool adjust_labels)
Definition: pair.c:21
pcover pairvar(pcover A, ppair pair)
Definition: pair.c:124
int var(Lit p)
Definition: SolverTypes.h:62
#define b1
Definition: extraBdd.h:76
pset_family dist_merge(INOUT pset_family A, IN pset mask)
Definition: contain.c:141
bool summary
Definition: globals.c:35
bool trace
Definition: globals.c:36
ABC_NAMESPACE_IMPL_START void cube_setup()
Definition: cubestr.c:27
void generate_all_pairs(ppair pair, int n, pset candidate, int(*action)())
Definition: pair.c:593
void minimize_pair(ppair pair)
Definition: pair.c:518
void sf_free()
void find_optimal_pairing(pPLA PLA, int strategy)
Definition: pair.c:226
int greedy_best_cost(int **cost_array_local, ppair *pair_p)
Definition: pair.c:387
#define foreach_set(R, last, p)
Definition: espresso.h:135
int * var2
Definition: espresso.h:285
void pair_all(pPLA PLA, int pair_strategy)
Definition: pair.c:475
static pcover best_D
Definition: pair.c:371
void find_best_cost(ppair pair)
Definition: pair.c:448
#define set_full(size)
Definition: espresso.h:165
pset_family sf_delcol()
pcover expand()
#define ALLOC(type, num)
Definition: avl.h:27
pcover irredundant()
unsigned int debug
Definition: globals.c:19
void setdown_cube()
Definition: cubestr.c:95
void phase_assignment()
ABC_NAMESPACE_IMPL_START void set_pair(pPLA PLA)
Definition: pair.c:15
#define EXEC_S(fct, name, S)
Definition: espresso.h:420
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
if(last==0)
Definition: sparse_int.h:34
#define FREE(obj)
Definition: avl.h:31
#define is_in_set(set, e)
Definition: espresso.h:170
unsigned int * pset
Definition: espresso.h:73
pcover reduce()
char * sprintf()
pcover F
Definition: espresso.h:316
int * var1
Definition: espresso.h:284
pcover delvar(pcover A, paired)
Definition: pair.c:164
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
#define set_new(size)
Definition: espresso.h:164
pset set_fill()
#define set_remove(set, e)
Definition: espresso.h:171
#define TRUE
Definition: cudd.h:88
#define MINCOV
Definition: espresso.h:362
pcube phase
Definition: espresso.h:319
ppair pair_new(int n)
Definition: pair.c:647
static pPLA global_PLA
Definition: pair.c:370
#define set_insert(set, e)
Definition: espresso.h:172
pcover D
Definition: espresso.h:316
pcover R
Definition: espresso.h:316
#define b0
Definition: extraBdd.h:75
static pcover best_R
Definition: pair.c:371
ppair pair_save(ppair pair, int n)
Definition: pair.c:660
static pset best_phase
Definition: pair.c:369
void makeup_labels(pPLA PLA)
Definition: cvrout.c:434
static pcover best_F
Definition: pair.c:371
pcover minimize_exact()
static int ** cost_array
Definition: pair.c:367
void pair_free(ppair pair)
Definition: pair.c:677
static int best_cost
Definition: pair.c:366
#define pcube
Definition: espresso.h:261
int ** find_pairing_cost(pPLA PLA, int strategy)
Definition: pair.c:263
static ppair best_pair
Definition: pair.c:368
pset_family sf_save()
int set_ord()