ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
kimits.c File Reference
#include "internal.h"
#include "logging.h"
#include "mode.h"
#include "print.h"
#include "reduce.h"
#include "rephase.h"
#include "resources.h"
#include "restart.h"
#include <inttypes.h>
#include <math.h>
Include dependency graph for kimits.c:

Go to the source code of this file.

Macros

#define INIT_CONFLICT_LIMIT(NAME, SCALE)
 
#define VERY_VERBOSE_IF_NOT_BUMPREASONS(...)
 

Functions

ABC_NAMESPACE_IMPL_START double kissat_logn (uint64_t count)
 
double kissat_sqrt (uint64_t count)
 
double kissat_nlogpown (uint64_t count, unsigned exponent)
 
uint64_t kissat_scale_delta (kissat *solver, const char *pretty, uint64_t delta)
 
void kissat_init_limits (kissat *solver)
 
void kissat_reduce_delay (kissat *solver, delay *delay)
 
void kissat_bump_delay (kissat *solver, delay *delay)
 
bool kissat_delaying (kissat *solver, delay *delay)
 

Macro Definition Documentation

◆ INIT_CONFLICT_LIMIT

#define INIT_CONFLICT_LIMIT ( NAME,
SCALE )
Value:
do { \
const uint64_t DELTA = GET_OPTION (NAME##init); \
const uint64_t SCALED = \
!(SCALE) ? DELTA : kissat_scale_delta (solver, #NAME, DELTA); \
limits->NAME.conflicts = CONFLICTS + SCALED; \
kissat_very_verbose (solver, \
"initial " #NAME " limit of %s conflicts", \
} while (0)
#define FORMAT_COUNT(WORD)
Definition format.h:33
@ NAME
Definition inflate.h:29
uint64_t kissat_scale_delta(kissat *solver, const char *pretty, uint64_t delta)
Definition kimits.c:41
#define solver
Definition kitten.c:211
#define GET_OPTION(N)
Definition options.h:295
#define CONFLICTS
Definition statistics.h:335
uint64_t conflicts
Definition kimits.h:27

Definition at line 90 of file kimits.c.

90#define INIT_CONFLICT_LIMIT(NAME, SCALE) \
91 do { \
92 const uint64_t DELTA = GET_OPTION (NAME##init); \
93 const uint64_t SCALED = \
94 !(SCALE) ? DELTA : kissat_scale_delta (solver, #NAME, DELTA); \
95 limits->NAME.conflicts = CONFLICTS + SCALED; \
96 kissat_very_verbose (solver, \
97 "initial " #NAME " limit of %s conflicts", \
98 FORMAT_COUNT (limits->NAME.conflicts)); \
99 } while (0)

◆ VERY_VERBOSE_IF_NOT_BUMPREASONS

#define VERY_VERBOSE_IF_NOT_BUMPREASONS ( ...)
Value:
VERY_VERBOSE_OR_LOG (delay == &solver->delays.bumpreasons, __VA_ARGS__)
#define VERY_VERBOSE_OR_LOG(ONLY_LOG, SOLVER,...)
Definition print.h:58
Definition kimits.h:71

Definition at line 154 of file kimits.c.

154#define VERY_VERBOSE_IF_NOT_BUMPREASONS(...) \
155 VERY_VERBOSE_OR_LOG (delay == &solver->delays.bumpreasons, __VA_ARGS__)

Function Documentation

◆ kissat_bump_delay()

void kissat_bump_delay ( kissat * solver,
delay * delay )

Definition at line 170 of file kimits.c.

170 {
171 delay->current += delay->current < UINT_MAX;
173 solver, "%s delay interval increased to %u",
174 delay_description (solver, delay), delay->current);
176#ifdef KISSAT_QUIET
177 (void) solver;
178#endif
179}
#define VERY_VERBOSE_IF_NOT_BUMPREASONS(...)
Definition kimits.c:154
unsigned current
Definition kimits.h:73
unsigned count
Definition kimits.h:72

◆ kissat_delaying()

bool kissat_delaying ( kissat * solver,
delay * delay )

Definition at line 181 of file kimits.c.

181 {
182 if (delay->count) {
183 delay->count--;
185 solver, "%s still delayed (%u more times)",
186 delay_description (solver, delay), delay->current);
187 return true;
188 } else {
189 VERY_VERBOSE_IF_NOT_BUMPREASONS (solver, "%s not delayed",
190 delay_description (solver, delay));
191 return false;
192 }
193#ifdef KISSAT_QUIET
194 (void) solver;
195#endif
196}

◆ kissat_init_limits()

void kissat_init_limits ( kissat * solver)

Definition at line 101 of file kimits.c.

101 {
102 KISSAT_assert (solver->statistics_.searches == 1);
103
104 init_enabled (solver);
105
106 limits *limits = &solver->limits;
107
108 if (GET_OPTION (randec))
109 INIT_CONFLICT_LIMIT (randec, false);
110
111 if (GET_OPTION (reduce))
113
114 if (GET_OPTION (reorder))
115 INIT_CONFLICT_LIMIT (reorder, false);
116
117 if (GET_OPTION (rephase))
118 INIT_CONFLICT_LIMIT (rephase, false);
119
120 if (!solver->stable)
122
124
125 if (solver->enabled.eliminate) {
126 INIT_CONFLICT_LIMIT (eliminate, true);
127 solver->bounds.eliminate.max_bound_completed = 0;
128 solver->bounds.eliminate.additional_clauses = 0;
129 kissat_very_verbose (solver, "reset elimination bound to zero");
130 }
131
132 if (solver->enabled.probe)
133 INIT_CONFLICT_LIMIT (probe, true);
134}
pcover reduce()
#define INIT_CONFLICT_LIMIT(NAME, SCALE)
Definition kimits.c:90
#define KISSAT_assert(ignore)
Definition global.h:13
ABC_NAMESPACE_IMPL_START void kissat_init_mode_limit(kissat *solver)
Definition mode.c:21
#define kissat_very_verbose(...)
Definition print.h:52
void kissat_update_focused_restart_limit(kissat *solver)
Definition restart.c:41
Here is the call graph for this function:

◆ kissat_logn()

ABC_NAMESPACE_IMPL_START double kissat_logn ( uint64_t count)

Definition at line 15 of file kimits.c.

15 {
16 KISSAT_assert (count > 0);
17 const double res = log10 (count + 9);
18 KISSAT_assert (res >= 1);
19 return res;
20}
Here is the caller graph for this function:

◆ kissat_nlogpown()

double kissat_nlogpown ( uint64_t count,
unsigned exponent )

Definition at line 29 of file kimits.c.

29 {
30 KISSAT_assert (count > 0);
31 const double tmp = log10 (count + 9);
32 double factor = 1;
33 while (exponent--)
34 factor *= tmp;
35 KISSAT_assert (factor >= 1);
36 const double res = count * factor;
37 KISSAT_assert (res >= 1);
38 return res;
39}

◆ kissat_reduce_delay()

void kissat_reduce_delay ( kissat * solver,
delay * delay )

Definition at line 157 of file kimits.c.

157 {
158 if (!delay->current)
159 return;
160 delay->current /= 2;
162 solver, "%s delay interval decreased to %u",
163 delay_description (solver, delay), delay->current);
165#ifdef KISSAT_QUIET
166 (void) solver;
167#endif
168}

◆ kissat_scale_delta()

uint64_t kissat_scale_delta ( kissat * solver,
const char * pretty,
uint64_t delta )

Definition at line 41 of file kimits.c.

42 {
43 const uint64_t C = BINIRR_CLAUSES;
44 double f = kissat_logn (C + 1) - 5;
45 const double ff = f * f;
46 KISSAT_assert (ff >= 0);
47 const double fff = 4.5 * ff + 25;
48 uint64_t scaled = fff * delta;
49 KISSAT_assert (delta <= scaled);
50 // clang-format off
52 "scaled %s delta %" PRIu64
53 " = %g * %" PRIu64
54 " = (4.5 (log10(%" PRIu64 ") - 5)^2 + 25) * %" PRIu64,
55 pretty, scaled, fff, delta, C, delta);
56 // clang-format on
57 (void) pretty;
58 return scaled;
59}
ABC_NAMESPACE_IMPL_START double kissat_logn(uint64_t count)
Definition kimits.c:15
#define BINIRR_CLAUSES
Definition statistics.h:341
Here is the call graph for this function:

◆ kissat_sqrt()

double kissat_sqrt ( uint64_t count)

Definition at line 22 of file kimits.c.

22 {
23 KISSAT_assert (count > 0);
24 const double res = sqrt (count);
25 KISSAT_assert (res >= 1);
26 return res;
27}