int uts_numChildren(Node *parent) { int numChildren = 0; /* Determine the number of children */ if (parent->height == 0) numChildren = (int) floor(b_0); else numChildren = uts_numChildren_bin(parent); // limit number of children // only a BIN root can have more than MAXNUMCHILDREN if (parent->height == 0) { int rootBF = (int) ceil(b_0); if (numChildren > rootBF) { bots_debug("*** Number of children of root truncated from %d to %d\n", numChildren, rootBF); numChildren = rootBF; } } else { if (numChildren > MAXNUMCHILDREN) { bots_debug("*** Number of children truncated from %d to %d\n", numChildren, MAXNUMCHILDREN); numChildren = MAXNUMCHILDREN; } } return numChildren; }
void pairalign_init (char *filename) { int i; if (!filename || !filename[0]) { bots_error(0, "Please specify an input file with the -f option\n"); } init_matrix(); nseqs = readseqs(1,filename); bots_message("Multiple Pairwise Alignment (%d sequences)\n",nseqs); for (i = 1; i <= nseqs; i++) bots_debug("Sequence %d: %s %6.d aa\n", i, names[i], seqlen_array[i]); ktup = 1; window = 5; signif = 5; gap_open = 10.0; gap_extend = 0.2; pw_go_penalty = 10.0; pw_ge_penalty = 0.1; }
int uts_numChildren(Node *node) { int numChildren = 0; // determine the number of children if (node->height == 0) numChildren = (int) floor(b_0); else { // distribution is identical everywhere below root int v = rng_rand(node->state.state); double d = rng_toProb(v); numChildren = (d < nonLeafProb) ? nonLeafBF : 0; } // limit number of children (only a BIN root can have more than MAXNUMCHILDREN) if (node->height != 0) { if (numChildren > MAXNUMCHILDREN) { bots_debug("*** Number of children truncated from %d to %d\n", numChildren, MAXNUMCHILDREN); numChildren = MAXNUMCHILDREN; } } /* including info into node */ node->numChildren = numChildren; return numChildren; }
void align_end () { int i,j; for(i = 0; i<nseqs; i++) for(j = 0; j<nseqs; j++) if (bench_output[i*nseqs+j] != 0) bots_debug("Benchmark sequences (%d:%d) Aligned. Score: %d\n", i+1 , j+1 , (int) bench_output[i*nseqs+j]); }
/*********************************************************************** * genmat: **********************************************************************/ void genmat (float *M[]) { int null_entry, init_val, i, j, ii, jj; float *p; int a=0,b=0; init_val = 1325; /* generating the structure */ for (ii=0; ii < bots_arg_size; ii++) { for (jj=0; jj < bots_arg_size; jj++) { /* computing null entries */ null_entry=FALSE; if ((ii<jj) && (ii%3 !=0)) null_entry = TRUE; if ((ii>jj) && (jj%3 !=0)) null_entry = TRUE; if (ii%2==1) null_entry = TRUE; if (jj%2==1) null_entry = TRUE; if (ii==jj) null_entry = FALSE; if (ii==jj-1) null_entry = FALSE; if (ii-1 == jj) null_entry = FALSE; /* allocating matrix */ if (null_entry == FALSE){ a++; M[ii*bots_arg_size+jj] = (float *) malloc(bots_arg_size_1*bots_arg_size_1*sizeof(float)); if ((M[ii*bots_arg_size+jj] == NULL)) { bots_message("Error: Out of memory\n"); exit(101); } /* initializing matrix */ p = M[ii*bots_arg_size+jj]; for (i = 0; i < bots_arg_size_1; i++) { for (j = 0; j < bots_arg_size_1; j++) { init_val = (3125 * init_val) % 65536; (*p) = (float)((init_val - 32768.0) / 16384.0); p++; } } } else { b++; M[ii*bots_arg_size+jj] = NULL; } } } bots_debug("allo = %d, no = %d, total = %d, factor = %f\n",a,b,a+b,(float)((float)a/(float)(a+b))); }
void my_print(struct Village *village) { struct Village *vlist; struct Patient *plist; if (village == NULL) return; /* Traverse village hierarchy (lower level first)*/ vlist = village->forward; while(vlist) { my_print(vlist); vlist = vlist->next; } plist = village->population; while (plist != NULL) { bots_debug("[pid:%d]",plist->id); plist = plist->forward; } bots_debug("[vid:%d]\n",village->id); }
int add_cell(int id, coor FOOTPRINT, ibrd BOARD, struct cell *CELLS) { int i, j, nn, area, nnc,nnl; ibrd board; coor footprint, NWS[DMAX]; nnc = 0; nnl = 0; /* for each possible shape */ for (i = 0; i < CELLS[id].n; i++) { /* compute all possible locations for nw corner */ nn = starts(id, i, NWS, CELLS); nnl += nn; /* for all possible locations */ for (j = 0; j < nn; j++) { #pragma omp task untied private(board, footprint,area) \ firstprivate(NWS,i,j,id,nn) \ shared(FOOTPRINT,BOARD,CELLS,MIN_AREA,MIN_FOOTPRINT,N,BEST_BOARD,nnc,bots_verbose_mode) { struct cell cells[N+1]; memcpy(cells,CELLS,sizeof(struct cell)*(N+1)); /* extent of shape */ cells[id].top = NWS[j][0]; cells[id].bot = cells[id].top + cells[id].alt[i][0] - 1; cells[id].lhs = NWS[j][1]; cells[id].rhs = cells[id].lhs + cells[id].alt[i][1] - 1; memcpy(board, BOARD, sizeof(ibrd)); /* if the cell cannot be layed down, prune search */ if (! lay_down(id, board, cells)) { bots_debug("Chip %d, shape %d does not fit\n", id, i); } else { /* calculate new footprint of board and area of footprint */ footprint[0] = max(FOOTPRINT[0], cells[id].bot+1); footprint[1] = max(FOOTPRINT[1], cells[id].rhs+1); area = footprint[0] * footprint[1]; /* if last cell */ if (cells[id].next == 0) { /* if area is minimum, update global values */ if (area < MIN_AREA) { #pragma omp critical if (area < MIN_AREA) { MIN_AREA = area; MIN_FOOTPRINT[0] = footprint[0]; MIN_FOOTPRINT[1] = footprint[1]; memcpy(BEST_BOARD, board, sizeof(ibrd)); bots_debug("N %d\n", MIN_AREA); } } /* if area is less than best area */ } else if (area < MIN_AREA) { int val = add_cell(cells[id].next, footprint, board,cells); #pragma omp atomic nnc += val; /* if area is greater than or equal to best area, prune search */ } else { bots_debug("T %d, %d\n", area, MIN_AREA); } } } } } #pragma omp taskwait return nnc+nnl; }