ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
decide.h File Reference
#include "global.h"
Include dependency graph for decide.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define INITIAL_PHASE   (GET_OPTION (phase) ? 1 : -1)
 

Functions

void kissat_decide (struct kissat *)
 
void kissat_start_random_sequence (struct kissat *)
 
void kissat_internal_assume (struct kissat *, unsigned lit)
 
unsigned kissat_next_decision_variable (struct kissat *)
 
int kissat_decide_phase (struct kissat *, unsigned idx)
 

Macro Definition Documentation

◆ INITIAL_PHASE

#define INITIAL_PHASE   (GET_OPTION (phase) ? 1 : -1)

Definition at line 15 of file decide.h.

Function Documentation

◆ kissat_decide()

void kissat_decide ( struct kissat * solver)

Definition at line 211 of file decide.c.

211 {
212 START (decide);
213 KISSAT_assert (solver->unassigned);
214 if (solver->warming)
215 INC (warming_decisions);
216 else {
217 INC (decisions);
218 if (solver->stable)
219 INC (stable_decisions);
220 else
221 INC (focused_decisions);
222 }
223 solver->level++;
225 const unsigned idx = kissat_next_decision_variable (solver);
226 const value value = kissat_decide_phase (solver, idx);
227 unsigned lit = LIT (idx);
228 if (value < 0)
229 lit = NOT (lit);
230 kissat_push_frame (solver, lit);
231 KISSAT_assert (solver->level < SIZE_STACK (solver->frames));
232 LOG ("decide literal %s", LOGLIT (lit));
234 STOP (decide);
235}
void kissat_assign_decision(kissat *solver, unsigned lit)
Definition assign.c:28
#define INVALID_LEVEL
Definition assign.h:12
#define SIZE_STACK(S)
Definition stack.h:19
#define INC(NAME)
#define LOG(...)
ABC_NAMESPACE_IMPL_START typedef signed char value
int kissat_decide_phase(kissat *solver, unsigned idx)
Definition decide.c:157
unsigned kissat_next_decision_variable(kissat *solver)
Definition decide.c:128
#define KISSAT_assert(ignore)
Definition global.h:13
#define solver
Definition kitten.c:211
#define LOGLIT(...)
Definition logging.hpp:99
#define STOP(P)
Definition profile.hpp:158
#define START(P)
Definition profile.hpp:150
int lit
Definition satVec.h:130
#define LIT(IDX)
Definition literal.h:31
#define NOT(LIT)
Definition literal.h:33
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kissat_decide_phase()

int kissat_decide_phase ( struct kissat * solver,
unsigned idx )

Definition at line 157 of file decide.c.

157 {
158 bool force = GET_OPTION (forcephase);
159
160 value *target;
161 if (force)
162 target = 0;
163 else if (!GET_OPTION (target))
164 target = 0;
165 else if (solver->stable || GET_OPTION (target) > 1)
166 target = solver->phases.target + idx;
167 else
168 target = 0;
169
170 value *saved;
171 if (force)
172 saved = 0;
173 else if (GET_OPTION (phasesaving))
174 saved = solver->phases.saved + idx;
175 else
176 saved = 0;
177
178 value res = 0;
179
180 if (!solver->stable) {
181 switch ((solver->statistics_.switched >> 1) & 7) {
182 case 1:
183 res = INITIAL_PHASE;
184 break;
185 case 3:
186 res = -INITIAL_PHASE;
187 break;
188 }
189 }
190
191 if (!res && target && (res = *target)) {
192 LOG ("%s uses target decision phase %d", LOGVAR (idx), (int) res);
193 INC (target_decisions);
194 }
195
196 if (!res && saved && (res = *saved)) {
197 LOG ("%s uses saved decision phase %d", LOGVAR (idx), (int) res);
198 INC (saved_decisions);
199 }
200
201 if (!res) {
202 res = INITIAL_PHASE;
203 LOG ("%s uses initial decision phase %d", LOGVAR (idx), (int) res);
204 INC (initial_decisions);
205 }
206 KISSAT_assert (res);
207
208 return res < 0 ? -1 : 1;
209}
#define INITIAL_PHASE
Definition decide.h:15
#define GET_OPTION(N)
Definition options.h:295
Here is the caller graph for this function:

◆ kissat_internal_assume()

void kissat_internal_assume ( struct kissat * solver,
unsigned lit )

Definition at line 237 of file decide.c.

237 {
238 KISSAT_assert (solver->unassigned);
240 solver->level++;
242 kissat_push_frame (solver, lit);
243 KISSAT_assert (solver->level < SIZE_STACK (solver->frames));
244 LOG ("assuming literal %s", LOGLIT (lit));
246}
#define VALUE(LIT)
Definition value.h:10
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kissat_next_decision_variable()

unsigned kissat_next_decision_variable ( struct kissat * solver)

Definition at line 128 of file decide.c.

128 {
129#ifdef LOGGING
130 const char *type = 0;
131#endif
132 unsigned res = next_random_decision (solver);
133 if (res == INVALID_IDX) {
134 if (solver->stable) {
135#ifdef LOGGING
136 type = "maximum score";
137#endif
138 res = largest_score_unassigned_variable (solver);
139 INC (score_decisions);
140 } else {
141#ifdef LOGGING
142 type = "dequeued";
143#endif
144 res = last_enqueued_unassigned_variable (solver);
145 INC (queue_decisions);
146 }
147 } else {
148#ifdef LOGGING
149 type = "random";
150#endif
151 INC (random_decisions);
152 }
153 LOG ("next %s decision %s", type, LOGVAR (res));
154 return res;
155}
type
CUBE COVER and CUBE typedefs ///.
Definition exor.h:90
#define INVALID_IDX
Definition literal.h:18
Here is the caller graph for this function:

◆ kissat_start_random_sequence()

void kissat_start_random_sequence ( struct kissat * solver)

Definition at line 59 of file decide.c.

59 {
60 if (!GET_OPTION (randec))
61 return;
62
63 if (solver->stable && !GET_OPTION (randecstable))
64 return;
65
66 if (!solver->stable && !GET_OPTION (randecfocused))
67 return;
68
69 if (solver->randec)
71 "continuing random decision sequence "
72 "at %s conflicts",
74 else {
75 INC (random_sequences);
76 const uint64_t count = solver->statistics_.random_sequences;
77 const unsigned length = GET_OPTION (randeclength) * LOGN (count);
79 "starting random decision sequence "
80 "at %s conflicts for %s conflicts",
82 solver->randec = length;
83
84 UPDATE_CONFLICT_LIMIT (randec, random_sequences, LOGN, false);
85 }
86}
#define FORMAT_COUNT(WORD)
Definition format.h:33
#define LOGN(COUNT)
Definition kimits.h:107
#define UPDATE_CONFLICT_LIMIT(NAME, COUNT, SCALE_COUNT_FUNCTION, SCALE_DELTA)
Definition kimits.h:115
#define kissat_very_verbose(...)
Definition print.h:52
#define CONFLICTS
Definition statistics.h:335
Here is the caller graph for this function: