1 2 /************************************************************************** 3 4 snippets.c 5 6 Bits of code that, at one time or another, were in ACE. 7 8 **************************************************************************/ 9 10 /****************************************************************** 11 Mode 5 in an experimental mode where we specify the percentage of 12 deductions to be stacked via dedper. So we will, in general, run 13 an RA phase at the end of the enumeration. If the number of cosets 14 doesn't blow out to badly, then we could achieve a significant 15 speed-up; without the complications of PACE's parallelisation. 16 17 This code might more properly be in PACE, which is intended as a 18 test-bed for various dedn handling strategies (incl the `parallel' 19 stategy!). 20 21 Note that we also need to declare dedper in al0.h, define it in 22 enum.c, initialise it, and print it out in, eg, `dump:0;' & 23 `sr:1;'. 24 ******************************************************************/ 25 26 /* The SAVED macro for dedmode #5 */ 27 28 #define SAVED(cos,gen) \ 29 INCR(xsaved); \ 30 if (dedmode == 5 && ((1 + (rand()%100)) > dedper)) \ 31 { disded = TRUE; } \ 32 else \ 33 { \ 34 if (topded >= dedsiz-1) \ 35 { \ 36 INCR(sdoflow); \ 37 switch(dedmode) \ 38 { \ 39 case 3: \ 40 disded = TRUE; \ 41 topded = -1; \ 42 break; \ 43 case 4: \ 44 case 5: \ 45 al0_dedn(cos,gen); \ 46 break; \ 47 default: \ 48 disded = TRUE; \ 49 break; \ 50 } \ 51 } \ 52 else \ 53 { \ 54 dedrow[++topded] = cos; \ 55 dedcol[topded] = gen; \ 56 } \ 57 } \ 58 SAVED00; 59 60 /* The `dmod' parsing */ 61 62 if (al2_match("ded mo[de]") || al2_match("dmod[e]")) 63 { 64 al2_readia(); 65 al2_endcmd(); 66 67 if (intcnt == 0) 68 { 69 fprintf(fop, "deduction mode = %d", dedmode); 70 if (dedmode == 5) 71 { fprintf(fop, " (%d%%)", dedper); } 72 fprintf(fop, "\n"); 73 } 74 else if (intcnt == 1) 75 { 76 if (intarr[0] < 0 || intarr[0] > 5) 77 { al2_continue("bad mode parameter"); } 78 dedmode = intarr[0]; 79 dedper = 50; /* default is 1/2 the dedns */ 80 } 81 else if (intcnt == 2) 82 { 83 if (intarr[0] != 5) 84 { al2_continue("too many parameters"); } 85 if (intarr[1] < 0 || intarr[1] > 100) 86 { al2_continue("bad percentage parameter"); } 87 dedmode = intarr[0]; 88 dedper = intarr[1]; 89 } 90 else 91 { al2_continue("bad parameter count"); } 92 93 continue; 94 } 95 96 /****************************************************************** 97 ******************************************************************/ 98 99 /****************************************************************** 100 ******************************************************************/ 101 102 /****************************************************************** 103 ******************************************************************/ 104 105 /****************************************************************** 106 ******************************************************************/ 107 108