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

Go to the source code of this file.

Functions

void kissat_backtrack_without_updating_phases (struct kissat *, unsigned)
 
void kissat_backtrack_in_consistent_state (struct kissat *, unsigned)
 
void kissat_backtrack_after_conflict (struct kissat *, unsigned)
 
void kissat_backtrack_propagate_and_flush_trail (struct kissat *)
 

Function Documentation

◆ kissat_backtrack_after_conflict()

void kissat_backtrack_after_conflict ( struct kissat * solver,
unsigned new_level )

Definition at line 158 of file backtrack.c.

158 {
159 if (solver->level)
161 kissat_update_target_and_best_phases (solver);
163}
void kissat_backtrack_without_updating_phases(kissat *solver, unsigned new_level)
Definition backtrack.c:74
#define solver
Definition kitten.c:211
Here is the call graph for this function:

◆ kissat_backtrack_in_consistent_state()

void kissat_backtrack_in_consistent_state ( struct kissat * solver,
unsigned new_level )

Definition at line 152 of file backtrack.c.

153 {
154 kissat_update_target_and_best_phases (solver);
156}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kissat_backtrack_propagate_and_flush_trail()

void kissat_backtrack_propagate_and_flush_trail ( struct kissat * solver)

Definition at line 165 of file backtrack.c.

165 {
166 if (solver->level) {
167 KISSAT_assert (solver->watching);
169#ifndef KISSAT_NDEBUG
170 clause *conflict =
171#endif
172 solver->probing ? kissat_probing_propagate (solver, 0, true)
174 KISSAT_assert (!conflict);
175 }
176
177 KISSAT_assert (kissat_propagated (solver));
178 KISSAT_assert (kissat_trail_flushed (solver));
179}
void kissat_backtrack_in_consistent_state(kissat *solver, unsigned new_level)
Definition backtrack.c:152
#define KISSAT_assert(ignore)
Definition global.h:13
clause * kissat_probing_propagate(kissat *solver, clause *ignore, bool flush)
Definition proprobe.c:37
clause * kissat_search_propagate(kissat *solver)
Definition propsearch.c:46
Here is the call graph for this function:
Here is the caller graph for this function:

◆ kissat_backtrack_without_updating_phases()

void kissat_backtrack_without_updating_phases ( struct kissat * solver,
unsigned new_level )

Definition at line 74 of file backtrack.c.

75 {
76 KISSAT_assert (solver->level >= new_level);
77 if (solver->level == new_level)
78 return;
79
80 LOG ("backtracking to decision level %u", new_level);
81
82 frame *new_frame = &FRAME (new_level + 1);
83 SET_END_OF_STACK (solver->frames, new_frame);
84
85 value *values = solver->values;
86 unsigned *trail = BEGIN_ARRAY (solver->trail);
87 unsigned *new_end = trail + new_frame->trail;
88 assigned *assigned = solver->assigned;
89
90 unsigned *old_end = END_ARRAY (solver->trail);
91 unsigned unassigned = 0, reassigned = 0;
92
93 unsigned *q = new_end;
94 if (solver->stable) {
96 for (const unsigned *p = q; p != old_end; p++) {
97 const unsigned lit = *p;
98 const unsigned idx = IDX (lit);
99 KISSAT_assert (idx < VARS);
100 struct assigned *a = assigned + idx;
101 const unsigned level = a->level;
102 if (level <= new_level) {
103 const unsigned new_trail = q - trail;
104 KISSAT_assert (new_trail <= a->trail);
105 a->trail = new_trail;
106 *q++ = lit;
107 LOG ("reassign %s", LOGLIT (lit));
108 reassigned++;
109 } else {
110 unassign (solver, values, lit);
111 add_unassigned_variable_back_to_heap (solver, scores, lit);
112 unassigned++;
113 }
114 }
115 } else {
116 links *links = solver->links;
117 for (const unsigned *p = q; p != old_end; p++) {
118 const unsigned lit = *p;
119 const unsigned idx = IDX (lit);
120 KISSAT_assert (idx < VARS);
121 struct assigned *a = assigned + idx;
122 const unsigned level = a->level;
123 if (level <= new_level) {
124 const unsigned new_trail = q - trail;
125 KISSAT_assert (new_trail <= a->trail);
126 a->trail = new_trail;
127 *q++ = lit;
128 LOG ("reassign %s", LOGLIT (lit));
129 reassigned++;
130 } else {
131 unassign (solver, values, lit);
132 add_unassigned_variable_back_to_queue (solver, links, lit);
133 unassigned++;
134 }
135 }
136 }
137 SET_END_OF_ARRAY (solver->trail, q);
138
139 solver->level = new_level;
140 LOG ("unassigned %u literals", unassigned);
141 LOG ("reassigned %u literals", reassigned);
142 (void) unassigned, (void) reassigned;
143
144 KISSAT_assert (new_end <= END_ARRAY (solver->trail));
145 LOG ("propagation will resume at trail position %zu",
146 (size_t) (new_end - trail));
147 solver->propagate = new_end;
148
149 KISSAT_assert (!solver->extended);
150}
#define SET_END_OF_ARRAY
Definition array.h:53
#define BEGIN_ARRAY
Definition array.h:50
#define END_ARRAY
Definition array.h:51
#define SET_END_OF_STACK(S, P)
Definition stack.h:62
#define LOG(...)
ABC_NAMESPACE_IMPL_START typedef signed char value
Cube * p
Definition exorList.c:222
#define FRAME(LEVEL)
Definition frames.h:33
#define VARS
Definition internal.h:250
#define SCORES
Definition internal.h:262
#define LOGLIT(...)
Definition logging.hpp:99
int lit
Definition satVec.h:130
#define IDX(LIT)
Definition literal.h:28
unsigned trail
Definition assign.h:20
unsigned level
Definition assign.h:19
Definition frames.h:15
unsigned trail
Definition frames.h:18
Definition heap.h:19
Here is the caller graph for this function: