コード例 #1
0
ファイル: glpios03.c プロジェクト: Erez-Buchnik/Bouma2
static void show_progress(glp_tree *T, int bingo)
{     int p;
      double temp;
      char best_mip[50], best_bound[50], *rho, rel_gap[50];
      /* format the best known integer feasible solution */
      if (T->mip->mip_stat == GLP_FEAS)
         sprintf(best_mip, "%17.9e", T->mip->mip_obj);
      else
         sprintf(best_mip, "%17s", "not found yet");
      /* determine reference number of an active subproblem whose local
         bound is best */
      p = ios_best_node(T);
      /* format the best bound */
      if (p == 0)
         sprintf(best_bound, "%17s", "tree is empty");
      else
      {  temp = T->slot[p].node->bound;
         if (temp == -DBL_MAX)
            sprintf(best_bound, "%17s", "-inf");
         else if (temp == +DBL_MAX)
            sprintf(best_bound, "%17s", "+inf");
         else
            sprintf(best_bound, "%17.9e", temp);
      }
      /* choose the relation sign between global bounds */
      if (T->mip->dir == GLP_MIN)
         rho = ">=";
      else if (T->mip->dir == GLP_MAX)
         rho = "<=";
      else
         xassert(T != T);
      /* format the relative mip gap */
      temp = ios_relative_gap(T);
      if (temp == 0.0)
         sprintf(rel_gap, "  0.0%%");
      else if (temp < 0.001)
         sprintf(rel_gap, "< 0.1%%");
      else if (temp <= 9.999)
         sprintf(rel_gap, "%5.1f%%", 100.0 * temp);
      else
         sprintf(rel_gap, "%6s", "");
      /* display progress of the search */
      xprintf("+%6d: %s %s %s %s %s (%d; %d)\n",
         T->mip->it_cnt, bingo ? ">>>>>" : "mip =", best_mip, rho,
         best_bound, rel_gap, T->a_cnt, T->t_cnt - T->n_cnt);
      T->tm_lag = xtime();
      return;
}
コード例 #2
0
ファイル: glpapi13.c プロジェクト: emersonxsu/glpk
int glp_ios_best_node(glp_tree *tree)
{     return
         ios_best_node(tree);
}