ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
tiers.c File Reference
#include "tiers.h"
#include "internal.h"
#include "logging.h"
#include "print.h"
Include dependency graph for tiers.c:

Go to the source code of this file.

Functions

void kissat_compute_and_set_tier_limits (struct kissat *solver)
 
void kissat_print_tier_usage_statistics (kissat *solver, bool stable)
 

Function Documentation

◆ kissat_compute_and_set_tier_limits()

void kissat_compute_and_set_tier_limits ( struct kissat * solver)

Definition at line 53 of file tiers.c.

53 {
54 bool stable = solver->stable;
55 unsigned tier1, tier2;
56 compute_tier_limits (solver, stable, &tier1, &tier2);
57 solver->tier1[stable] = tier1;
58 solver->tier2[stable] = tier2;
59 kissat_phase (solver, "retiered", GET (retiered),
60 "recomputed %s tier1 limit %u and tier2 limit %u "
61 "after %" PRIu64 " conflicts",
62 stable ? "stable" : "focused", tier1, tier2, CONFLICTS);
63}
#define solver
Definition kitten.c:211
#define kissat_phase(...)
Definition print.h:48
#define CONFLICTS
Definition statistics.h:335
#define GET(NAME)
Definition statistics.h:416
Here is the caller graph for this function:

◆ kissat_print_tier_usage_statistics()

void kissat_print_tier_usage_statistics ( kissat * solver,
bool stable )

Definition at line 76 of file tiers.c.

76 {
77 unsigned tier1, tier2;
78 compute_tier_limits (solver, stable, &tier1, &tier2);
79 statistics *statistics = &solver->statistics_;
80 uint64_t *used_stats = statistics->used[stable].glue;
81 uint64_t total_used = 0;
82 for (unsigned glue = 0; glue <= MAX_GLUE_USED; glue++)
83 total_used += used_stats[glue];
84 const char *mode = stable ? "stable" : "focused";
85 KISSAT_assert (tier1 <= tier2);
86 unsigned span = tier2 - tier1 + 1;
87 const unsigned max_printed = 5;
88 KISSAT_assert (max_printed & 1), KISSAT_assert (max_printed / 2 > 0);
89 unsigned prefix, suffix;
90 if (span > max_printed) {
91 prefix = tier1 + max_printed / 2 - 1;
92 suffix = tier2 - max_printed / 2 + 1;
93 } else
94 prefix = UINT_MAX, suffix = 0;
95 uint64_t accumulated_middle = 0;
96 int glue_digits = 1, clauses_digits = 1;
97 for (unsigned glue = 0; glue <= MAX_GLUE_USED; glue++) {
98 if (glue < tier1)
99 continue;
100 uint64_t used = used_stats[glue];
101 int tmp_glue = 0, tmp_clauses = 0;
102 if (glue <= prefix || suffix <= glue) {
103 tmp_glue = decimal_digits (glue);
104 tmp_clauses = decimal_digits (used);
105 } else {
106 accumulated_middle += used;
107 if (glue + 1 == suffix) {
108 tmp_glue = decimal_digits (prefix + 1) + decimal_digits (glue) + 1;
109 tmp_clauses = decimal_digits (accumulated_middle);
110 }
111 }
112 if (tmp_glue > glue_digits)
113 glue_digits = tmp_glue;
114 if (tmp_clauses > clauses_digits)
115 clauses_digits = tmp_clauses;
116 if (glue == tier2)
117 break;
118 }
119 char fmt[32];
120 sprintf (fmt, "%%%d" PRIu64, clauses_digits);
121 accumulated_middle = 0;
122 uint64_t accumulated = 0;
123 for (unsigned glue = 0; glue <= MAX_GLUE_USED; glue++) {
124 uint64_t used = used_stats[glue];
125 accumulated += used;
126 if (glue < tier1)
127 continue;
128 if (glue <= prefix || suffix <= glue + 1) {
129 fputs (solver->prefix, stdout);
130 fputs (mode, stdout);
131 fputs (" glue ", stdout);
132 }
133 if (glue <= prefix || suffix <= glue) {
134 int len = printf ("%u", glue);
135 while (len > 0 && len < glue_digits)
136 fputc (' ', stdout), len++;
137 fputs (" used ", stdout);
138 printf (fmt, used);
139 printf (" clauses %5.2f%% accumulated %5.2f%%",
140 kissat_percent (used, total_used),
141 kissat_percent (accumulated, total_used));
142 if (glue == tier1)
143 fputs (" tier1", stdout);
144 if (glue == tier2)
145 fputs (" tier2", stdout);
146 fputc ('\n', stdout);
147 } else {
148 accumulated_middle += used;
149 if (glue + 1 == suffix) {
150 int len = printf ("%u-%u", prefix + 1, suffix - 1);
151 while (len > 0 && len < glue_digits)
152 fputc (' ', stdout), len++;
153 fputs (" used ", stdout);
154 printf (fmt, accumulated_middle);
155 printf (" clauses %5.2f%% accumulated %5.2f%%\n",
156 kissat_percent (accumulated_middle, total_used),
157 kissat_percent (accumulated, total_used));
158 }
159 }
160 if (glue == tier2)
161 break;
162 }
163}
#define KISSAT_assert(ignore)
Definition global.h:13
#define MAX_GLUE_USED
Definition statistics.h:313
Definition mode.h:11
METRICS_COUNTERS_AND_STATISTICS struct statistics::@210323365176300370122154220272050204040253242144 used[2]
uint64_t glue[MAX_GLUE_USED+1]
Definition statistics.h:327
char * sprintf()
Here is the call graph for this function: