From 18a2eaa392309eb19e8c47a34da820ad116f3963 Mon Sep 17 00:00:00 2001 From: Alexandre Dubray Date: Thu, 25 Jan 2024 15:36:11 +0100 Subject: [PATCH] update doc --- .github/workflows/publish.yml | 26 +++++++--- README.md | 91 +++-------------------------------- 2 files changed, 26 insertions(+), 91 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 27af3c8..52dd5d0 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,16 +1,28 @@ +# From https://github.com/zjp-CN/mdbook-template +# Simple workflow for deploying static content to GitHub Pages name: Deploy mdBook - on: + # Runs on pushes targeting the default branch push: - branches: [ "main" ] + branches: ["main"] + workflow_run: + workflows: ["Mdbook build"] jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: XAMPPRocky/deploy-mdbook@v1.1 + - uses: actions/checkout@v3 + - run: rustup toolchain update nightly && rustup default nightly + - run: cargo install mdbook + - name: Build mdbook + run: | + cd doc + mdbook build + - name: Deploy + uses: peaceiris/actions-gh-pages@v3 with: - token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: gh-pages + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: book/ + force_orphan: true diff --git a/README.md b/README.md index f354219..c03f9a7 100644 --- a/README.md +++ b/README.md @@ -1,91 +1,14 @@ ![Rust](https://github.com/AlexandreDubray/schlandals/actions/workflows/rust.yml/badge.svg) [![codecov](https://codecov.io/gh/AlexandreDubray/schlandals/branch/main/graph/badge.svg?token=J4J2I9Q9KX)](https://codecov.io/gh/AlexandreDubray/schlandals) -**The code is still in early development and should not be considered stable** - -# schlandals - -Schlandals is a projected weighted model counter which targets inference in probabilistic models. -Current known probability queries that can be solved with the solver include - - Computing the probability of some target variables (given some evidences) in a Bayesian network +Schlandals is a state-of-the-art _Projected Weighted Model Counter_ specialized for probabilistic inference over discrete probability distributions. +Currently, there are known modelization for the following problems + - Computing the marginal probabilities of a variable in a Bayesian Network - Computing the probability that two nodes are connected in a probabilistic graph - - A mapping from [ProbLog](https://github.com/ML-KULeuven/problog) programs to Schlandals - -# Problem specification - -A model counter is a program that counts the number of satisfying assignments of a boolean formula F. -In its projected version, the models are reduced to a subset of the variables (which we call *probabilistic*) and if the problem is weighted, each model has a weight -and the counter returns the sum of the model's weight. -In addition to that, we impose two more constraints - - All clauses in the formula F are Horn clauses (of the form `I => h` with `I` a conjuction of literals) - - The probabilistic variables are partioned into *distributions* such that the weights in each distribution sum up to 1 - -Schlandals takes as input a file using a modified version of the [DIMACS](https://mccompetition.org/assets/files/2021/competition2021.pdf) format -``` -c Lines starting with `c` alone are comments. -c The first line must be the head in the form of "p cnf -p cnf 16 11 -c The distribution are defined by lines starting with "c p distribution" -c Each value in a distribution is assigned to a variable, starting from 1. Hence, the first N variables -c are used for the distributions. -c p distribution 0.2 0.8 -c p distribution 0.3 0.7 -c p distribution 0.4 0.6 -c p distribution 0.1 0.9 -c p distribution 0.5 0.5 -c Finally the clauses are encoded as in DIMACS. -11 -1 0 -12 -2 0 -13 -11 -3 0 -13 -12 -5 0 -14 -11 -4 0 -14 -12 -6 0 -15 -13 -7 0 -15 -14 -9 0 -16 -13 -8 0 -16 -14 -10 0 --12 0 -``` - -# Usage - -To use the solver you must have the Rust toolchain installed. Once this is done you can clone this repository and build the solver with the following commands -``` -git clone git@github.com:aia-uclouvain/schlandals.git && cd schlandals && cargo build --release -``` -Once the command has been built, the binary is located in `/target/release/schlandals` (with `` the directory in which you cloned the repo). -If you want to be able to run Schlandals for anywhere, you can add `/target/release` to your `$PATH`. - -The binary's CLI arguments are organized by commands. Three commands are currently supported: `search` to solve the problem by a DPLL search, `compile` to compile the input into an arithmetic circuit and `read-compiled` to evaluate a previously compiled input. -These are explained next, after a quick note on the heuristics supported by the solver (for the `search` and `compile` sub-command) -### Heuristics - -Schlandals comes with various heuristic that can be used during the search/compilation. -The current heuristics are based on the implication graph of the input. In such graph, there is one node per clause and a link between clause C1 (I1 => h1) and C2 (I2 => h2) if the h1 is in I2. -The available heuristics are - - `min-in-degree`: Select a distribution from the clause with the lowest in degree. - - `min-out-degree`: Select a distribution from the clause with the lowest out degree. - - `max-degree`: Select a distribution from the clause with the highest degree. - -### Search - -`schlandals search -i -b [-s -m -b [--fdac --dotfile ]` can be used to compile the input problem as an arithmetic circuit. -The circuit can be stored in the file given by the `fdac` argument and a DOT visualization can be saved in the argument provided by the `dotfile` argument. - -### Reading a compiled file - -A previously compiled file can be read using `schlandals read-compiled -i [--dotfile