| Crates.io | p2d_opb |
| lib.rs | p2d_opb |
| version | 0.2.0 |
| created_at | 2025-11-24 13:12:39.735029+00 |
| updated_at | 2025-11-25 11:14:26.100076+00 |
| description | A representation of OPB formulas |
| homepage | |
| repository | https://github.com/TUBS-ISF/p2d.git |
| max_upload_size | |
| id | 1947782 |
| size | 19,671 |
Our tool p2d can be used for d-DNNF compilation or model counting on a pseudo-Boolean formula. A pseudo-Boolean formula is a conjunction of inequalities following the structure seen below.
$$\sum_{i=1}^n a_i \cdot v_i \geq b$$
Here, $a_i$ and b are numeric constants and $v_i$ are oolean variables. Pseudo-Boolean formulas are a generalization of CNFs as each clause $(v_1 \vee \ldots \vee v_n)$ can be represented as $\sum_{i=1}^n 1 \cdot v_i \geq 1$.
In general, the dependencies are managed with cargo. For hypergraph partioning, p2d uses the patoh library which cannot directly include it due to licensing issues. To also use patoh follow these steps:
<PROJECT_ROOT>/p2d/lib/patoh/Compile the project: cargo build --release
Compile a d-DNNF: p2d /file.opb -m ddnnf -o file.nnf
Perform model counting: p2d /file.opb -m mc
Print help: p2d -h
Our compiler p2d takes pseudo-Boolean formulas in the .opb format as input.
Consider this small example for a pseudo-Boolean formula in the .opb format:
# variable = 7 # constraint = 2
x + 2 a + b + c >= 3;
-d -2 * f + 1 * " var_name !" >= 1;
For more details, check the grammar we use.