Skip to content

Commit

Permalink
Revert "update doc + return 1.0 - proba"
Browse files Browse the repository at this point in the history
This reverts commit 8604505.
  • Loading branch information
AlexandreDubray committed Apr 14, 2024
1 parent 8604505 commit 281402a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions doc/src/modelization/bn.md
Original file line number Diff line number Diff line change
Expand Up @@ -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} \\]

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ fn _compile(compiler: GenericSolver, fdac: Option<PathBuf>, dotfile: Option<Path
let mut res: Option<Dac<Float>> = 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();
Expand All @@ -109,7 +110,6 @@ fn _compile(compiler: GenericSolver, fdac: Option<PathBuf>, dotfile: Option<Path
}

}
let proba = 1.0 - dac.circuit_probability().clone();
ProblemSolution::Ok(proba)
} else {
ProblemSolution::Err(Error::Timeout)
Expand Down
2 changes: 1 addition & 1 deletion src/solvers/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<B: BranchingDecision, const S: bool> Solver<B, S> {
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),
}
Expand Down

0 comments on commit 281402a

Please sign in to comment.