int WalksatAlgorithm::walk_solve() {
  current_solver = this;
  signal(SIGINT, handle_interrupt);
  abort_flag = FALSE;
  (void) elapsed_seconds();
  
  while (! abort_flag && 
	 numsuccesstry < numsol && numtry < numrun &&
	 (time_cutoff == 0.0 ||
	  time_cutoff > expertime)) {

    numtry++;
    init(initfile, initoptions);
    update_statistics_start_try();
    numflip = 0;
    
    if (superlinear) cutoff = base_cutoff * super(numtry);
    
    while((numfalse > target) && (numflip < cutoff)) {
      if(verbosity) print_statistics_start_flip();
      numflip++;
      //flipatom((pickcode[heuristic])());
      flipatom(pickbest());
      update_statistics_end_flip();
    }
    update_and_print_statistics_end_try();

    expertime += elapsed_seconds();
  }
  //expertime = elapsed_seconds();
  if(verbosity) print_statistics_final();
  return status_flag;
}
Beispiel #2
0
void 
fix(int tofix)
{
    int numbreak[MAXLENGTH];	/* number of clauses changing */
    /* each atoms would make false */
    int i;			/* loop counter */
    int j;			/* another loop counter */
    int choice;
    static int (*pickcode[])(int *numbreak,int clausesize, int tofix) = 
      {pickrandom,pickproductsum,pickreciprocal,pickadditive,
	 pickbest,pickexponential,picktabu};

    for(i = 0;i < size[tofix];i++)
      numbreak[i] = breakcost[abs(clause[tofix][i])];

    choice = (pickcode[heuristic])(numbreak,size[tofix],tofix);
    if (choice == NOVALUE)
      numnullflip++;
    else
      flipatom(abs(clause[tofix][choice]));
}