Ejemplo n.º 1
0
static rsexp compile_assignment (RState* r, rsexp expr, rsexp next)
{
    rsexp var, val, code;

    if (!validate_assignment (r, expr))
        return R_FAILURE;

    var = r_cadr (expr);
    val = r_caddr (expr);

    r_gc_scope_open (r);

    ensure_or_goto (code = emit_assign (r, var, next), exit);
    ensure_or_goto (code = compile (r, val, code), exit);

exit:
    r_gc_scope_close_and_protect (r, code);

    return code;
}
Ejemplo n.º 2
0
static void print_results(smt_core_t *core, double construction_time, double search_time) {
  dpll_stats_t *stat;
  double mem_used, simplified_percent;

  stat = &core->stats;
  show_stats(stat);
  printf("Search time             : %.4f s\n", search_time);
  mem_used = mem_size() / (1024 * 1024);
  if (mem_used > 0) {
    printf("Memory used             : %.2f MB\n", mem_used);
  }
  printf("\n\n");

  // Print status again, in format used by Leonardo's scripts
  print_status(stdout, smt_status(core));
  printf("\n");
  validate_assignment(core);
  printf("\n");

  simplified_percent = 0.0;
  if (stat->literals_before_simpl > 0) {
    simplified_percent = (100.0 * stat->subsumed_literals) / stat->literals_before_simpl;
  }
  printf("STAT %"PRIu64" %"PRIu64" %"PRIu64" %"PRIu32" %"PRIu64" %"PRIu64" %.2f %.2f %.2f\n",
	 stat->decisions,
	 stat->conflicts,
	 stat->propagations,
	 stat->restarts,
	 stat->literals_before_simpl,
	 stat->learned_literals,
	 mem_used,
	 (search_time + construction_time),
	 simplified_percent);

  fflush(stdout);
}