Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to Tractables #110

Merged
merged 7 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 48 additions & 26 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,56 @@
name: Unit Tests

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request:
name: Unit Tests
on:
push:
branches: [master]
tags: ["*"]
pull_request:
workflow_dispatch:


permissions:
actions: write
contents: read
env:
DATADEPS_ALWAYS_ACCEPT: 1
JIVE_PROCS: 1

jobs:
build:
runs-on: ubuntu-latest

test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
version:
- '1.6'
- '1'
- 'nightly'
os:
- ubuntu-latest
arch:
- x64
steps:

- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@latest
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v2
with:
version: 1.6

# Runs a single command using the runners shell
- name: Unit Tests
run: |
julia --project --check-bounds=yes --depwarn=yes -e 'import Pkg; Pkg.test(; coverage=true)'

- name: Codecov Upload
run: |
julia -e 'using Pkg; Pkg.add("Coverage"); using Coverage; Codecov.submit(process_folder());'

version: ${{ matrix.version }}
arch: ${{ matrix.arch }}
- uses: julia-actions/cache@v1
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v2
with:
file: lcov.info
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/julia-buildpkg@latest
- run: |
sudo apt-get -qq update
sudo apt install -y pdf2svg texlive-latex-base texlive-binaries texlive-pictures texlive-latex-extra texlive-luatex
luatex -v
pdflatex -v
- uses: julia-actions/julia-docdeploy@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
13 changes: 8 additions & 5 deletions .github/workflows/compathelper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ name: CompatHelper
on:
schedule:
- cron: '0 0 */7 * *'

workflow_dispatch:


permissions:
contents: write
pull-requests: write

jobs:
CompatHelper:
runs-on: ubuntu-latest

steps:
- name: Pkg.add("CompatHelper")
run: julia -e 'using Pkg; Pkg.add("CompatHelper")'

- name: CompatHelper.main()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMPATHELPER_PRIV: ${{ secrets.DOCUMENTER_KEY }}

run: julia -e 'using CompatHelper; CompatHelper.main()'
18 changes: 17 additions & 1 deletion .github/workflows/tagbot.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
name: TagBot
on:
issue_comment: # THIS BIT IS NEW
issue_comment:
types:
- created
workflow_dispatch:
inputs:
lookback:
default: 3
permissions:
actions: read
checks: read
contents: write
deployments: read
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs:
TagBot:
if: github.event_name == 'workflow_dispatch' || github.actor == 'JuliaTagBot'
Expand Down
11 changes: 8 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LogicCircuits"
uuid = "a7847b3b-b7f1-4dd5-83c3-60e0aa0f8599"
authors = ["Guy Van den Broeck <[email protected]>"]
version = "0.3.3"
version = "0.4.0"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
Expand All @@ -23,10 +23,10 @@ TikzGraphs = "b4f28e30-c73f-5eaf-a395-8a9db949a742"

[compat]
CSV = "0.7, 0.8, 0.9, 0.10"
CUDA = "3"
CUDA = "3, 5"
CodecZlib = "0.7"
DataFrames = "1.1, 1.2"
DirectedAcyclicGraphs = "0.1.2"
DirectedAcyclicGraphs = "0.2"
Graphs = "1.4"
Lerche = "0.5"
LoopVectorization = "0.12"
Expand All @@ -35,3 +35,8 @@ StatsFuns = "0.9"
Tables = "1"
TikzGraphs = "1.3"
julia = "1.6"
LazyArtifacts = "1"
Statistics = "1"
Random = "1"
Pkg = "1"

14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

# Logic<wbr>Circuits<wbr>.jl

