ABC: A System for Sequential Synthesis and Verification
Loading...
Searching...
No Matches
queue.hpp
Go to the documentation of this file.
1
#ifndef _queue_hpp_INCLUDED
2
#define _queue_hpp_INCLUDED
3
4
#include "
global.h
"
5
6
#include <vector>
7
8
ABC_NAMESPACE_CXX_HEADER_START
9
10
namespace
CaDiCaL
{
11
12
// Links for double linked decision queue.
13
14
struct
Link
{
15
16
int
prev
,
next
;
// variable indices
17
18
// initialized explicitly in 'init_queue'
19
};
20
21
typedef
std::vector<Link>
Links
;
22
23
// Variable move to front (VMTF) decision queue ordered by 'bumped'. See
24
// our SAT'15 paper for an explanation on how this works.
25
26
struct
Queue
{
27
28
// We use integers instead of variable pointers. This is more compact and
29
// also avoids issues due to moving the variable table during 'resize'.
30
31
int
first
,
last
;
// anchors (head/tail) for doubly linked list
32
int
unassigned
;
// all variables after this one are assigned
33
int64_t
bumped
;
// see 'Internal.update_queue_unassigned'
34
35
Queue
() :
first
(0),
last
(0),
unassigned
(0),
bumped
(0) {}
36
37
// We explicitly provide the mapping of integer indices to links to the
38
// following two (inlined) functions. This avoids including
39
// 'internal.hpp' and breaks a cyclic dependency, so we can keep their
40
// code here in this header file. Otherwise they are just ordinary doubly
41
// linked list 'dequeue' and 'enqueue' operations.
42
43
inline
void
dequeue
(
Links
&
links
,
int
idx) {
44
Link
&l =
links
[idx];
45
if
(l.
prev
)
46
links
[l.
prev
].
next
= l.
next
;
47
else
48
first
= l.
next
;
49
if
(l.
next
)
50
links
[l.
next
].
prev
= l.
prev
;
51
else
52
last
= l.
prev
;
53
}
54
55
inline
void
enqueue
(
Links
&
links
,
int
idx) {
56
Link
&l =
links
[idx];
57
if
((l.
prev
=
last
))
58
links
[
last
].
next
= idx;
59
else
60
first
= idx;
61
last
= idx;
62
l.
next
= 0;
63
}
64
};
65
66
}
// namespace CaDiCaL
67
68
ABC_NAMESPACE_CXX_HEADER_END
69
70
#endif
ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_START
Definition
abc_namespaces.h:52
ABC_NAMESPACE_CXX_HEADER_END
#define ABC_NAMESPACE_CXX_HEADER_END
Definition
abc_namespaces.h:53
global.h
CaDiCaL
Definition
arena.hpp:8
CaDiCaL::Links
std::vector< Link > Links
Definition
queue.hpp:21
CaDiCaL::Link
Definition
queue.hpp:14
CaDiCaL::Link::next
int next
Definition
queue.hpp:16
CaDiCaL::Link::prev
int prev
Definition
queue.hpp:16
CaDiCaL::Queue::first
int first
Definition
queue.hpp:31
CaDiCaL::Queue::dequeue
void dequeue(Links &links, int idx)
Definition
queue.hpp:43
CaDiCaL::Queue::bumped
int64_t bumped
Definition
queue.hpp:33
CaDiCaL::Queue::Queue
Queue()
Definition
queue.hpp:35
CaDiCaL::Queue::unassigned
int unassigned
Definition
queue.hpp:32
CaDiCaL::Queue::enqueue
void enqueue(Links &links, int idx)
Definition
queue.hpp:55
CaDiCaL::Queue::last
int last
Definition
queue.hpp:31
links
Definition
queue.h:15
links::prev
unsigned prev
Definition
queue.h:16
links::next
unsigned next
Definition
queue.h:16
src
sat
cadical
queue.hpp
Generated by Doxygen 1.13.2 © 2025 EPTansuo. All rights reserved.
鲁ICP备2021046540号