77 Report (
const char *h,
int precision,
int min,
double value);
80 void print_header (
char *line);
85void Report::print_header (
char *line) {
87 for (
int i = -1, j =
pos - (len + 1) / 2 - 3; i < len; i++, j++)
88 line[j] = i < 0 ?
' ' : header[i];
91Report::Report (
const char *h,
int precision,
int min,
double value)
95 snprintf (fmt,
sizeof fmt,
"%%.%df", -precision - 1);
97 snprintf (fmt,
sizeof fmt,
"%%.%df", precision);
98 snprintf (buffer,
sizeof buffer, fmt,
value);
99 const int width =
strlen (buffer);
105 snprintf (fmt,
sizeof fmt,
"%%%d.%df%%%%", min, -precision - 1);
107 snprintf (fmt,
sizeof fmt,
"%%%d.%df", min, precision);
108 snprintf (buffer,
sizeof buffer, fmt,
value);
119#define TIME opts.reportsolve ? solve_time () : time ()
121#define MB (current_resident_set_size () / (double) (1l << 20))
123#define REMAINING (percent (active (), stats.variables_original))
125#define TRAIL (percent (averages.current.trail.slow, max_var))
127#define TARGET (percent (target_assigned, max_var))
129#define BEST (percent (best_assigned, max_var))
133 REPORT ("seconds", 2, 5, TIME) \
134 REPORT ("MB", 0, 2, MB) \
135 REPORT ("level", 0, 2, averages.current.level) \
136 REPORT ("reductions", 0, 1, stats.reductions) \
137 REPORT ("restarts", 0, 3, stats.restarts) \
138 REPORT ("rate", 0, 2, averages.current.decisions) \
139 REPORT ("conflicts", 0, 4, stats.conflicts) \
140 REPORT ("redundant", 0, 4, stats.current.redundant) \
141 REPORT ("trail", -1, 2, TRAIL) \
142 REPORT ("glue", 0, 1, averages.current.glue.slow) \
143 REPORT ("irredundant", 0, 4, stats.current.irredundant) \
144 REPORT ("variables", 0, 3, active ()) \
145 REPORT ("remaining", -1, 2, REMAINING)
152REPORT(
"target", -1, 2,
TARGET) \
153REPORT(
"maxvar", 0, 2, external->max_var)
157static const int num_reports =
158#define REPORT(HEAD, PREC, MIN, EXPR) 1 +
165void Internal::report (
char type,
int verbose) {
171 if (opts.quiet || (verbose > opts.verbose))
177 internal->opts.realtime ?
"real" :
"process",
178 internal->opts.reportsolve ?
"in solving" :
"since initialization",
181 Report reports[num_reports];
183#define REPORT(HEAD, PREC, MIN, EXPR) \
184 CADICAL_assert (n < num_reports); \
185 reports[n++] = Report (HEAD, PREC, MIN, (double) (EXPR));
190 fputc (
'\n', stdout);
192 for (
int i = 0; i < n; i++) {
193 int len =
strlen (reports[i].buffer);
194 reports[i].pos =
pos + (len + 1) / 2;
197 const int max_line =
pos + 20, nrows = 3;
198 char *line =
new char[max_line];
199 for (
int start = 0; start < nrows; start++) {
201 for (i = 0; i < max_line; i++)
203 for (i = start; i < n; i += nrows)
204 reports[i].print_header (line);
205 for (i = max_line - 1; line[i - 1] ==
' '; i--)
210 fputs (line, stdout);
212 fputc (
'\n', stdout);
215 fputc (
'\n', stdout);
279 fputc (
type, stdout);
280 if (stable ||
type ==
']')
282 else if (
type !=
'L' &&
type !=
'P')
284 for (
int i = 0; i < n; i++) {
286 fputs (reports[i].buffer, stdout);
288 if (stable ||
type ==
'L' ||
type ==
'P' ||
type ==
']')
290 fputc (
'\n', stdout);
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
#define CADICAL_assert(ignore)
ABC_NAMESPACE_IMPL_START typedef signed char value
const char * magenta_code()
const char * normal_code()
void blue(bool bright=false)
void magenta(bool bright=false)
void red(bool bright=false)
void cyan(bool bright=false)
void green(bool bright=false)
void yellow(bool bright=false)
type
CUBE COVER and CUBE typedefs ///.
void report(char type, int verbose_level=0)