ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
dimacs_cnf.h
Go to the documentation of this file.
1
/**
2
* @file dimacs_cnf.h
3
* @brief Parse a DIMACS CNF into a ProvSQL @c BooleanCircuit.
4
*
5
* Reads the @c "p cnf" header, the clause lines, and the Model Counting
6
* Competition weight lines (@c "c p weight <lit> <w> 0"). Builds an
7
* AND-of-OR-of-literal Boolean circuit: one @c IN gate per variable, a shared
8
* @c NOT per negated variable, an @c OR per clause, and an @c AND root.
9
*
10
* For weighted model counting (@p weighted) each input gate's probability is
11
* set to the weight of its positive literal, defaulting to 0.5 when no weight
12
* is given; ProvSQL's evaluator then takes the complementary weight @c 1-p for
13
* the negative literal (the probability model the @c "c p weight" lines
14
* ProvSQL itself emits already satisfy). Used by the @c tdkc KCMCP server.
15
*/
16
#ifndef PROVSQL_DIMACS_CNF_H
17
#define PROVSQL_DIMACS_CNF_H
18
19
#include <string>
20
21
#include "
BooleanCircuit.h
"
22
23
/**
24
* @brief Parse @p text (a DIMACS CNF) into @p c and return the root gate.
25
* @throws std::runtime_error on a malformed input.
26
*/
27
gate_t
parse_dimacs_cnf
(
const
std::string &text,
BooleanCircuit
&c,
28
bool
weighted);
29
30
#endif
BooleanCircuit.h
Boolean provenance circuit with support for knowledge compilation.
gate_t
gate_t
Strongly-typed gate identifier.
Definition
Circuit.h:49
BooleanCircuit
Boolean circuit for provenance formula evaluation.
Definition
BooleanCircuit.h:74
parse_dimacs_cnf
gate_t parse_dimacs_cnf(const std::string &text, BooleanCircuit &c, bool weighted)
Parse text (a DIMACS CNF) into c and return the root gate.
Definition
dimacs_cnf.cpp:33
Home
·
Documentation
·
Publications
·
Contributors
·
Source
·
Cite