[![Unit Tests](https://github.com/Juice-jl/LogicCircuits.jl/workflows/Unit%20Tests/badge.svg)](https://github.com/Juice-jl/LogicCircuits.jl/actions?query=workflow%3A%22Unit+Tests%22+branch%3Amaster) [![codecov](https://codecov.io/gh/Juice-jl/LogicCircuits.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/Juice-jl/LogicCircuits.jl) [![](https://img.shields.io/badge/docs-stable-green.svg)](https://juice-jl.github.io/LogicCircuits.jl/stable) [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://juice-jl.github.io/LogicCircuits.jl/dev)
[![Unit Tests](https://github.com/Tractables/LogicCircuits.jl/workflows/Unit%20Tests/badge.svg)](https://github.com/Tractables/LogicCircuits.jl/actions?query=workflow%3A%22Unit+Tests%22+branch%3Amaster) [![codecov](https://codecov.io/gh/Tractables/LogicCircuits.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/Tractables/LogicCircuits.jl) [![](https://img.shields.io/badge/docs-stable-green.svg)](https://Tractables.github.io/LogicCircuits.jl/stable) [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://Tractables.github.io/LogicCircuits.jl/dev)

This package provides basic functionality for doing logical reasoning using logical circuits. It has the stand-alone functionality illustrated below, and it serves as the logical foundations for other [Juice packages](https://github.com/Juice-jl) (Julia Circuit Empanada).
This package provides basic functionality for doing logical reasoning using logical circuits. It has the stand-alone functionality illustrated below, and it serves as the logical foundations for other [Juice packages](https://github.com/Tractables) (Julia Circuit Empanada).

## Quick Tutorial [![Open Notebook](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/Juice-jl/LogicCircuits.jl/blob/gh-pages/dev/generated/usage.ipynb)
## Quick Tutorial [![Open Notebook](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/Tractables/LogicCircuits.jl/blob/gh-pages/dev/generated/usage.ipynb)

Assuming that the LogicCircuits Julia package has been installed with `julia -e 'using Pkg; Pkg.add("LogicCircuits")'`, we can start using it as follows.

Expand Down Expand Up @@ -43,7 +43,7 @@ circuit(true, true, true) # sun is true, rain is true, rainbow is true
true
````

The purpose of this package, however, is to enable more interesting inference scenarios. This is possible by ensuring that the circuit has certain [properties](https://juice-jl.github.io/LogicCircuits.jl/dev/manual/properties/), such as *decomposability*, *determinism*, and more.
The purpose of this package, however, is to enable more interesting inference scenarios. This is possible by ensuring that the circuit has certain [properties](https://Tractables.github.io/LogicCircuits.jl/dev/manual/properties/), such as *decomposability*, *determinism*, and more.
Our current circuit happens to already be decomposable and deterministic by construction:

````julia
Expand Down Expand Up @@ -109,7 +109,7 @@ Incorporating these constraints has increased the size of our circuit.
plot(circuit; simplify=true)
```

<img src="https://juice-jl.github.io/LogicCircuits.jl/dev/generated/example-circuit.svg" alt="Example Logic Circuit">
<img src="https://Tractables.github.io/LogicCircuits.jl/dev/generated/example-circuit.svg" alt="Example Logic Circuit">

Crucially, the circuit is still decomposable and deterministic.

Expand Down Expand Up @@ -176,11 +176,11 @@ circuit = compile(manager, zoo_cnf("iscas89/s208.1.scan.cnf")) # CNF has 285 cla
* Algorithms that transform circuits in non-trivial ways (split, clone, smooth, condition, etc.), verify and enforce structural properties.
* Functionality to load and save circuits in various file formats

Please see [![](https://img.shields.io/badge/docs-stable-green.svg)](https://juice-jl.github.io/LogicCircuits.jl/stable) or [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://juice-jl.github.io/LogicCircuits.jl/dev) for further details.
Please see [![](https://img.shields.io/badge/docs-stable-green.svg)](https://Tractables.github.io/LogicCircuits.jl/stable) or [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://Tractables.github.io/LogicCircuits.jl/dev) for further details.

## Development

If you are interested in modifying the package please see the [development readme](https://juice-jl.github.io/LogicCircuits.jl/dev/development/).
If you are interested in modifying the package please see the [development readme](https://Tractables.github.io/LogicCircuits.jl/dev/development/).

## Acknowledgements

Expand Down
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pages = [

format = Documenter.HTML(
prettyurls = !("local" in ARGS),
canonical = "https://juice-jl.github.io/LogicCircuits.jl/stable/",
canonical = "https://Tractables.github.io/LogicCircuits.jl/stable/",
assets = ["assets/favicon.ico"],
analytics = "UA-136089579-2",
highlights = ["yaml"],
Expand Down Expand Up @@ -103,7 +103,7 @@ makedocs(
# for more information.
deploydocs(
target = "build",
repo = "github.com/Juice-jl/LogicCircuits.jl.git",
repo = "github.com/Tractables/LogicCircuits.jl.git",
branch = "gh-pages",
devbranch = "master",
devurl = "dev",
Expand Down
8 changes: 4 additions & 4 deletions docs/src/README.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

# # Logic<wbr>Circuits<wbr>.jl

# [![Unit Tests](https://github.com/Juice-jl/LogicCircuits.jl/workflows/Unit%20Tests/badge.svg)](https://github.com/Juice-jl/LogicCircuits.jl/actions?query=workflow%3A%22Unit+Tests%22+branch%3Amaster) [![codecov](https://codecov.io/gh/Juice-jl/LogicCircuits.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/Juice-jl/LogicCircuits.jl) [![](https://img.shields.io/badge/docs-stable-green.svg)](https://juice-jl.github.io/LogicCircuits.jl/stable) [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://juice-jl.github.io/LogicCircuits.jl/dev)
# [![Unit Tests](https://github.com/Tractables/LogicCircuits.jl/workflows/Unit%20Tests/badge.svg)](https://github.com/Tractables/LogicCircuits.jl/actions?query=workflow%3A%22Unit+Tests%22+branch%3Amaster) [![codecov](https://codecov.io/gh/Tractables/LogicCircuits.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/Tractables/LogicCircuits.jl) [![](https://img.shields.io/badge/docs-stable-green.svg)](https://Tractables.github.io/LogicCircuits.jl/stable) [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://Tractables.github.io/LogicCircuits.jl/dev)

# This package provides basic functionality for doing logical reasoning using logical circuits. It has the stand-alone functionality illustrated below, and it serves as the logical foundations for other [Juice packages](https://github.com/Juice-jl) (Julia Circuit Empanada).
# This package provides basic functionality for doing logical reasoning using logical circuits. It has the stand-alone functionality illustrated below, and it serves as the logical foundations for other [Juice packages](https://github.com/Tractables) (Julia Circuit Empanada).

include("usage.jl")

# Please see [![](https://img.shields.io/badge/docs-stable-green.svg)](https://juice-jl.github.io/LogicCircuits.jl/stable) or [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://juice-jl.github.io/LogicCircuits.jl/dev) for further details.
# Please see [![](https://img.shields.io/badge/docs-stable-green.svg)](https://Tractables.github.io/LogicCircuits.jl/stable) or [![](https://img.shields.io/badge/docs-dev-blue.svg)](https://Tractables.github.io/LogicCircuits.jl/dev) for further details.

# ## Development

# If you are interested in modifying the package please see the [development readme](https://juice-jl.github.io/LogicCircuits.jl/dev/development/).
# If you are interested in modifying the package please see the [development readme](https://Tractables.github.io/LogicCircuits.jl/dev/development/).

# ## Acknowledgements

Expand Down
6 changes: 3 additions & 3 deletions docs/src/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Follow these instructions to install and use LogicCircuits.jl as a developer of

Install the Julia package in development mode by running

julia -e 'using Pkg; Pkg.develop(PackageSpec(url="https://github.com/Juice-jl/LogicCircuits.jl.git"))'
julia -e 'using Pkg; Pkg.develop(PackageSpec(url="https://github.com/Tractables/LogicCircuits.jl.git"))'

By default this will install the package at `~/.julia/dev` and allow you to change the code there. See the [Pkg manual](https://julialang.github.io/Pkg.jl/v1/managing-packages/#Developing-packages-1) for more details. One can adjust the development directory using environment variables or simply create a symbolic link to/from your favorite development directory.

Expand Down Expand Up @@ -71,8 +71,8 @@ The example is for Circuit Model Zoo, but should work for others:

1. Push new updates to [UCLA-StarAI/Circuit-Model-Zoo](https://github.com/UCLA-StarAI/Circuit-Model-Zoo)
2. Do a [new zoo release](https://github.com/UCLA-StarAI/Circuit-Model-Zoo/releases).
3. Update the `LogicCircuits.jl`'s `Artifact.toml` file with new git tag and hash. Example commit can be found [here](https://github.com/Juice-jl/LogicCircuits.jl/commit/1cd3fda02fa7bd82d1fa02898ee404edce0d7b14).
4. Do the same for `ProbabilisticCircuits.jl`'s `Artifact.toml` file. Example commit [here](https://github.com/Juice-jl/ProbabilisticCircuits.jl/commit/da7d3678b5f2254e60229632f74cc619505e2b2d).
3. Update the `LogicCircuits.jl`'s `Artifact.toml` file with new git tag and hash. Example commit can be found [here](https://github.com/Tractables/LogicCircuits.jl/commit/1cd3fda02fa7bd82d1fa02898ee404edce0d7b14).
4. Do the same for `ProbabilisticCircuits.jl`'s `Artifact.toml` file. Example commit [here](https://github.com/Tractables/ProbabilisticCircuits.jl/commit/da7d3678b5f2254e60229632f74cc619505e2b2d).
5. Note that for each Artifact.toml, 2 things need to change: `git-tree-sha1` and `sha256`.
6. Update the `const zoo_version = "/Circuit-Model-Zoo-0.1.4"` inside LogicCircuits.jl to the new zoo version. No changes needed in ProbabilisticCircuits since it uses the same constant.

Expand Down
2 changes: 1 addition & 1 deletion docs/src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ julia -e 'using Pkg; Pkg.add("LogicCircuits")'
To install the package with the latest commits on master branch, run:

```bash
julia -e 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/Juice-jl/LogicCircuits.jl.git"))'
julia -e 'using Pkg; Pkg.add(PackageSpec(url="https://github.com/Tractables/LogicCircuits.jl.git"))'
```

#### From Julia Pkg REPL
Expand Down
8 changes: 4 additions & 4 deletions docs/src/usage.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

#!plot # ## Quick Tutorial [![Open Notebook](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/Juice-jl/LogicCircuits.jl/blob/gh-pages/dev/generated/usage.ipynb)
#!plot # ## Quick Tutorial [![Open Notebook](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/Tractables/LogicCircuits.jl/blob/gh-pages/dev/generated/usage.ipynb)

#plot # ### Quick Tutorial
#plot # [![Open Notebook](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/Juice-jl/LogicCircuits.jl/blob/gh-pages/dev/generated/usage.ipynb)
#plot # [![Open Notebook](https://raw.githubusercontent.com/jupyter/design/master/logos/Badges/nbviewer_badge.svg)](https://nbviewer.jupyter.org/github/Tractables/LogicCircuits.jl/blob/gh-pages/dev/generated/usage.ipynb)

# Assuming that the LogicCircuits Julia package has been installed with `julia -e 'using Pkg; Pkg.add("LogicCircuits")'`, we can start using it as follows.

Expand All @@ -23,7 +23,7 @@ circuit(true, true, true) # sun is true, rain is true, rainbow is true

#src TODO: specific for ipython, visualize circuit using plot(circuit)?

# The purpose of this package, however, is to enable more interesting inference scenarios. This is possible by ensuring that the circuit has certain [properties](https://juice-jl.github.io/LogicCircuits.jl/dev/manual/properties/), such as *decomposability*, *determinism*, and more.
# The purpose of this package, however, is to enable more interesting inference scenarios. This is possible by ensuring that the circuit has certain [properties](https://Tractables.github.io/LogicCircuits.jl/dev/manual/properties/), such as *decomposability*, *determinism*, and more.
# Our current circuit happens to already be decomposable and deterministic by construction:
isdecomposable(circuit) && isdeterministic(circuit)
@test true == isdecomposable(circuit) && isdeterministic(circuit) #jl
Expand Down Expand Up @@ -66,7 +66,7 @@ circuit &= (¬(rain ∨ snow) ⇐ ¬cloud); # no rain or snow without clouds
#!plot # plot(circuit; simplify=true)
#!plot # ```

#!plot # <img src="https://juice-jl.github.io/LogicCircuits.jl/dev/generated/example-circuit.svg" alt="Example Logic Circuit">
#!plot # <img src="https://Tractables.github.io/LogicCircuits.jl/dev/generated/example-circuit.svg" alt="Example Logic Circuit">

# Crucially, the circuit is still decomposable and deterministic.
isdecomposable(circuit) && isdeterministic(circuit)
Expand Down
3 changes: 2 additions & 1 deletion test/aqua_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ using Test
@testset "Aqua tests" begin
Aqua.test_all(LogicCircuits,
ambiguities = false,
unbound_args= false)
unbound_args= false,
piracies = false)
end
2 changes: 1 addition & 1 deletion test/transformations_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ end
@test prob_equiv(slc, sstructplc, 3)

# Case when not all literals appear in the LC. See:
# https://github.com/Juice-jl/ProbabilisticCircuits.jl/issues/80
# https://github.com/Tractables/ProbabilisticCircuits.jl/issues/80
cnf = IOBuffer(b"""c Encodes the following: ϕ = (1 ∨ ¬2) ∧ (3 ∨ ¬4) ∧ (1 ∨ ¬4)
p cnf 4 3
1 -2 0
Expand Down
Loading