ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
limit.hpp
Go to the documentation of this file.
1#ifndef _limit_hpp_INCLUDED
2#define _limit_hpp_INCLUDED
3
4#include "global.h"
5
6#include <cstdint>
7#include <limits>
8
10
11namespace CaDiCaL {
12
13struct Internal;
14
15struct Limit {
16
18
19 int64_t conflicts; // conflict limit if non-negative
20 int64_t decisions; // decision limit if non-negative
21 int64_t preprocessing; // limit on preprocessing rounds
22 int64_t localsearch; // limit on local search rounds
23
24 int64_t compact; // conflict limit for next 'compact'
25 int64_t condition; // conflict limit for next 'condition'
26 int64_t elim; // conflict limit for next 'elim'
27 int64_t flush; // conflict limit for next 'flush'
28 int64_t inprobe; // conflict limit for next 'inprobe'
29 int64_t reduce; // conflict limit for next 'reduce'
30 int64_t rephase; // conflict limit for next 'rephase'
31 int64_t report; // report limit for header
32 int64_t restart; // conflict limit for next 'restart'
33 int64_t stabilize; // conflict/ticks limit for next 'stabilize'
34
35 int keptsize; // maximum kept size in 'reduce'
36 int keptglue; // maximum kept glue in 'reduce'
37 int64_t recompute_tier; // conflict limit for next tier recomputation
38
39 // How often rephased during (1) or out (0) of stabilization.
40 //
41 int64_t rephased[2];
42
43 // Current elimination bound per eliminated variable.
44 //
45 int64_t elimbound;
46
47 struct {
48 int check; // countdown to next terminator call
49 int forced; // forced termination for testing
51
52 Limit ();
53};
54
55struct Delay {
56 struct {
57 int64_t interval = 0, limit = 0;
58 bool bypass = 0;
59
60 bool delay () {
61 if (bypass)
62 return true;
63 if (limit) {
64 --limit;
65 return true;
66 } else {
67 return false;
68 }
69 }
70
71 void bump_delay () {
72 interval += interval < INT64_MAX;
74 }
75
76 void reduce_delay () {
77 if (!interval)
78 return;
79 interval /= 2;
81 }
82
83 void bypass_delay () { bypass = 1; }
84 void unbypass_delay () { bypass = 0; }
86};
87
88struct Last {
89 struct {
90 int64_t propagations;
92 struct {
93 int64_t ticks;
94 } sweep, vivify, probe;
95 struct {
98 struct {
99 int64_t reductions;
101 struct {
102 int64_t conflicts;
104 struct {
105 int64_t ticks;
106 int64_t marked;
108 struct {
109 int64_t fixed;
111 struct {
112 int64_t marked, ticks;
114 struct {
115 int64_t conflicts;
116 int64_t ticks;
118 Last ();
119};
120
121struct Inc {
122 int64_t flush; // flushing interval in terms of conflicts
123 int64_t stabilize; // base ticks limit after first mode switch
124 int64_t conflicts; // next conflict limit if non-negative
125 int64_t decisions; // next decision limit if non-negative
126 int64_t preprocessing; // next preprocessing limit if non-negative
127 int64_t localsearch; // next local search limit if non-negative
128 Inc ();
129};
130
131#define SET_EFFORT_LIMIT(LIMIT, NAME, THRESHHOLD) \
132 int64_t LIMIT; \
133 do { \
134 const int64_t OLD_LIMIT = stats.ticks.NAME; \
135 const int64_t TICKS = stats.ticks.search[0] + stats.ticks.search[1]; \
136 const int64_t LAST = last.NAME.ticks; \
137 int64_t REFERENCE = TICKS - LAST; \
138 if (!REFERENCE || !stats.conflicts) { \
139 VERBOSE (2, "last %" PRId64 " current %" PRId64 " delta %" PRId64, \
140 LAST, TICKS, REFERENCE); \
141 REFERENCE = opts.preprocessinit; \
142 } \
143 const double EFFORT = (double) opts.NAME##effort * 1e-3; \
144 const int64_t DELTA = EFFORT * REFERENCE; \
145 const int64_t THRESH = opts.NAME##thresh * clauses.size (); \
146 if (THRESHHOLD && DELTA < THRESH) { \
147 VERBOSE (2, \
148 "delaying %s with ticklimit %" PRId64 \
149 " and threshhold %" PRId64, \
150 #NAME, DELTA, THRESH); \
151 return false; \
152 } \
153 last.NAME.ticks = TICKS; \
154 const int64_t NEW_LIMIT = OLD_LIMIT + DELTA; \
155 LIMIT = NEW_LIMIT; \
156 } while (0)
157
158} // namespace CaDiCaL
159
161
162#endif
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
pcover reduce()
void bump_delay()
Definition delay.hpp:27
struct CaDiCaL::Delay::@023145341024155326233124040104204204140264337337 bumpreasons
void reduce_delay()
Definition delay.hpp:32
bool delay()
Definition delay.hpp:18
int64_t interval
Definition limit.hpp:57
int64_t limit
Definition limit.hpp:57
int64_t localsearch
Definition limit.hpp:127
int64_t flush
Definition limit.hpp:122
int64_t preprocessing
Definition limit.hpp:126
int64_t decisions
Definition limit.hpp:125
int64_t conflicts
Definition limit.hpp:124
int64_t stabilize
Definition limit.hpp:123
struct CaDiCaL::Last::@156160031267105042317117255050355160264076056371 transred
int64_t ticks
Definition limit.hpp:93
struct CaDiCaL::Last::@317021245123244156062364222120070074200001137267 ternary
struct CaDiCaL::Last::@362302366302035213075321046115002233176006321123 stabilize
int64_t fixed
Definition limit.hpp:96
int64_t reductions
Definition limit.hpp:99
struct CaDiCaL::Last::@351203175114333346166001304255364112177261314217 vivify
struct CaDiCaL::Last::@235010264135010004241237041042103045330253347151 collect
struct CaDiCaL::Last::@351203175114333346166001304255364112177261314217 sweep
struct CaDiCaL::Last::@224314137132165170305120336345210056255076056306 elim
int64_t propagations
Definition limit.hpp:90
struct CaDiCaL::Last::@363051353132072302272051137006035041002174316130 factor
int64_t conflicts
Definition limit.hpp:102
struct CaDiCaL::Last::@165233276201021203155240344345155226115225256115 inprobe
int64_t marked
Definition limit.hpp:96
int64_t subsumephases
Definition limit.hpp:96
struct CaDiCaL::Last::@005161107334145026316045161200024243220261243123 rephase
int64_t reduce
Definition limit.hpp:29
int64_t inprobe
Definition limit.hpp:28
int64_t rephase
Definition limit.hpp:30
bool initialized
Definition limit.hpp:17
int64_t conflicts
Definition limit.hpp:19
int64_t flush
Definition limit.hpp:27
int64_t elimbound
Definition limit.hpp:45
int64_t condition
Definition limit.hpp:25
struct CaDiCaL::Limit::@006061202011015156145164246241001217360323364254 terminate
int64_t stabilize
Definition limit.hpp:33
int64_t preprocessing
Definition limit.hpp:21
int64_t report
Definition limit.hpp:31
int64_t decisions
Definition limit.hpp:20
int64_t recompute_tier
Definition limit.hpp:37
int64_t localsearch
Definition limit.hpp:22
int64_t restart
Definition limit.hpp:32
int64_t elim
Definition limit.hpp:26
int64_t rephased[2]
Definition limit.hpp:41
int64_t compact
Definition limit.hpp:24