Skip to content

Commit 315aa4b

Browse files
Add default literals and initialize engine with a variable and clause
1 parent a93a523 commit 315aa4b

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/lib.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ pub struct Lit {
6868
sign: bool,
6969
}
7070

71+
pub const TRUE_LIT: Lit = Lit { x: 0, sign: true };
72+
pub const FALSE_LIT: Lit = Lit { x: 0, sign: false };
73+
7174
impl Lit {
7275
pub fn new(x: usize, sign: bool) -> Self {
7376
Lit { x, sign }
@@ -186,7 +189,7 @@ impl Default for Engine {
186189

187190
impl Engine {
188191
pub fn new() -> Self {
189-
Engine {
192+
let mut e = Engine {
190193
assigns: Vec::new(),
191194
reason: Vec::new(),
192195
propagated_vars: Vec::new(),
@@ -198,7 +201,10 @@ impl Engine {
198201
prop_q: VecDeque::new(),
199202
learnt: Vec::new(),
200203
listeners: HashMap::new(),
201-
}
204+
};
205+
e.add_var();
206+
e.add_clause(vec![pos(0)]);
207+
e
202208
}
203209

204210
pub fn add_var(&mut self) -> usize {

0 commit comments

Comments
 (0)