ABC: A System for Sequential Synthesis and Verification
Loading...
Searching...
No Matches
cadical_flags.cpp
Go to the documentation of this file.
1
#include "
global.h
"
2
3
#include "
internal.hpp
"
4
5
ABC_NAMESPACE_IMPL_START
6
7
namespace
CaDiCaL
{
8
9
void
Internal::mark_fixed
(
int
lit
) {
10
if
(
external
->fixed_listener) {
11
int
elit =
externalize
(
lit
);
12
CADICAL_assert
(elit);
13
const
int
eidx = abs (elit);
14
if
(!
external
->ervars[eidx])
15
external
->fixed_listener->notify_fixed_assignment (elit);
16
}
17
Flags
&f =
flags
(
lit
);
18
CADICAL_assert
(f.
status
==
Flags::ACTIVE
);
19
f.
status
=
Flags::FIXED
;
20
LOG
(
"fixed %d"
, abs (
lit
));
21
stats
.all.fixed++;
22
stats
.now.fixed++;
23
stats
.inactive++;
24
CADICAL_assert
(
stats
.active);
25
stats
.active--;
26
CADICAL_assert
(!
active
(
lit
));
27
CADICAL_assert
(f.
fixed
());
28
29
if
(
external_prop
&&
private_steps
) {
30
// If pre/inprocessing found a fixed assignment, we want the propagator
31
// to know about it.
32
// But at that point it is not guaranteed to be already on the trail, so
33
// notification will happen only later.
34
CADICAL_assert
(!
level
);
35
}
36
}
37
38
void
Internal::mark_eliminated
(
int
lit
) {
39
Flags
&f =
flags
(
lit
);
40
CADICAL_assert
(f.
status
==
Flags::ACTIVE
);
41
f.
status
=
Flags::ELIMINATED
;
42
LOG
(
"eliminated %d"
, abs (
lit
));
43
stats
.all.eliminated++;
44
stats
.now.eliminated++;
45
stats
.inactive++;
46
CADICAL_assert
(
stats
.active);
47
stats
.active--;
48
CADICAL_assert
(!
active
(
lit
));
49
CADICAL_assert
(f.
eliminated
());
50
}
51
52
void
Internal::mark_pure
(
int
lit
) {
53
Flags
&f =
flags
(
lit
);
54
CADICAL_assert
(f.
status
==
Flags::ACTIVE
);
55
f.
status
=
Flags::PURE
;
56
LOG
(
"pure %d"
, abs (
lit
));
57
stats
.all.pure++;
58
stats
.now.pure++;
59
stats
.inactive++;
60
CADICAL_assert
(
stats
.active);
61
stats
.active--;
62
CADICAL_assert
(!
active
(
lit
));
63
CADICAL_assert
(f.
pure
());
64
}
65
66
void
Internal::mark_substituted
(
int
lit
) {
67
Flags
&f =
flags
(
lit
);
68
CADICAL_assert
(f.
status
==
Flags::ACTIVE
);
69
f.
status
=
Flags::SUBSTITUTED
;
70
LOG
(
"substituted %d"
, abs (
lit
));
71
stats
.all.substituted++;
72
stats
.now.substituted++;
73
stats
.inactive++;
74
CADICAL_assert
(
stats
.active);
75
stats
.active--;
76
CADICAL_assert
(!
active
(
lit
));
77
CADICAL_assert
(f.
substituted
());
78
}
79
80
void
Internal::mark_active
(
int
lit
) {
81
Flags
&f =
flags
(
lit
);
82
CADICAL_assert
(f.
status
==
Flags::UNUSED
);
83
f.
status
=
Flags::ACTIVE
;
84
LOG
(
"activate %d previously unused"
, abs (
lit
));
85
CADICAL_assert
(
stats
.inactive);
86
stats
.inactive--;
87
CADICAL_assert
(
stats
.unused);
88
stats
.unused--;
89
stats
.active++;
90
CADICAL_assert
(
active
(
lit
));
91
}
92
93
void
Internal::reactivate
(
int
lit
) {
94
CADICAL_assert
(!
active
(
lit
));
95
Flags
&f =
flags
(
lit
);
96
CADICAL_assert
(f.
status
!=
Flags::FIXED
);
97
CADICAL_assert
(f.
status
!=
Flags::UNUSED
);
98
#ifdef LOGGING
99
const
char
*msg = 0;
100
#endif
101
switch
(f.
status
) {
102
default
:
103
case
Flags::ELIMINATED
:
104
CADICAL_assert
(f.
status
==
Flags::ELIMINATED
);
105
CADICAL_assert
(
stats
.now.eliminated > 0);
106
stats
.now.eliminated--;
107
#ifdef LOGGING
108
msg =
"eliminated"
;
109
#endif
110
break
;
111
case
Flags::SUBSTITUTED
:
112
#ifdef LOGGING
113
msg =
"substituted"
;
114
#endif
115
CADICAL_assert
(
stats
.now.substituted > 0);
116
stats
.now.substituted--;
117
break
;
118
case
Flags::PURE
:
119
#ifdef LOGGING
120
msg =
"pure literal"
;
121
#endif
122
CADICAL_assert
(
stats
.now.pure > 0);
123
stats
.now.pure--;
124
break
;
125
}
126
#ifdef LOGGING
127
CADICAL_assert
(msg);
128
LOG
(
"reactivate previously %s %d"
, msg, abs (
lit
));
129
#endif
130
f.
status
=
Flags::ACTIVE
;
131
f.
sweep
=
false
;
132
CADICAL_assert
(
active
(
lit
));
133
stats
.reactivated++;
134
CADICAL_assert
(
stats
.inactive > 0);
135
stats
.inactive--;
136
stats
.active++;
137
}
138
139
}
// namespace CaDiCaL
140
141
ABC_NAMESPACE_IMPL_END
ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_START
Definition
abc_namespaces.h:54
ABC_NAMESPACE_IMPL_END
#define ABC_NAMESPACE_IMPL_END
Definition
abc_namespaces.h:55
global.h
CADICAL_assert
#define CADICAL_assert(ignore)
Definition
global.h:14
LOG
#define LOG(...)
Definition
cadical_kitten.c:368
internal.hpp
CaDiCaL
Definition
arena.hpp:8
CaDiCaL::flags
const char * flags()
Definition
cadical_version.cpp:109
lit
int lit
Definition
satVec.h:130
CaDiCaL::Flags
Definition
flags.hpp:10
CaDiCaL::Flags::FIXED
@ FIXED
Definition
flags.hpp:50
CaDiCaL::Flags::ELIMINATED
@ ELIMINATED
Definition
flags.hpp:51
CaDiCaL::Flags::ACTIVE
@ ACTIVE
Definition
flags.hpp:49
CaDiCaL::Flags::UNUSED
@ UNUSED
Definition
flags.hpp:48
CaDiCaL::Flags::SUBSTITUTED
@ SUBSTITUTED
Definition
flags.hpp:52
CaDiCaL::Flags::PURE
@ PURE
Definition
flags.hpp:53
CaDiCaL::Flags::eliminated
bool eliminated() const
Definition
flags.hpp:71
CaDiCaL::Flags::sweep
bool sweep
Definition
flags.hpp:28
CaDiCaL::Flags::substituted
bool substituted() const
Definition
flags.hpp:72
CaDiCaL::Flags::fixed
bool fixed() const
Definition
flags.hpp:70
CaDiCaL::Flags::status
unsigned char status
Definition
flags.hpp:56
CaDiCaL::Flags::pure
bool pure() const
Definition
flags.hpp:73
CaDiCaL::Internal::external
External * external
Definition
internal.hpp:312
CaDiCaL::Internal::mark_pure
void mark_pure(int)
Definition
cadical_flags.cpp:52
CaDiCaL::Internal::stats
Stats stats
Definition
internal.hpp:302
CaDiCaL::Internal::mark_active
void mark_active(int)
Definition
cadical_flags.cpp:80
CaDiCaL::Internal::externalize
int externalize(int lit)
Definition
internal.hpp:1557
CaDiCaL::Internal::mark_substituted
void mark_substituted(int)
Definition
cadical_flags.cpp:66
CaDiCaL::Internal::mark_eliminated
void mark_eliminated(int)
Definition
cadical_flags.cpp:38
CaDiCaL::Internal::level
int level
Definition
internal.hpp:219
CaDiCaL::Internal::active
bool active(int lit)
Definition
internal.hpp:360
CaDiCaL::Internal::mark_fixed
void mark_fixed(int)
Definition
cadical_flags.cpp:9
CaDiCaL::Internal::reactivate
void reactivate(int lit)
Definition
cadical_flags.cpp:93
CaDiCaL::Internal::external_prop
bool external_prop
Definition
internal.hpp:192
CaDiCaL::Internal::private_steps
bool private_steps
Definition
internal.hpp:196
src
sat
cadical
cadical_flags.cpp
Generated by Doxygen 1.13.2 © 2025 EPTansuo. All rights reserved.
鲁ICP备2021046540号