From 281402acd8cb6e084503952918833f8cc5e9e87d Mon Sep 17 00:00:00 2001 From: Alexandre Dubray Date: Sun, 14 Apr 2024 09:06:43 +0200 Subject: [PATCH] Revert "update doc + return 1.0 - proba" This reverts commit 8604505b301d06c77554f0dcc9dfd6c61a74e9b7. --- doc/src/modelization/bn.md | 6 +++--- src/lib.rs | 2 +- src/solvers/solver.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/src/modelization/bn.md b/doc/src/modelization/bn.md index b046b2e..7b284e8 100644 --- a/doc/src/modelization/bn.md +++ b/doc/src/modelization/bn.md @@ -24,8 +24,7 @@ On the other hand, the \\( \theta_{v}^{p_1, \ldots, p_n\} \\) variables are used ## The Clauses -While similar in WMC encodings, the clauses contain one significant difference; the head of the implication is a non-weighted variable. -This small difference is useful for the additional propagation performed by Schlandals. +While similar in WMC encodings, the clauses contain one significant difference. For each CPT entry of node \\( v \\), associated with value \\( v \\) and parents value \\( p_1, \ldots, p_n \\), we have the clause \\[ \lambda_{p_1} \land \ldots \land \lambda_{p_n} \land \theta_{v}^{p_1, \ldots, p_n} \implies \lambda_{v} \\] @@ -37,6 +36,7 @@ Let \\( V \\) have domain \\( v_1, \ldots, v_m \\). Then, to encode the query \\ The encoding (in DIMACS-style format) is show below for the query \\( P(D = d_0) \\). Notice that the probailistic variables start at 1 and are in contiguous blocks. +The ``` p cnf 26 19 @@ -81,7 +81,7 @@ c CPT for D. Variable for d_0 = 25, d_1 = 26 -17 -22 -24 25 0 -18 -22 -24 26 0 c Query --25 +-26 0 ``` ## References diff --git a/src/lib.rs b/src/lib.rs index 53d1e0d..d47183a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -93,6 +93,7 @@ fn _compile(compiler: GenericSolver, fdac: Option, dotfile: Option> = compile!(compiler); if let Some(ref mut dac) = &mut res { dac.evaluate(); + let proba = dac.circuit_probability().clone(); if let Some(f) = dotfile { let out = dac.as_graphviz(); let mut outfile = File::create(f).unwrap(); @@ -109,7 +110,6 @@ fn _compile(compiler: GenericSolver, fdac: Option, dotfile: Option Solver { let ub: Float = 1.0 - (preproc_out + p_out * preproc_in); let proba = (lb*ub).sqrt(); self.statistics.print(); - ProblemSolution::Ok(1.0 - proba) + ProblemSolution::Ok(proba) }, None => ProblemSolution::Err(Error::Timeout), }