Skip to content

Commit 2ca5040

Browse files
committed
disable syrup on windows (need to make it work on unix though...)
1 parent c6b1b39 commit 2ca5040

File tree

2 files changed

+41
-24
lines changed

2 files changed

+41
-24
lines changed

src/solver/glucose/mod.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,28 @@ use super::config::Config;
2525
/// The Glucose solver
2626
pub struct Glucose {
2727
preprocessing: bool,
28+
syrup: bool,
2829
}
2930

3031
impl Glucose {
3132
pub fn new() -> Self {
3233
Glucose {
3334
preprocessing: false,
35+
syrup: false,
3436
}
3537
}
3638
pub fn enable_preprocessing(&mut self) {
3739
self.preprocessing = true;
3840
}
3941
}
4042

43+
#[cfg(not(target_os = "windows"))]
44+
impl Glucose {
45+
pub fn enable_syrup(&mut self) {
46+
self.syrup = true;
47+
}
48+
}
49+
4150
impl Solver for Glucose {
4251
fn solve_with_config(
4352
&self,
@@ -49,7 +58,7 @@ impl Solver for Glucose {
4958
unsafe {
5059
let ptr = bindings::glucose_new(
5160
self.preprocessing as i32,
52-
true as i32,
61+
self.syrup as i32,
5362
);
5463
let mut m_vars: HashMap<Var, i32> = HashMap::new();
5564
for clause in cnf.get_clauses() {

src/tests/mod.rs

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,32 +15,40 @@ fn test_solver<S: Solver>(solver: S) {
1515
];
1616
let models = solver.get_all_models(&mut cnf.clone());
1717
assert_eq!(models.len(), 2);
18-
// let cnf = cnf![
19-
// 1;
20-
// -1
21-
// ];
22-
// assert!(solver.solve(&cnf).is_none());
18+
let cnf = cnf![
19+
1;
20+
-1
21+
];
22+
assert!(solver.solve(&cnf).is_none());
2323
}
2424

2525
#[test]
2626
fn test_solvers() {
27-
// test_solver(DPLL::new());
28-
// test_solver(Minisat::new());
29-
// test_solver(Manysat::new());
30-
// test_solver(portfolio![
31-
// DPLL::new(),
32-
// Minisat::new(),
33-
// Manysat::new(),
34-
// ]);
35-
// test_solver(portfolio![Manysat::new()]);
27+
test_solver(DPLL::new());
28+
test_solver(Minisat::new());
29+
test_solver(Manysat::new());
30+
test_solver(portfolio![
31+
DPLL::new(),
32+
Minisat::new(),
33+
Manysat::new(),
34+
]);
35+
test_solver(portfolio![Manysat::new()]);
3636
test_solver(Glucose::new());
37-
// test_solver({
38-
// let mut s = Glucose::new();
39-
// s.enable_preprocessing();
40-
// s
41-
// });
42-
// test_solver(portfolio![
43-
// Glucose::new(),
44-
// DPLL::new(),
45-
// ]);
37+
test_solver({
38+
let mut s = Glucose::new();
39+
s.enable_preprocessing();
40+
s
41+
});
42+
{
43+
#[cfg(not(target_os = "windows"))]
44+
test_solver({
45+
let mut s = Glucose::new();
46+
s.enable_syrup();
47+
s
48+
});
49+
}
50+
test_solver(portfolio![
51+
Glucose::new(),
52+
DPLL::new(),
53+
]);
4654
}

0 commit comments

Comments
 (0)